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
Perl and Riak
Search
Tatasuro Hisamori
September 21, 2013
Technology
2
3.4k
Perl and Riak
Tatasuro Hisamori
September 21, 2013
Tweet
Share
More Decks by Tatasuro Hisamori
See All by Tatasuro Hisamori
両面どころかインフラもTSでできるよ ~ 全方位TypeScriptによるプロダクト開発 ~
myfinder
11
4.5k
full test also want to end within 50ms
myfinder
11
7.6k
Other Decks in Technology
See All in Technology
[JAWS-UG 栃木 #2]AWS FISはドSなのか?システムに試練を与えて強くする!
sh_fk2
1
250
データ戦略部門 紹介資料
sansan33
PRO
1
3.1k
RDRA3.0を知ろう
kanzaki
2
330
開発も運用もビジネス部門も! クラウドで実現する「つらくない」統制とセキュリティ / Effortless Governance and Security Enabled by the Cloud
kanny
3
1.2k
OTel meets Wasm: プラグイン機構としてのWebAssemblyから見る次世代のObservability
lycorptech_jp
PRO
0
200
Rebase エンジニアリング組織の現状とこれから
rebase_engineering
0
110
Cloud Run を解剖して コンテナ監視を考える / Breaking Down Cloud Run to Rethink Container Monitoring
aoto
PRO
0
110
GitHub ActionsをTypeScriptで作ろう!
sansantech
PRO
2
380
Modular RAG Architectures with Java and Spring AI
thomasvitale
1
280
継続戦闘能⼒
sansantech
PRO
0
180
VueUseから学ぶ実践TypeScript #TSKaigi #TSKaigi2025
bengo4com
3
5.3k
OSMnx Galleryの紹介
mopinfish
0
120
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
Raft: Consensus for Rubyists
vanstee
137
6.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
105
19k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.7k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.5k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
How GitHub (no longer) Works
holman
314
140k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Practical Orchestrator
shlominoach
187
11k
Music & Morning Musume
bryan
47
6.5k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.4k
Transcript
1FSMBOE3JBL 3JBLΛ1FSM͔ΒരͰҎԼུ :"1$"TJBl1FSMBOE3JBLz
.FNDBDIFEϓϩτίϧޓϓϩμΫτͷ࣋ͭ՝ 1FSMBOE3JBL
<5PLZPc,ZPUP> Perl and Riak
• 性能 • [Tokyo|Kyoto] [Tyrant|Tycoon] は高速 • 50ms
or die. を支えるためには速度が必要 • スケーラビリティ • クライアントサイドで分散内容決まる => スケールしにくい • 「10台じゃ足りない!! 11台目を追加しよう」が簡単にできない • 運用 • 通常運用では高負荷な状況でも実績がある • データ検索したりできない(踏み込んだデータ活用に難有) <5PLZPc,ZPUP><5ZSBOUc5ZDPPO>ͷ՝ Perl and Riak
• 35#ʹɺ"VEJFODFใΛେྔʹੵɺ ׆༻ՄೳͳࢄσʔλετΞ͕ඞཁ • Ωʔͷ͕͡ΌΜ͡ΌΜ૿͍͑ͯͨ͘Ίɺε έʔϥϏϦςΟͷ֬อ͕՝ • ͜ΕΒͷ՝ʹ3JBL͕ҰఆͷճΛͨΒ ͢ͷͰͱظ͍ͯ͠Δ ͜͜·Ͱͷ·ͱΊ
Perl and Riak 1FSMBOE3JBL
• Perl • アプリケーションはほぼ全て Perl • Perl <-‐>
Riak のやり取りを受け持つモジュールが必要 • KVS • 既存の TT/KT へのアクセスは Cache::Memcached::Fast • Memcached クライアントを使っている • 運用 • メトリクス収集 -‐> CloudForecast • 監視 -‐> Nagios 'SFBL0VUͷγεςϜ Perl and Riak
• Riak Client for Perl • Net::Riak, Riak::Light, Data::Riak,
AnyEvent::Riak • REST だけ or PurePerl の Protobuf サポート • 残念ながら遅い • Memcached クライアントとインターフェース互換がない • 既存の処理に組み入れにくい • ないなら作るしかない • Riak::PBC <-‐ Protobuf のオブジェクト • Riak::Lite::PBC <-‐ 実際に Riak とやり取りする client Perl and Riak 1FSMͱ3JBL
• その他のモジュールとの比較 • https://gist.github.com/myfinder/5232845 • 結果
• 3000% over faster • 現状 Perl の世界では(たぶん)最速 • memcached like interface • Cache::Memcached::Fast 使ってる人には使いやすい Perl and Riak ࡞ͬͨNPEVMFͷੑೳ
• Test::riak • https://github.com/myfinder/p5-‐test-‐riak • 動作
• テスト実行時に、空きポートを bind して Riak を起動 • テスト終了時に、Riak を終了してくれる • テスト重要 • 継続的に運用していくシステムにおいて”テストができる”こ とはマスト要件 Perl and Riak ୯ମςετϞδϡʔϧ
՝ Perl and Riak
3JBLͦͷ··Ͱ ݱঢ় ੑೳෆ Perl and Riak
• Redirect がつらい • haproxy で分散しているので、redirectが起こりやすい • スループットが上がらない
• Set が詰まるとつらい • Set が詰まり始めると、worker の busy 率が上がる • 書き込みの非同期化が必要 • 更に踏み込んだ対策が必要 • ハードウェア / ソフトウェア 両面から Perl and Riak ՝
• SSD 必須 & RAM もできるだけ多く • 必然的にRandomAccessの多いKVSでHDDはNG
• ネットワーク機器 / 構成を取る • 内部通信が増えるので、耐えられる構成にする Perl and Riak εϧʔϓοτ্ͷͨΊʹ
• キャッシュ層を設ける • hot な key については memcached
に任せる • データの origin を Riak に持つ • -‐> 実装済み Perl and Riak εϧʔϓοτ্ͷͨΊʹ app Riak Riak Riak Riak Riak Riak app app Riak Riak memd haproxy
• hash から partition を特定する • Riak の持っている partition
情報を RPC 経由で取得 • bucket / key から hash を取得して、収容 partition を特定 • @itawasa++ • partition に所属するノードに直接getしに行く • Riak::Lite::PBC でサポート予定 • -‐> 今後の課題 だった… Perl and Riak εϧʔϓοτ্ͷͨΊʹ
՝lͩͬͨz Perl and Riak
μΠίʔϯ࣌ͷ౸དྷ Perl and Riak
• Memcached interface local proxy • https://github.com/kuenishi/dicorn
• Memcached ProtocolでRiakとやりとりが出来る • こちらにcontributeしたほうが筋が良さそう • Cache::Memcached::Fast がそのまま使える Perl and Riak μΠίʔϯʁ
• ૉͷ··ͰNTPSEJFతʹݫ͠Ί • ߏͷ͕ඞཁ • ୠ͠εϧʔϓοτΛ্͛Δख͋Δ • εέʔϥϏϦςΟͷΛࠀͰ͖ΔϝϦο τେ͖͍ •
zαʔόΛ͚ͩ͢zʹӡ༻Λམͱ͠ࠐΊΔ • ՝Λࠀͯ͠ɺΑΓ҆৺͔ͯͭ͑͠ΔΑ͏ʹ ͍͖͍ͯͨ͠͠ɺͦͷϊϋΛڞ༗͍ͨ͠ ͜͜·Ͱͷ·ͱΊ