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
Redis: based on real story
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Poga Po
March 31, 2012
Programming
1.4k
16
Share
Redis: based on real story
Talk @ NoSQL Taiwan
Poga Po
March 31, 2012
More Decks by Poga Po
See All by Poga Po
Spacer - iThome Serverless All-Star
poga
2
310
civic-notebook
poga
0
110
Fuzz Testing and go-fuzz
poga
0
390
everything is log
poga
12
1.9k
g0v intro
poga
0
110
新聞產生器
poga
0
690
RESTful API @ Front-End Developers Taiwan 2014-04-23
poga
3
200
Dependency Management in Go
poga
4
660
Other Decks in Programming
See All in Programming
Technical Debt: Understanding it Rightly, Engaging it Rightly #LaravelLiveJP
shogogg
0
190
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
1.1k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
3.4k
ADKを使って簡単にAIエージェントを作ってみよう
k1mu21
0
200
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
2.6k
Oxcを導入して開発体験が向上した話
yug1224
4
280
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
270
net-httpのHTTP/2対応について
naruse
0
430
エージェンティックRAGにAWSで入門しよう!
har1101
7
630
CSC307 Lecture 17
javiergs
PRO
0
310
気づいたらRubyで100作品 ー クリエイティブコーディングが生活の一部になるまで / 100 Ruby Sketches Later: How Creative Coding Became Part of My Life
chobishiba
3
540
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
180
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
How to build a perfect <img>
jonoalderson
1
5.6k
How GitHub (no longer) Works
holman
316
150k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
How to train your dragon (web standard)
notwaldorf
97
6.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Discover your Explorer Soul
emna__ayadi
2
1.1k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.2k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
The Invisible Side of Design
smashingmag
302
52k
Building Applications with DynamoDB
mza
96
7.1k
Transcript
Poga 2012.03.31 based on real story
Hi 你好 Hallo 안녕 ciao salut こんにちは
i Poga
i wear many hats
i wear many hats build products
Product released PARTY? Let’s
Database CPU Utilization
Performance Degrading = Unhappy User = Less Profit
Complex Queries Inefficient schema
Limited Time
None
Just ADD it to your stack
Just ADD it to your stack Not Replace
Special Performance Simple In-memory Atomic
Special Performance Simple In-memory Atomic
Management Problem a.k.a. “We don’t have a MIS”
Dependency Feb 25, 2009 First public beta Oct 14, 2011
Redis 2.4 First external dependency jemalloc Mar 31, 2012
Installation Feb 25, 2009 First public beta Oct 14, 2011
Redis 2.4 First external dependency jemalloc Mar 31, 2012 make install make install
Stable
None
Special Performance Simple In-memory Atomic
Special Performance Simple In-memory Atomic
In-Memory Memcached High Performance Simple Key-Value Redis In-Memory High Performance
Data Structures Persistence Replication ...
Data Structures List, Set, Sorted Set, Hash, String http://redis.io/commands
Understand your problem http://nosql.mypopescu.com/post/18977451039/redis-guide-what-each-redis-data-type-should-be-used Every command in Redis is manipulating
a data structure
Special Performance Simple In-memory Atomic
Special Performance Simple In-memory Atomic
=
http://redis.io/topics/benchmarks FAST for real
Special Performance Simple In-memory Atomic
No Race Condition every command in redis is atomic use
redis as a incremental counter “There are very few systems that support an “increment and return” operation, and Redis is one of them (Oracle sequences are another).” http://nateware.com/2010/02/18/an-atomic-rant/
No Race Condition every command in redis is atomic Combine
multiple command: still atomic! MULTI SET key 123 SET key2 456 EXEC Warning: Don’t confuse with transaction
Special Performance Simple In-memory Atomic
i
Did I make any changes to MySQL? NO It’s still
our main database
Did I solve the problem? YES solve complex queries via
Redis data structure
Happy Database Add Redis to stack
How? Sorted Set: Per user notification String: API request limiter
String, List: Request logging List: Job Queue
Real World = Risk Persistence Replication Sharding
Persistence RDB AOF
RDB • Snapshot • Compact • .rdb file can be
transfered to other backup system • Chances to lose data
AOF • logs of every write operation • durable •
bigger file size
You want a degree of safety comparable to PostgreSQL? Just
use BOTH
Replication Master Slave Slave Slave
Replication • Read-only salves • Save on slaves
Sharding • Memory is limited • Split data into multiple
redis servers
Presharding Single Machine Redis instance Redis instance Redis instance Redis
instance Redis instance Redis instance Redis instance Redis instance Redis instance Redis instance Multiple Machine
Some Case Study • Resque • Rubygems.org • Tumblr •
Instagram
Resque High Performance Job Queue https://github.com/blog/542-introducing-resque
Rubygems.org http://www.scribd.com/doc/34269414/Redis-Persistence-Power feature switch API request limit Logging Job Queue
Tumblr http://engineering.tumblr.com/post/7819252942/staircar-redis-powered-notifications Per-user Notification 30,000 request/s per server
Instagram http://engineering.tumblr.com/post/7819252942/staircar-redis-powered-notifications Simple Key-value mapping 1/3 cost on hardware
Cross server temporary file sharing i Redis string is binary-safe
Future
Future Lua Scripting Watchdog
Lua Scripting Atomic Saving bandwidth between servers
Ruby Redis Sum up 200,000 values ... 200,000 times
Ruby Redis Sum up 200,000 values, with Lua scripting 1
request
Data Model Query Language Scripting MySQL Redis Relational Table SQL
Data Structures Lua Lua
Watchdog Let Redis monitor itself Like slow queries in MySQL
More information to diagnose problem
Bright Future Lua Scripting Watchdog
= Unique
Unique = Not replacing anyone Job security of other database
What will u get
More life less cost Happy User
Thank you question? @devpoga