Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RedisのCPU負荷対策パターン
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Yuuki Tsubouchi (yuuk1)
August 19, 2017
Programming
31k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RedisのCPU負荷対策パターン
by id:y_uuki
Yuuki Tsubouchi (yuuk1)
August 19, 2017
More Decks by Yuuki Tsubouchi (yuuk1)
See All by Yuuki Tsubouchi (yuuk1)
「アラーティング」の話をしよう— SREconや論文等の最先端とのギャップをみる
yuukit
7
2.1k
SAKURAONE:An Open Ethernet-based AI HPC System And Its Observed Workload Dynamicsin a Single-Tenant LLM Development Environment
yuukit
1
640
AIスーパーコンピュータにおけるLLM学習処理性能の計測と可観測性 / AI Supercomputer LLM Benchmarking and Observability
yuukit
1
1.2k
SREはサイバネティクスの夢をみるか? / Do SREs Dream of Cybernetics?
yuukit
3
840
SREのためのテレメトリー技術の探究 / Telemetry for SRE
yuukit
14
3.9k
AIスパコン「さくらONE」の オブザーバビリティ / Observability for AI Supercomputer SAKURAONE
yuukit
2
1.5k
AIスパコン「さくらONE」のLLM学習ベンチマークによる性能評価 / SAKURAONE LLM Training Benchmarking
yuukit
2
1.3k
とあるSREの博士「過程」 / A Certain SRE’s Ph.D. Journey
yuukit
11
7.7k
eBPFを用いたAIネットワーク監視システム論文の実装 / eBPF Japan Meetup #4
yuukit
3
1.9k
Other Decks in Programming
See All in Programming
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
140
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
120
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
300
iOSDC2026登壇資料.pdf
riofujimon
0
200
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
140
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
330
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
Webの地図
yosuke_furukawa
PRO
6
5k
iOSDCのペンライトを自動制御したい!
akkeylab
0
340
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.3k
Androidだけじゃない、DroidKaigiで広がった私の技術スタック
akkeylab
0
110
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
15k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
780
What's in a price? How to price your products and services
michaelherold
247
13k
Practical Orchestrator
shlominoach
192
12k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
Producing Creativity
orderedlist
PRO
348
41k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
430
Git: the NoSQL Database
bkeepers
PRO
432
67k
Transcript
ͦͯ͠ޠ Կ͔ͷRedis CPU ෛՙରࡦΛܴ͑Δ
None
RedisͷCPUෛՙରࡦ ύλʔϯ id:y_uuki Kyoto.ͳΜ͔#3
Redis ͔ͭͬͯ·͔͢ʁ
None
RedisͰCPUফඅ͕ϘτϧωοΫʹͳΔέʔε • ܦݧతʹඵؒສίϚϯυ҆ • ΫΤϦͷछྨΞΫηεύλʔϯʹΑͬͯɺ ಉ͡ϋʔυΣΞͰ͋ͬͯCPUར༻ม Խ͢Δ • CPUੑೳʹΑͬͯɺಉ͡ϫʔΫϩʔυͰ͋ͬ ͯCPUར༻มԽ͢Δ
RedisͷCPUϦιʔεফඅߏ • γϯάϧεϨουͰಈ࡞͢ΔͨΊɺϚϧνί ΞڥͰ͋ͬͯɺ1CPUίΞ͔͑͠ͳ͍ • MySQL/PostgreSQLίωΫγϣϯ͝ͱʹ εϨου/ϓϩηεΛىಈ͢ΔϚϧνεϨο υ/ϓϩηεϞσϧ
RedisͷCPUෛՙͱઓ͏ͨΊʹ ͲͷΑ͏ͳ࡞ઓΛͱΓ͏Δ͔
εέʔϧΞοϓ εέʔϧΞτ CPU1ίΞੑೳ͋͛Δ ਨׂ ࢀর༻εϨʔϒ ਫฏׂ - ࣗલ ਫฏׂ -
Redis Cluster CPUෛՙݮ RedisύΠϓϥΠϯ Lua scripting Linux RPS (Redis modules)
εέʔϧΞοϓ • RedisαʔόͷCPUΫϩοΫΛߴ͍ͷʹมߋ • EC2ͳΒc4ܥͷΠϯελϯε • ίΞΛ૿ͯ͋͠·Γҙຯͳ͍ • CPUར༻͕90%͔Β40%ʹͳͬͨ͜ͱ͕͋Δ •
Xeon E5-2650L v2 @1.70GHz (Ivy Bridge) • Xeon E5-2670 v3 @2.30GHz (Haswell) • CPUΫϩοΫʹରͯ͠ઢܗʹมԽ͢ΔΘ͚Ͱ ͳ͍
CPUෛՙݮ
CPUෛՙݮ - Linux RPS • redisεϨουͱΧʔωϧͷωοτϫʔΫI/Oε ϨουΛผʑͷίΞͰॲཧ͢Δ • RPSͰύέοτॲཧΛCPU0Ͱड͚ͯ •
redisεϨουͷCPU AffinityͰύέοτॲཧͱผ # echo ‘3’ > /sys/class/net/eth0/queues/rx-0/rps_cpus # taskset -pc 3-4 $(cat /run/redis/redis-server.pid)
None
https://speakerdeck.com/yuukit/linux-network-performance-improvement-at-hatena
CPUෛՙݮ - RedisύΠϓϥΠϯ • ΫϥΠΞϯτ͕ϨεϙϯεΛ·ͨͣʹޙଓͷϦΫΤετ Λೖ͢Δ͜ͱͰɺύέοτԟ෮ճΛݮΒ͢ • ωοτϫʔΫI/OॲཧΛ·ͱΊ࣮ͯߦͰ͖ΔͷͰɺCPU ॲཧ͕ݮΔ •
1ճͷread(2)ͰෳͷίϚϯυΛಡΈग़ͤΔͷͰɺγ εςϜίʔϧճ͕ݮΓίϯςΩετεΠονݮΔ • ਅͷRedisύΠϓϥΠϯ(by id:ichirin2501) https://redis.io/topics/pipelining
CPUෛՙݮ - Lua scripting • ͋ΔίϚϯυͷ݁ՌΛ࣍ͷίϚϯυ͕ར༻͠ ͍ͯΔҰ࿈ͷίϚϯυྻύΠϓϥΠϯ࣮ߦ ෆՄ • Lua
scriptingͳΒҰ࿈ͷίϚϯυྻΛluaίʔ υͱͯ͠ૹΓࠐΈɺ݁Ռ͚ͩड͚औΕΔ • ύΠϓϥΠϯಉ༷ɺΫϥΠΞϯτͱͷԟ෮ճ ͕ݮΓɺI/OγεςϜίʔϧΛ·ͱΊΒΕΔ https://redis.io/commands/eval
None
εέʔϧΞτ
εέʔϧΞτ-ࢀর༻εϨʔϒ • RedisϚελʔɾεϨʔϒߏ͕ͱΕΔ • ࢀরΫΤϦΛεϨʔϒʹ͚ͯϚελʔͷෛՙΛ ݮ • εϨʔϒͷલஈʹϩʔυόϥϯα͕ඞཁ • MySQLͳͲͷRDBMSͰΑ͘ͱΒΕΔ࡞ઓ
• ϨϓϦέʔγϣϯԆʹҙ • ॻ͖ࠐΜͩͣͷσʔλ͕·ͩεϨʔϒʹൖ ͍ͯ͠ͳ͍Մೳੑ͕͋Δ
εέʔϧΞτ- ਨׂ • RedisͷϚελʔϊʔυΛෳ༻ҙ͢Δ • ػೳAϚελʔ1Λ͏ɺػೳBϚελʔ2Λ ͏ • ػೳͷͿΜ͚ͩɺϚελʔϊʔυΛӡ༻͢Δίε τ͋Δ
• ͋ΔҰͭػೳͷෛՙ͕ࢧతͳ߹ʹ͑ͳ͍ • Ωϟογϡ༻్ͳΒ͚ͦͩ͜memcachedΛར༻
εέʔϧΞτ- ਫฏׂ • γϟʔσΟϯάͱݺͿ • ಉ͡༻్ͷ֤ΩʔΛෳͷϚελʔϊʔυʹࢄ • ΩʔͱϊʔυͷϚοϐϯάΛࣗͰΔ • Ϛοϐϯάํ๏༷ʑ
• ϢʔβID xxx ϊʔυYʹϚοϓ • ϢʔβID yyy ͷ༨͕ z ͳΒϊʔυXʹϚοϓ • γϟʔυΛ૿ݮͨ͠ͱ͖ͷσʔλ࠶ஔ͕͢͠ ͗ΔͷͰͱʹ͔͘Γͨ͘ͳ͍
εέʔϧΞτ- Redis ClusterʹΑΔਫฏׂ • ࠷ऴԞٛ • Ωʔͷࢄஔͱ࠶ஔ/ϑΣΠϧΦʔόʔͳͲα ϙʔτ • redis-tribͱ͍͏ެࣜπʔϧͰࣗಈ࠶ஔͰ͖Δ
• ࠷6ϊʔυඞཁ • database͕1͔͔ͭ͑͠ͳ͍ • ෳΩʔʹର͢ΔίϚϯυ࣮ߦʹҙ • 1000ϊʔυ͙Β͍·Ͱεέʔϧ͢ΔΒ͍͠
ເ
Redis modules • Redus 4.0͔ΒϞδϡʔϧػೳ͕࣮͞Εͨ • Redisͷ෦APIΛͬͯಠࣗͷσʔλߏ ίϚϯυΛ࣮Ͱ͖ΔʢΒ͍͠ʣ • ΞϓϦέʔγϣϯʹ࠷దԽͨ͠σʔλߏΛ
࡞ΕɺΊͪΌͪ͘ΌCPUޮΑ͘ͳΔͷͰ ʁʁʁʁʁ
εέʔϧΞοϓ εέʔϧΞτ CPU1ίΞੑೳ͋͛Δ ਨׂ ࢀর༻εϨʔϒ ਫฏׂ Redis Cluster CPUෛՙݮ RedisύΠϓϥΠϯ
Lua scripting Linux RPS (Redis modules)
ޠ͔Βઓུ
ઓུΛཱͯΔͨΊʹ ͱΓ͏Δઓज़Λ ͓ͬͯ͘