Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Advanced Redis Techniques
Search
Russ Smith
March 13, 2013
Programming
3
670
Advanced Redis Techniques
Talk given at the Las Vegas Ruby Group.
Russ Smith
March 13, 2013
Tweet
Share
Other Decks in Programming
See All in Programming
Quand Symfony, ApiPlatform, OpenAI et LangChain s'allient pour exploiter vos PDF : de la théorie à la production…
ahmedbhs123
0
210
AI Agent 時代のソフトウェア開発を支える AWS Cloud Development Kit (CDK)
konokenj
4
380
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
6.2k
#QiitaBash MCPのセキュリティ
ryosukedtomita
1
1.4k
「テストは愚直&&網羅的に書くほどよい」という誤解 / Test Smarter, Not Harder
munetoshi
0
180
The Evolution of Enterprise Java with Jakarta EE 11 and Beyond
ivargrimstad
0
120
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
790
なぜ「共通化」を考え、失敗を繰り返すのか
rinchoku
1
660
AIプログラマーDevinは PHPerの夢を見るか?
shinyasaita
1
230
フロントエンドのパフォーマンスチューニング
koukimiura
2
330
The Niche of CDK Grant オブジェクトって何者?/the-niche-of-cdk-what-isgrant-object
hassaku63
1
230
Azure AI Foundryではじめてのマルチエージェントワークフロー
seosoft
0
190
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
134
9.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.3k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
Adopting Sorbet at Scale
ufuk
77
9.5k
Music & Morning Musume
bryan
46
6.6k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.6k
A Tale of Four Properties
chriscoyier
160
23k
Documentation Writing (for coders)
carmenintech
72
4.9k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
The Cult of Friendly URLs
andyhume
79
6.5k
Transcript
Advanced Redis Techniques
Redis is an open source, BSD licensed, advanced key-value store.
It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.
the basics
ca16403c13fc9 46:count":902} {KEY:VALUE} {"von:counter s:downloads:
lists[milk,egg s,cereal,baco n,salt,plates, oranges,lettu
{name:‘bob’,em ail:‘bob@gmail .com’,passwor d:‘password’} hashsES
So what makes it different?
Deep structural awareness in the storage layer.
push, pop, sets, sorted sets, pub/Sub, unions, intersect, etc
so what about the cool kids
Resque Sidekiq Fnordmetric VON leaderboard instagram spool twitter
USE the built in data structures
LPUSH mylist ‘work’ LPOP mylist => ‘work’
hset myhash count 0 hincrby myhash count 1 hget myhash
count => 1
zadd myzset 1 “jim” zadd myzset 2 “bob” zrange myzset
0 -1
store only what you need
TWEETID:USERID
USE the pipeline FOR roflscale
redis.pipelined do redis.set(‘foo’, ‘bar’) redis.incr(‘baz’) end
Optimize what you are storing
SET user:1234 5678
* 3,000,000 = 21gb
HSET ‘users:100’ ‘1234’ ‘5689’
* 3,000,000 = 5gb
hash-max-zipmap-entries 256 hash-max-zipmap-value 1024
Shard the data
lpush ‘users:20130313’ ‘bob’
GETting REALLY nerdy
setbit activeusers:20130313 231 1 setbit activeusers:20130313 102 1
devops tips
Write the data to disk
save 60 1000
Replicate for high availability & redundancy
slaveof 10.0.0.3
use Sentinel for automatic failover
None