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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Russ Smith
March 13, 2013
Programming
670
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Advanced Redis Techniques
Talk given at the Las Vegas Ruby Group.
Russ Smith
March 13, 2013
Other Decks in Programming
See All in Programming
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
680
Building a Meta Ray-Ban display app
akkeylab
0
120
楽しそうなつよつよエンジニアと目が死んでる僕/A brilliant engineer having a blast, and dead-eyed me.
3l4l5
2
170
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
180
全PRの83%がAIレビューだけでマージできるようになった開発組織はその後どうなったか
athug
1
1.6k
数百円から始めるRuby電子工作
tarosay
0
140
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
590
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
2
270
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
500
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
230
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
260
「寝てても仕事が進む」Claude Codeで組む第二の脳
tomoyafujita2016
0
330
Featured
See All Featured
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
370
Google's AI Overviews - The New Search
badams
0
1.1k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
610
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
64
56k
Building Adaptive Systems
keathley
44
3.2k
Unsuck your backbone
ammeep
672
58k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
460
The Pragmatic Product Professional
lauravandoore
37
7.4k
Raft: Consensus for Rubyists
vanstee
141
7.6k
My Coaching Mixtape
mlcsv
0
220
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
BBQ
matthewcrist
89
10k
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