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
Poga Po
March 31, 2012
Programming
16
1.4k
Redis: based on real story
Talk @ NoSQL Taiwan
Poga Po
March 31, 2012
Tweet
Share
More Decks by Poga Po
See All by Poga Po
Spacer - iThome Serverless All-Star
poga
2
290
civic-notebook
poga
0
110
Fuzz Testing and go-fuzz
poga
0
370
everything is log
poga
12
1.8k
g0v intro
poga
0
94
新聞產生器
poga
0
660
RESTful API @ Front-End Developers Taiwan 2014-04-23
poga
3
180
Dependency Management in Go
poga
4
640
Other Decks in Programming
See All in Programming
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
7.9k
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
530
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
890
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
120
Ruby and LLM Ecosystem 2nd
koic
1
500
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
130
maplibre-gl-layers - 地図に移動体たくさん表示したい
kekyo
PRO
0
240
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
370
AIとペアプロして処理時間を97%削減した話 #pyconshizu
kashewnuts
1
220
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
170
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
500
15年目のiOSアプリを1から作り直す技術
teakun
1
620
Featured
See All Featured
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
Optimising Largest Contentful Paint
csswizardry
37
3.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
140
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
78
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
820
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
98
For a Future-Friendly Web
brad_frost
183
10k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
380
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
140
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