SlideShare une entreprise Scribd logo
1  sur  42
Redis Indices 
127.0.0.1:6379> CREATE INDEX _email ON user:*->email 
@itamarhaber / #RedisTLV / 22/9/2014
A Little About Myself 
A Redis Geek and Chief Developers Advocate 
at .com 
I write at http://redislabs.com/blog and edit the 
Redis Watch newsletter at 
http://redislabs.com/redis-watch-archive
Motivation 
● Redis is a Key-Value datastore -> fetching 
(is always) by (primary) key is fast 
● Searching for keys is expensive - SCAN (or, 
god forbid, the "evil" KEYS command) 
● Searching for values in keys requires a full 
(hash) table scan & sending the data to the 
client for processing
https://twitter.com/antirez/status/507082534513963009
antirez is Right 
● Redis is a "database SDK" 
● Indices imply some kind of schema (and 
there's none in Redis) 
● Redis wasn't made for indexing 
● ... 
But despite the Creator's humble opinion, 
sometimes you still need a fast way to search :)
So What is an Index? 
"A database index is a data 
structure that improves the speed 
of data retrieval operations" 
Wikipedia, 2014 
Space-Time Tradeoff
What Can be Indexed? 
Data Index 
Key -> Value Value -> Key 
• Values can be numbers or strings 
• Can be derived from "opaque" values: 
JSONs, data structures (e.g. Hash), 
functions, …
Index Operations Checklist 
1. Create index from existing data 
2. Update the index on 
a. Addition of new values 
b. Updates of existing values 
c. Deletion of keys (and also RENAME/MIGRATE…) 
3. Drop the index 
4. If needed do index housekeeping 
5. Access keys using the index
A Simple Example: Reverse Lookup 
Assume the following database, where every 
user has a single unique email address: 
HMSET user:1 id "1" email "dfucbitz@terah.net" 
How would you go about efficiently fetching the 
user's ID given an email address?
Reverse Lookup (Pseudo) Recipe 
def idxEmailAdd(email, id): # 2.a 
if not(r.setnx("_email:" + email, id)): 
raise Exception("INDEX_EXISTS") 
def idxEmailCreate(): # 1 
for each u in r.scan("user:*"): 
id, email = r.hmget(u, "id", "email") 
idxEmailAdd(email, id)
Reverse Lookup Recipe, more admin 
def idxEmailDel(email): # 2.c 
r.del("_email:" + email) 
def idxEmailUpdate(old, new): # 2.b 
idxEmailDel(old) 
idxEmailAdd(new) 
def idxEmailDrop(): ... # similar to Create
Reverse Lookup Recipe, integration 
def addUser(json): 
... 
idxEmailAdd(email, id) 
... 
def updateUser(json): ...
Reverse Lookup Recipe, usage 
def getUser(id): 
return r.hgetall("user:" + id) 
TA-DA! 
def getUserByEmail(email): # 5 
return getUser(r.get("_email:" + email))
Reverse Lookup Recipe, Analysis 
● Asymptotic computational complexity: 
o Creating the index: O(N), N is no. of values 
o Adding a new value to the index: O(1) 
o Deleting a value from the index: O(1) 
o Updating a value: O(1) + O(1) = O(1) 
o Deleting the index: O(N), N is no. of values 
● What about memory? Every key in Redis 
takes up some extra space...
Hash Index 
_email = { "dfucbitz@terah.net": 1, 
"foo@bar.baz": 2 ... } 
● Small lookups (e.g. countries) → single key 
● Big lookups → partitioned to "buckets" (e.g. 
by email address hash value) 
More info: http://redis.io/topics/memory-optimization
Always Remember 
That You Are Absolutely 
Unique 
(Just Like Everyone Else)
Uniqueness 
The lookup recipe makes the assumption that 
every user has a single email address and that 
it's unique (i.e. 1:1 relationship). 
What happens if several keys (users) have the 
same indexed value (email)?
Non-Uniqueness with Lists 
Use lists instead of using Redis' strings/hashes. 
To add: 
r.lpush("_email:" + email, id) # 2.a 
Simple. What about accessing the list for writes 
or reads? Naturally, getting the all list's 
members is O(N) but...
What?!? WTF do you mean O(N)?!? 
Because a Redis List is essentially a linked list, 
traversing it requires up to N operations 
(LINDEX, LRANGE…). That 
means that updates & deletes 
are O(N) 
Conclusion: suitable when N (i.e. number of 
duplicate index entries) is smallish (e.g. < 10)
OT: A Tip for Traversing Lists 
Lists don't have LSCAN, but with 
RPOPLPUSH you easily can do a 
circular list pattern and go over all 
the members in O(N) w/o copying 
the entire list. 
More at: http://redis.io/commands/rpoplpush
Back to Non-Uniqueness - Hashes 
Use Hashes to store multiple index values: 
r.hset("_email:" + email, id, "") # 2.a 
Great - still O(1). How about deleting? 
r.hdel("_email:" + email, id) # 2.b 
Another O(1). 
(unused)
Non-Uniqueness, Sets Variant 
r.sadd("_email:" + email, id) # 2.a 
Great - still O(1). How about deleting? 
r.srem("_email:" + email, id) # 2.b 
Another O(1).
List vs. Hash vs. Set for NUIVs* 
* Non-Unique Index Value 
● Memory: List ~= Set ~= Hash (N < 100) 
● Performance: List < Set, Hash 
● Unlike a List's elements, Set members and 
Hash fields are: 
o Unique - meaning you can't index the same key 
more than once (makes sense). 
o Unordered - a non-issue for this type of index. 
o Are SCANable 
● Forget Lists, use Sets or Hashes.
Forget Hashes, Sets are Better 
Because of the Set operations: 
SUNION, SDIFF, SINTER 
Endless possibilities, including 
matchmaking: 
SINTER _interest:devops _hair:blond _gender:...
[This Slide has No Title] 
NULL means no value and Redis is all about 
values. 
When needed, arbitrarily decide on a value for 
NULLs (e.g. "<null>") and handle it 
appropriately in code.
Index Cardinality (~= unique values) 
● High cardinality/no duplicates -> use a Hash 
● Some duplicates -> use Hash and "pointers" 
to Sets 
_email = { "dfucbitz@terah.net": 1, 
"foo@bar.baz": "*" ...} 
_email:foo@bar.baz = { 2, 3 } 
● Low cardinality is, however, another story...
Low Cardinality 
When an indexed attribute has a small number 
of possible values (e.g. Boolean, gender...): 
● If distribution of values is 50:50, consider not 
indexing it at all 
● If distribution is heavily unbalanced (5:95), 
index only the smaller subsets, full scan rest 
● Use a bitmap index if possible
Bitmap Index 
Assumption: key names are ordered 
How: a Bitset where a bit's position maps to a 
key and the bit's value is the indexed value: 
first bit -> dfucbitz is online 
_isLoggedIn = /100…/ 
second bit -> foo isn't logged in
Bitmap Index, cont. 
More than 2 values? Use n Bitsets, where n is 
the number of possible indexed values, e.g.: 
_isFromTerah = /100.../ 
_isFromEarth = /010.../ 
Bonus: BITOP AND / OR / XOR / NOT 
BITOP NOT _ET _isFromEarth 
BITOP AND onlineET _isLoggedIn _ET
Interlude: Redis Indices Save Space 
Consider the following: in a relational database 
you need "x2" space: for the indexed data 
(stored in a table) and for the index itself. 
With most Redis indices, you don't have to 
store the indexed data -> space saved :)
Numerical Ranges with Sorted Sets 
Numerical values, including timestamps 
(epoch), are trivially indexed with a Sorted Set: 
ZADD _yearOfBirth 1972 "1" 1961 "2"... 
ZADD _lastLogin 1411245569 "1" 
Use ZRANGEBYSCORE and 
ZREVRANGEBYSCORE for range queries
Ordered "Composite" Numerical Indices 
Use Sorted Sets scores that are constructed by 
the sort (range) order. Store two values in one 
score using the integer and fractional parts: 
user:1 = { "id": "1", "weightKg": "82", 
"heightCm": "218", ... } 
score = weightKg + ( heightCm / 1000 )
"Composite" Numerical Indices, cont. 
For more "complex" sorts (up to 53 bits of 
percision), you can construct the score like so: 
user:1 = { "id": "1", "weightKg": "82", 
"heightCm": "218", "IQ": "100", ... } 
score = weightKg * 1000000 + 
heightCm * 1000 + IQ 
Adapted from: 
http://www.dr-josiah.com/2013/10/multi-column-sql-like-sorting-in-redis.html
Full Text Search (Almost) (v2.8.9+) 
ZRANGEBYLEX on Sorted Set members that 
have the same score is handy for suffix 
wildcard searches, i.e. dfuc*, a-la 
autocomplete: http://autocomplete.redis.io/ 
Tip: by storing the reversed string (gnirts) you 
can also do prefix searches, i.e. *terah.net, just 
as easily.
Another Nice Thing With Sorted Sets 
By combining the use of two of these, it is 
possible to map ranges to keys (or just data). 
For example, what is 5? 
ZADD min 1 "low" 4 "medium" 7 "high" 
ZADD max 3 "low" 6 "medium" 9 "high" 
ZREVRANGEBYSCORE min –inf 5 LIMIT 0 1 
ZRANGEBYSCORE max 5 +inf LIMIT 0 1
Binary Trees 
Everybody knows that 
binary trees are really useful 
for searching and other stuff. 
You can store a binary tree 
as an array in a Sorted Set: 
(Happy 80th Birthday!)
Why stop at binary trees? BTrees! 
@thinkingfish from Twitter explained that they 
took the BSD implementation of BTrees and 
welded it into Redis (open source rulez!). This 
allows them to do efficient (speed-wise, not 
memory) key and range lookups. 
http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis- 
to-scale-105tb-ram-39mm-qps-10000-ins.html
Index Atomicity & Consistency 
In a relational database the index is (hopefully) 
always in sync with the data. 
You can strive for that in Redis, but: 
• Your code will be much more complex 
• Performance will suffer 
• There will be bugs/edge cases/extreme 
uses…
The Opposite of Atomicity & Consistency 
On the other extreme, you could consider 
implementing indexing with a: 
• Periodical process (lazy indexing) 
• Producer/Consumer pattern (i.e. queue) 
• Keyspace notifications 
You won't have any guarantees, but you'll be 
offloading the index creation from the app.
Indices, Lua & Clustering 
Server-side scripting is an obvious 
consideration for implementing a lot (if 
not all) of the indexing logic. But ... 
… in a cluster setup, a script runs on 
a single shard and can only access the 
keys there -> no guarantee that a key 
and an index are on the same shard.
Don't Think – Copy-Paste! 
For even more "inspiration" you can review the 
source code of popular ORMs libraries for 
Redis, for example: 
• https://github.com/josiahcarlson/rom 
• https://github.com/yohanboniface/redis-limpyd
Redis Indices (#RedisTLV)

Contenu connexe

Tendances

Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...
Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...
Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...nataliej4
 
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cf
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cfNGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cf
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cfnataliej4
 
He thong phat hien xam nhap IDS
He thong phat hien xam nhap IDSHe thong phat hien xam nhap IDS
He thong phat hien xam nhap IDSBui Loc
 
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...Dịch vụ viết bài trọn gói ZALO: 0936 885 877
 
Presentation điện toán đám mây
Presentation   điện toán đám mâyPresentation   điện toán đám mây
Presentation điện toán đám mâyxKinAnx
 
Tìm hiểu về OpenStack
Tìm hiểu về OpenStackTìm hiểu về OpenStack
Tìm hiểu về OpenStacklanhuonga3
 
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...nataliej4
 
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất Nghệ
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất NghệGiáo trình asp net 3.5 sử dụng VS 2008 - Nhất Nghệ
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất NghệMasterCode.vn
 
Gioi thieu-chung-ao-hoa
Gioi thieu-chung-ao-hoaGioi thieu-chung-ao-hoa
Gioi thieu-chung-ao-hoaanhhaibi
 
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...XunThin11
 
thông tin thầy cô khoa an tonaf thông tin PTIT
thông tin thầy cô khoa an tonaf thông tin PTITthông tin thầy cô khoa an tonaf thông tin PTIT
thông tin thầy cô khoa an tonaf thông tin PTITNguynMinh294
 
Tìm hiểu về Vmware
Tìm hiểu về VmwareTìm hiểu về Vmware
Tìm hiểu về VmwareBich Tuyen
 

Tendances (20)

Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...
Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...
Luận văn tốt nghiệp kỹ sư ngành công nghệ thông tin . đề tài tìm hiểu giải...
 
Đề cương xử lý ảnh
Đề cương xử lý ảnhĐề cương xử lý ảnh
Đề cương xử lý ảnh
 
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cf
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cfNGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cf
NGHIÊN CỨU XÂY DỰNG CHATBOT HỖ TRỢ TƢ VẤN DU LỊCH QUẢNG BÌNH 3f40d1cf
 
He thong phat hien xam nhap IDS
He thong phat hien xam nhap IDSHe thong phat hien xam nhap IDS
He thong phat hien xam nhap IDS
 
Luận văn: Xây dựng và sử dụng mẫu trong dạy học làm văn nghị luận
Luận văn: Xây dựng và sử dụng mẫu trong dạy học làm văn nghị luậnLuận văn: Xây dựng và sử dụng mẫu trong dạy học làm văn nghị luận
Luận văn: Xây dựng và sử dụng mẫu trong dạy học làm văn nghị luận
 
Luận án: Đặc điểm hồi kí văn học Việt Nam (1975 - 2010), HAY
Luận án: Đặc điểm hồi kí văn học Việt Nam (1975 - 2010), HAYLuận án: Đặc điểm hồi kí văn học Việt Nam (1975 - 2010), HAY
Luận án: Đặc điểm hồi kí văn học Việt Nam (1975 - 2010), HAY
 
Luận án: Tiểu thuyết Việt Nam từ góc nhìn phê bình sinh thái, HAY
Luận án: Tiểu thuyết Việt Nam từ góc nhìn phê bình sinh thái, HAYLuận án: Tiểu thuyết Việt Nam từ góc nhìn phê bình sinh thái, HAY
Luận án: Tiểu thuyết Việt Nam từ góc nhìn phê bình sinh thái, HAY
 
Luận văn: Vận dụng lý thuyết tiếp nhận vào dạy học văn học dân gian
Luận văn: Vận dụng lý thuyết tiếp nhận vào dạy học văn học dân gianLuận văn: Vận dụng lý thuyết tiếp nhận vào dạy học văn học dân gian
Luận văn: Vận dụng lý thuyết tiếp nhận vào dạy học văn học dân gian
 
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...
Luận văn:Dạy đọc hiểu văn bản văn học trung đại Việt Nam ở Ngữ văn 10 THPT th...
 
Luận án: Nghiên cứu văn bản kham dư Hán Nôm Việt Nam, HAY
Luận án: Nghiên cứu văn bản kham dư Hán Nôm Việt Nam, HAYLuận án: Nghiên cứu văn bản kham dư Hán Nôm Việt Nam, HAY
Luận án: Nghiên cứu văn bản kham dư Hán Nôm Việt Nam, HAY
 
Presentation điện toán đám mây
Presentation   điện toán đám mâyPresentation   điện toán đám mây
Presentation điện toán đám mây
 
Tìm hiểu về OpenStack
Tìm hiểu về OpenStackTìm hiểu về OpenStack
Tìm hiểu về OpenStack
 
Luận văn Thạc sĩ xây dựng ứng dụng chat trong android với firebase
Luận văn Thạc sĩ xây dựng ứng dụng chat trong android với firebaseLuận văn Thạc sĩ xây dựng ứng dụng chat trong android với firebase
Luận văn Thạc sĩ xây dựng ứng dụng chat trong android với firebase
 
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...
BÁO CÁO ĐỒ ÁN MÔN HỌC ĐIỆN TOÁN ĐÁM MÂY ĐỀ TÀI: TÌM HIỂU VÀ SỬ DỤNG AMAZON WE...
 
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất Nghệ
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất NghệGiáo trình asp net 3.5 sử dụng VS 2008 - Nhất Nghệ
Giáo trình asp net 3.5 sử dụng VS 2008 - Nhất Nghệ
 
Gioi thieu-chung-ao-hoa
Gioi thieu-chung-ao-hoaGioi thieu-chung-ao-hoa
Gioi thieu-chung-ao-hoa
 
Luận văn: Ảnh hưởng nhân sinh quan của Lão - Trang, HAY, 9đ
Luận văn: Ảnh hưởng nhân sinh quan của Lão - Trang, HAY, 9đLuận văn: Ảnh hưởng nhân sinh quan của Lão - Trang, HAY, 9đ
Luận văn: Ảnh hưởng nhân sinh quan của Lão - Trang, HAY, 9đ
 
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...
NGHIEN-CUU-VÀ-XAY-DUNG-TRO-CHOI-RAN-SAN-MOI-SU-DUNG-THUAT-TOAN-TIM-KIEM-THEO-...
 
thông tin thầy cô khoa an tonaf thông tin PTIT
thông tin thầy cô khoa an tonaf thông tin PTITthông tin thầy cô khoa an tonaf thông tin PTIT
thông tin thầy cô khoa an tonaf thông tin PTIT
 
Tìm hiểu về Vmware
Tìm hiểu về VmwareTìm hiểu về Vmware
Tìm hiểu về Vmware
 

En vedette

Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askCarlos Abalde
 
Redis Developers Day 2015 - Secondary Indexes and State of Lua
Redis Developers Day 2015 - Secondary Indexes and State of LuaRedis Developers Day 2015 - Secondary Indexes and State of Lua
Redis Developers Day 2015 - Secondary Indexes and State of LuaItamar Haber
 
Benchmarking Redis by itself and versus other NoSQL databases
Benchmarking Redis by itself and versus other NoSQL databasesBenchmarking Redis by itself and versus other NoSQL databases
Benchmarking Redis by itself and versus other NoSQL databasesItamar Haber
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
 
Power to the People: Redis Lua Scripts
Power to the People: Redis Lua ScriptsPower to the People: Redis Lua Scripts
Power to the People: Redis Lua ScriptsItamar Haber
 
Scalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisScalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisAvram Lyon
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with RedisFaisal Akber
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Maarten Balliauw
 
Use Redis in Odd and Unusual Ways
Use Redis in Odd and Unusual WaysUse Redis in Odd and Unusual Ways
Use Redis in Odd and Unusual WaysItamar Haber
 
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...Redis Labs
 
RespClient - Minimal Redis Client for PowerShell
RespClient - Minimal Redis Client for PowerShellRespClient - Minimal Redis Client for PowerShell
RespClient - Minimal Redis Client for PowerShellYoshifumi Kawai
 
UV logic using redis bitmap
UV logic using redis bitmapUV logic using redis bitmap
UV logic using redis bitmap주용 오
 
HIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProHIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProRedis Labs
 
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre... Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...Redis Labs
 
Troubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoTroubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoRedis Labs
 
RedisConf 2016 talk - The Redis API: Simple, Composable, Powerful
RedisConf 2016 talk - The Redis API: Simple, Composable, PowerfulRedisConf 2016 talk - The Redis API: Simple, Composable, Powerful
RedisConf 2016 talk - The Redis API: Simple, Composable, PowerfulDynomiteDB
 
Scalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisScalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisAvram Lyon
 
Cloud Foundry for Data Science
Cloud Foundry for Data ScienceCloud Foundry for Data Science
Cloud Foundry for Data ScienceIan Huston
 

En vedette (19)

Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Redis Developers Day 2015 - Secondary Indexes and State of Lua
Redis Developers Day 2015 - Secondary Indexes and State of LuaRedis Developers Day 2015 - Secondary Indexes and State of Lua
Redis Developers Day 2015 - Secondary Indexes and State of Lua
 
Benchmarking Redis by itself and versus other NoSQL databases
Benchmarking Redis by itself and versus other NoSQL databasesBenchmarking Redis by itself and versus other NoSQL databases
Benchmarking Redis by itself and versus other NoSQL databases
 
Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)Redis Use Patterns (DevconTLV June 2014)
Redis Use Patterns (DevconTLV June 2014)
 
Power to the People: Redis Lua Scripts
Power to the People: Redis Lua ScriptsPower to the People: Redis Lua Scripts
Power to the People: Redis Lua Scripts
 
CouchDB Map/Reduce
CouchDB Map/ReduceCouchDB Map/Reduce
CouchDB Map/Reduce
 
Scalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisScalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with Redis
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with Redis
 
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
Get more than a cache back! The Microsoft Azure Redis Cache (NDC Oslo)
 
Use Redis in Odd and Unusual Ways
Use Redis in Odd and Unusual WaysUse Redis in Odd and Unusual Ways
Use Redis in Odd and Unusual Ways
 
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...
Build a Geospatial App with Redis 3.2- Andrew Bass, Sean Yesmunt, Sergio Prad...
 
RespClient - Minimal Redis Client for PowerShell
RespClient - Minimal Redis Client for PowerShellRespClient - Minimal Redis Client for PowerShell
RespClient - Minimal Redis Client for PowerShell
 
UV logic using redis bitmap
UV logic using redis bitmapUV logic using redis bitmap
UV logic using redis bitmap
 
HIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoProHIgh Performance Redis- Tague Griffith, GoPro
HIgh Performance Redis- Tague Griffith, GoPro
 
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre... Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
Using Redis as Distributed Cache for ASP.NET apps - Peter Kellner, 73rd Stre...
 
Troubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, KakaoTroubleshooting Redis- DaeMyung Kang, Kakao
Troubleshooting Redis- DaeMyung Kang, Kakao
 
RedisConf 2016 talk - The Redis API: Simple, Composable, Powerful
RedisConf 2016 talk - The Redis API: Simple, Composable, PowerfulRedisConf 2016 talk - The Redis API: Simple, Composable, Powerful
RedisConf 2016 talk - The Redis API: Simple, Composable, Powerful
 
Scalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with RedisScalable Streaming Data Pipelines with Redis
Scalable Streaming Data Pipelines with Redis
 
Cloud Foundry for Data Science
Cloud Foundry for Data ScienceCloud Foundry for Data Science
Cloud Foundry for Data Science
 

Similaire à Redis Indices (#RedisTLV)

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisItamar Haber
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...NoSQLmatters
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearchMinsoo Jun
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLMárton Kodok
 
#SydPHP - The Magic of Redis
#SydPHP - The Magic of Redis#SydPHP - The Magic of Redis
#SydPHP - The Magic of RedisAaron Weatherall
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Andreas Dewes
 
Developing web applications in Rust
Developing web applications in RustDeveloping web applications in Rust
Developing web applications in RustSylvain Wallez
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redisjorgesimao71
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning Arno Huetter
 
AWS July Webinar Series - Getting Started with Amazon DynamoDB
AWS July Webinar Series - Getting Started with Amazon DynamoDBAWS July Webinar Series - Getting Started with Amazon DynamoDB
AWS July Webinar Series - Getting Started with Amazon DynamoDBAmazon Web Services
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best PracticesDavid Keener
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with ModulesItamar Haber
 
AI與大數據數據處理 Spark實戰(20171216)
AI與大數據數據處理 Spark實戰(20171216)AI與大數據數據處理 Spark實戰(20171216)
AI與大數據數據處理 Spark實戰(20171216)Paul Chao
 
Mongodb intro
Mongodb introMongodb intro
Mongodb introchristkv
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...Андрей Новиков
 
MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329Douglas Duncan
 

Similaire à Redis Indices (#RedisTLV) (20)

Redis introduction
Redis introductionRedis introduction
Redis introduction
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
Simon Elliston Ball – When to NoSQL and When to Know SQL - NoSQL matters Barc...
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearch
 
Introduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQLIntroduction to Databases - query optimizations for MySQL
Introduction to Databases - query optimizations for MySQL
 
#SydPHP - The Magic of Redis
#SydPHP - The Magic of Redis#SydPHP - The Magic of Redis
#SydPHP - The Magic of Redis
 
Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...Code is not text! How graph technologies can help us to understand our code b...
Code is not text! How graph technologies can help us to understand our code b...
 
lecture_34e.pptx
lecture_34e.pptxlecture_34e.pptx
lecture_34e.pptx
 
Developing web applications in Rust
Developing web applications in RustDeveloping web applications in Rust
Developing web applications in Rust
 
quickguide-einnovator-9-redis
quickguide-einnovator-9-redisquickguide-einnovator-9-redis
quickguide-einnovator-9-redis
 
NoSQL - Leo's notes
NoSQL - Leo's notesNoSQL - Leo's notes
NoSQL - Leo's notes
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Database Performance Tuning
Database Performance Tuning Database Performance Tuning
Database Performance Tuning
 
AWS July Webinar Series - Getting Started with Amazon DynamoDB
AWS July Webinar Series - Getting Started with Amazon DynamoDBAWS July Webinar Series - Getting Started with Amazon DynamoDB
AWS July Webinar Series - Getting Started with Amazon DynamoDB
 
Rails Tips and Best Practices
Rails Tips and Best PracticesRails Tips and Best Practices
Rails Tips and Best Practices
 
Extend Redis with Modules
Extend Redis with ModulesExtend Redis with Modules
Extend Redis with Modules
 
AI與大數據數據處理 Spark實戰(20171216)
AI與大數據數據處理 Spark實戰(20171216)AI與大數據數據處理 Spark實戰(20171216)
AI與大數據數據處理 Spark實戰(20171216)
 
Mongodb intro
Mongodb introMongodb intro
Mongodb intro
 
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...Индексируем базу: как делать хорошо и не делать плохо   Winter saint p 2021 m...
Индексируем базу: как делать хорошо и не делать плохо Winter saint p 2021 m...
 
MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329MongoDB and Indexes - MUG Denver - 20160329
MongoDB and Indexes - MUG Denver - 20160329
 

Plus de Itamar Haber

Redis v5 & Streams
Redis v5 & StreamsRedis v5 & Streams
Redis v5 & StreamsItamar Haber
 
Redis Modules API - an introduction
Redis Modules API - an introductionRedis Modules API - an introduction
Redis Modules API - an introductionItamar Haber
 
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...Itamar Haber
 
Redis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetupRedis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetupItamar Haber
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon KickoffItamar Haber
 
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...Itamar Haber
 
What's new in Redis v3.2
What's new in Redis v3.2What's new in Redis v3.2
What's new in Redis v3.2Itamar Haber
 
Why Your MongoDB Needs Redis
Why Your MongoDB Needs RedisWhy Your MongoDB Needs Redis
Why Your MongoDB Needs RedisItamar Haber
 
Redis & MongoDB: Stop Big Data Indigestion Before It Starts
Redis & MongoDB: Stop Big Data Indigestion Before It StartsRedis & MongoDB: Stop Big Data Indigestion Before It Starts
Redis & MongoDB: Stop Big Data Indigestion Before It StartsItamar Haber
 

Plus de Itamar Haber (10)

Redis v5 & Streams
Redis v5 & StreamsRedis v5 & Streams
Redis v5 & Streams
 
Redis Modules API - an introduction
Redis Modules API - an introductionRedis Modules API - an introduction
Redis Modules API - an introduction
 
Redis Lua Scripts
Redis Lua ScriptsRedis Lua Scripts
Redis Lua Scripts
 
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...
How I Implemented the #1 Requested Feature In Redis In Less than 1 Hour with ...
 
Redis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetupRedis Streams - Fiverr Tech5 meetup
Redis Streams - Fiverr Tech5 meetup
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
 
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...
Leveraging Probabilistic Data Structures for Real Time Analytics with Redis M...
 
What's new in Redis v3.2
What's new in Redis v3.2What's new in Redis v3.2
What's new in Redis v3.2
 
Why Your MongoDB Needs Redis
Why Your MongoDB Needs RedisWhy Your MongoDB Needs Redis
Why Your MongoDB Needs Redis
 
Redis & MongoDB: Stop Big Data Indigestion Before It Starts
Redis & MongoDB: Stop Big Data Indigestion Before It StartsRedis & MongoDB: Stop Big Data Indigestion Before It Starts
Redis & MongoDB: Stop Big Data Indigestion Before It Starts
 

Dernier

Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Thomas Poetter
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsVICTOR MAESTRE RAMIREZ
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxaleedritatuxx
 
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Boston Institute of Analytics
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Seán Kennedy
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our WorldEduminds Learning
 
Real-Time AI Streaming - AI Max Princeton
Real-Time AI  Streaming - AI Max PrincetonReal-Time AI  Streaming - AI Max Princeton
Real-Time AI Streaming - AI Max PrincetonTimothy Spann
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesTimothy Spann
 
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...Unveiling the Role of Social Media Suspect Investigators in Preventing Online...
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...Milind Agarwal
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksdeepakthakur548787
 
SMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxSMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxHaritikaChhatwal1
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Cathrine Wilhelmsen
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 217djon017
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPTBoston Institute of Analytics
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxSimranPal17
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...Amil Baba Dawood bangali
 
convolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfconvolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfSubhamKumar3239
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Seán Kennedy
 

Dernier (20)

Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
Minimizing AI Hallucinations/Confabulations and the Path towards AGI with Exa...
 
Data Analysis Project: Stroke Prediction
Data Analysis Project: Stroke PredictionData Analysis Project: Stroke Prediction
Data Analysis Project: Stroke Prediction
 
Advanced Machine Learning for Business Professionals
Advanced Machine Learning for Business ProfessionalsAdvanced Machine Learning for Business Professionals
Advanced Machine Learning for Business Professionals
 
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptxmodul pembelajaran robotic Workshop _ by Slidesgo.pptx
modul pembelajaran robotic Workshop _ by Slidesgo.pptx
 
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
Data Analysis Project Presentation: Unveiling Your Ideal Customer, Bank Custo...
 
Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...Student profile product demonstration on grades, ability, well-being and mind...
Student profile product demonstration on grades, ability, well-being and mind...
 
Learn How Data Science Changes Our World
Learn How Data Science Changes Our WorldLearn How Data Science Changes Our World
Learn How Data Science Changes Our World
 
Real-Time AI Streaming - AI Max Princeton
Real-Time AI  Streaming - AI Max PrincetonReal-Time AI  Streaming - AI Max Princeton
Real-Time AI Streaming - AI Max Princeton
 
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming PipelinesConf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
Conf42-LLM_Adding Generative AI to Real-Time Streaming Pipelines
 
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...Unveiling the Role of Social Media Suspect Investigators in Preventing Online...
Unveiling the Role of Social Media Suspect Investigators in Preventing Online...
 
Digital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing worksDigital Marketing Plan, how digital marketing works
Digital Marketing Plan, how digital marketing works
 
SMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptxSMOTE and K-Fold Cross Validation-Presentation.pptx
SMOTE and K-Fold Cross Validation-Presentation.pptx
 
Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)Data Factory in Microsoft Fabric (MsBIP #82)
Data Factory in Microsoft Fabric (MsBIP #82)
 
Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2Easter Eggs From Star Wars and in cars 1 and 2
Easter Eggs From Star Wars and in cars 1 and 2
 
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default  Presentation : Data Analysis Project PPTPredictive Analysis for Loan Default  Presentation : Data Analysis Project PPT
Predictive Analysis for Loan Default Presentation : Data Analysis Project PPT
 
What To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptxWhat To Do For World Nature Conservation Day by Slidesgo.pptx
What To Do For World Nature Conservation Day by Slidesgo.pptx
 
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
NO1 Certified Black Magic Specialist Expert Amil baba in Lahore Islamabad Raw...
 
convolutional neural network and its applications.pdf
convolutional neural network and its applications.pdfconvolutional neural network and its applications.pdf
convolutional neural network and its applications.pdf
 
Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...Student Profile Sample report on improving academic performance by uniting gr...
Student Profile Sample report on improving academic performance by uniting gr...
 
Insurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis ProjectInsurance Churn Prediction Data Analysis Project
Insurance Churn Prediction Data Analysis Project
 

Redis Indices (#RedisTLV)

  • 1. Redis Indices 127.0.0.1:6379> CREATE INDEX _email ON user:*->email @itamarhaber / #RedisTLV / 22/9/2014
  • 2. A Little About Myself A Redis Geek and Chief Developers Advocate at .com I write at http://redislabs.com/blog and edit the Redis Watch newsletter at http://redislabs.com/redis-watch-archive
  • 3. Motivation ● Redis is a Key-Value datastore -> fetching (is always) by (primary) key is fast ● Searching for keys is expensive - SCAN (or, god forbid, the "evil" KEYS command) ● Searching for values in keys requires a full (hash) table scan & sending the data to the client for processing
  • 5. antirez is Right ● Redis is a "database SDK" ● Indices imply some kind of schema (and there's none in Redis) ● Redis wasn't made for indexing ● ... But despite the Creator's humble opinion, sometimes you still need a fast way to search :)
  • 6. So What is an Index? "A database index is a data structure that improves the speed of data retrieval operations" Wikipedia, 2014 Space-Time Tradeoff
  • 7. What Can be Indexed? Data Index Key -> Value Value -> Key • Values can be numbers or strings • Can be derived from "opaque" values: JSONs, data structures (e.g. Hash), functions, …
  • 8. Index Operations Checklist 1. Create index from existing data 2. Update the index on a. Addition of new values b. Updates of existing values c. Deletion of keys (and also RENAME/MIGRATE…) 3. Drop the index 4. If needed do index housekeeping 5. Access keys using the index
  • 9. A Simple Example: Reverse Lookup Assume the following database, where every user has a single unique email address: HMSET user:1 id "1" email "dfucbitz@terah.net" How would you go about efficiently fetching the user's ID given an email address?
  • 10. Reverse Lookup (Pseudo) Recipe def idxEmailAdd(email, id): # 2.a if not(r.setnx("_email:" + email, id)): raise Exception("INDEX_EXISTS") def idxEmailCreate(): # 1 for each u in r.scan("user:*"): id, email = r.hmget(u, "id", "email") idxEmailAdd(email, id)
  • 11. Reverse Lookup Recipe, more admin def idxEmailDel(email): # 2.c r.del("_email:" + email) def idxEmailUpdate(old, new): # 2.b idxEmailDel(old) idxEmailAdd(new) def idxEmailDrop(): ... # similar to Create
  • 12. Reverse Lookup Recipe, integration def addUser(json): ... idxEmailAdd(email, id) ... def updateUser(json): ...
  • 13. Reverse Lookup Recipe, usage def getUser(id): return r.hgetall("user:" + id) TA-DA! def getUserByEmail(email): # 5 return getUser(r.get("_email:" + email))
  • 14. Reverse Lookup Recipe, Analysis ● Asymptotic computational complexity: o Creating the index: O(N), N is no. of values o Adding a new value to the index: O(1) o Deleting a value from the index: O(1) o Updating a value: O(1) + O(1) = O(1) o Deleting the index: O(N), N is no. of values ● What about memory? Every key in Redis takes up some extra space...
  • 15. Hash Index _email = { "dfucbitz@terah.net": 1, "foo@bar.baz": 2 ... } ● Small lookups (e.g. countries) → single key ● Big lookups → partitioned to "buckets" (e.g. by email address hash value) More info: http://redis.io/topics/memory-optimization
  • 16. Always Remember That You Are Absolutely Unique (Just Like Everyone Else)
  • 17. Uniqueness The lookup recipe makes the assumption that every user has a single email address and that it's unique (i.e. 1:1 relationship). What happens if several keys (users) have the same indexed value (email)?
  • 18. Non-Uniqueness with Lists Use lists instead of using Redis' strings/hashes. To add: r.lpush("_email:" + email, id) # 2.a Simple. What about accessing the list for writes or reads? Naturally, getting the all list's members is O(N) but...
  • 19. What?!? WTF do you mean O(N)?!? Because a Redis List is essentially a linked list, traversing it requires up to N operations (LINDEX, LRANGE…). That means that updates & deletes are O(N) Conclusion: suitable when N (i.e. number of duplicate index entries) is smallish (e.g. < 10)
  • 20. OT: A Tip for Traversing Lists Lists don't have LSCAN, but with RPOPLPUSH you easily can do a circular list pattern and go over all the members in O(N) w/o copying the entire list. More at: http://redis.io/commands/rpoplpush
  • 21. Back to Non-Uniqueness - Hashes Use Hashes to store multiple index values: r.hset("_email:" + email, id, "") # 2.a Great - still O(1). How about deleting? r.hdel("_email:" + email, id) # 2.b Another O(1). (unused)
  • 22. Non-Uniqueness, Sets Variant r.sadd("_email:" + email, id) # 2.a Great - still O(1). How about deleting? r.srem("_email:" + email, id) # 2.b Another O(1).
  • 23. List vs. Hash vs. Set for NUIVs* * Non-Unique Index Value ● Memory: List ~= Set ~= Hash (N < 100) ● Performance: List < Set, Hash ● Unlike a List's elements, Set members and Hash fields are: o Unique - meaning you can't index the same key more than once (makes sense). o Unordered - a non-issue for this type of index. o Are SCANable ● Forget Lists, use Sets or Hashes.
  • 24. Forget Hashes, Sets are Better Because of the Set operations: SUNION, SDIFF, SINTER Endless possibilities, including matchmaking: SINTER _interest:devops _hair:blond _gender:...
  • 25. [This Slide has No Title] NULL means no value and Redis is all about values. When needed, arbitrarily decide on a value for NULLs (e.g. "<null>") and handle it appropriately in code.
  • 26. Index Cardinality (~= unique values) ● High cardinality/no duplicates -> use a Hash ● Some duplicates -> use Hash and "pointers" to Sets _email = { "dfucbitz@terah.net": 1, "foo@bar.baz": "*" ...} _email:foo@bar.baz = { 2, 3 } ● Low cardinality is, however, another story...
  • 27. Low Cardinality When an indexed attribute has a small number of possible values (e.g. Boolean, gender...): ● If distribution of values is 50:50, consider not indexing it at all ● If distribution is heavily unbalanced (5:95), index only the smaller subsets, full scan rest ● Use a bitmap index if possible
  • 28. Bitmap Index Assumption: key names are ordered How: a Bitset where a bit's position maps to a key and the bit's value is the indexed value: first bit -> dfucbitz is online _isLoggedIn = /100…/ second bit -> foo isn't logged in
  • 29. Bitmap Index, cont. More than 2 values? Use n Bitsets, where n is the number of possible indexed values, e.g.: _isFromTerah = /100.../ _isFromEarth = /010.../ Bonus: BITOP AND / OR / XOR / NOT BITOP NOT _ET _isFromEarth BITOP AND onlineET _isLoggedIn _ET
  • 30. Interlude: Redis Indices Save Space Consider the following: in a relational database you need "x2" space: for the indexed data (stored in a table) and for the index itself. With most Redis indices, you don't have to store the indexed data -> space saved :)
  • 31. Numerical Ranges with Sorted Sets Numerical values, including timestamps (epoch), are trivially indexed with a Sorted Set: ZADD _yearOfBirth 1972 "1" 1961 "2"... ZADD _lastLogin 1411245569 "1" Use ZRANGEBYSCORE and ZREVRANGEBYSCORE for range queries
  • 32. Ordered "Composite" Numerical Indices Use Sorted Sets scores that are constructed by the sort (range) order. Store two values in one score using the integer and fractional parts: user:1 = { "id": "1", "weightKg": "82", "heightCm": "218", ... } score = weightKg + ( heightCm / 1000 )
  • 33. "Composite" Numerical Indices, cont. For more "complex" sorts (up to 53 bits of percision), you can construct the score like so: user:1 = { "id": "1", "weightKg": "82", "heightCm": "218", "IQ": "100", ... } score = weightKg * 1000000 + heightCm * 1000 + IQ Adapted from: http://www.dr-josiah.com/2013/10/multi-column-sql-like-sorting-in-redis.html
  • 34. Full Text Search (Almost) (v2.8.9+) ZRANGEBYLEX on Sorted Set members that have the same score is handy for suffix wildcard searches, i.e. dfuc*, a-la autocomplete: http://autocomplete.redis.io/ Tip: by storing the reversed string (gnirts) you can also do prefix searches, i.e. *terah.net, just as easily.
  • 35. Another Nice Thing With Sorted Sets By combining the use of two of these, it is possible to map ranges to keys (or just data). For example, what is 5? ZADD min 1 "low" 4 "medium" 7 "high" ZADD max 3 "low" 6 "medium" 9 "high" ZREVRANGEBYSCORE min –inf 5 LIMIT 0 1 ZRANGEBYSCORE max 5 +inf LIMIT 0 1
  • 36. Binary Trees Everybody knows that binary trees are really useful for searching and other stuff. You can store a binary tree as an array in a Sorted Set: (Happy 80th Birthday!)
  • 37. Why stop at binary trees? BTrees! @thinkingfish from Twitter explained that they took the BSD implementation of BTrees and welded it into Redis (open source rulez!). This allows them to do efficient (speed-wise, not memory) key and range lookups. http://highscalability.com/blog/2014/9/8/how-twitter-uses-redis- to-scale-105tb-ram-39mm-qps-10000-ins.html
  • 38. Index Atomicity & Consistency In a relational database the index is (hopefully) always in sync with the data. You can strive for that in Redis, but: • Your code will be much more complex • Performance will suffer • There will be bugs/edge cases/extreme uses…
  • 39. The Opposite of Atomicity & Consistency On the other extreme, you could consider implementing indexing with a: • Periodical process (lazy indexing) • Producer/Consumer pattern (i.e. queue) • Keyspace notifications You won't have any guarantees, but you'll be offloading the index creation from the app.
  • 40. Indices, Lua & Clustering Server-side scripting is an obvious consideration for implementing a lot (if not all) of the indexing logic. But ... … in a cluster setup, a script runs on a single shard and can only access the keys there -> no guarantee that a key and an index are on the same shard.
  • 41. Don't Think – Copy-Paste! For even more "inspiration" you can review the source code of popular ORMs libraries for Redis, for example: • https://github.com/josiahcarlson/rom • https://github.com/yohanboniface/redis-limpyd