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
Cassandraの活用事例とパフォーマンス特性
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tomohiro Hashidate
June 04, 2019
Technology
3
1.2k
Cassandraの活用事例とパフォーマンス特性
Repro Tech LT発表資料
Tomohiro Hashidate
June 04, 2019
Tweet
Share
More Decks by Tomohiro Hashidate
See All by Tomohiro Hashidate
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
560
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
23
9.1k
Quarkusで作るInteractive Stream Application
joker1007
0
220
今改めてServiceクラスについて考える 〜あるRails開発者の10年〜
joker1007
25
19k
rubygem開発で鍛える設計力
joker1007
4
1.2k
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
3
1.3k
本番のトラフィック量でHudiを検証して見えてきた課題
joker1007
2
1.2k
5分で分かった気になるDebezium
joker1007
1
200
Rustで作るtree-sitterパーサーのRubyバインディング
joker1007
5
1.6k
Other Decks in Technology
See All in Technology
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
AWS DevOps Agent x ECS on Fargate検証 / AWS DevOps Agent x ECS on Fargate
kinunori
2
240
Context Engineeringの取り組み
nutslove
0
380
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
770
AIエージェントに必要なのはデータではなく文脈だった/ai-agent-context-graph-mybest
jonnojun
1
250
StrandsとNeptuneを使ってナレッジグラフを構築する
yakumo
1
130
pool.ntp.orgに ⾃宅サーバーで 参加してみたら...
tanyorg
0
1.4k
量子クラウドサービスの裏側 〜Deep Dive into OQTOPUS〜
oqtopus
0
150
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
440
GitHub Copilot CLI を使いやすくしよう
tsubakimoto_s
0
110
20260204_Midosuji_Tech
takuyay0ne
1
160
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
350
YesSQL, Process and Tooling at Scale
rocio
174
15k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
150
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
68
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Making Projects Easy
brettharned
120
6.6k
For a Future-Friendly Web
brad_frost
182
10k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
Transcript
Cassandra の活⽤事例とパフォーマンス特性 joker1007 (Repro inc. CTO)
self.inspect @joker1007 Ruby/Rails/fluentd/presto/infra ⼤体アーキテクト業 今はkafka とkudu に興味がある
話すこと Repro でのCassandra の活⽤⽬的 Cassandra の選定理由 Cassandra のパフォーマンス特性と設計時の注意 話さないこと 運⽤時の細かな注意点
何のために 端末情報記録 ユーザープロフィール情報 イベント実⾏回数 / user リアルタイムで更新される情報の保持がメイン
何故Cassandra を選択したか 書き込み回数が⾮常に多い かつ読み込み時に100 万件単位で取得しJOIN する必要がある 組み合わせる対象として、数⼗⽇分の⾏動ログを含む。 書き込みがスケールし、当時からセグメンテーションに利⽤していたpresto と連携が 可能で、読み込みもある程度分散できるデータストアが必要。
→ Cassandra を採⽤。
Cassandra のパフォーマンス特性
書き込みの概要 Client Client R2 R2 R3 R3 1 1 2
3 4 4 5 6 7 8 9 10 11 12 R1 R1 Write response Chosen node Coordinator node https://docs.datastax.com/ja/cassandra- jajp/3.0/cassandra/dml/dmlClientRequestsWrite.html
書き込みの概要 https://docs.datastax.com/ja/cassandra- jajp/3.0/cassandra/dml/dmlHowDataWritten.html
書き込みパフォーマンス特性 パーティション対象の決定とmemtable 、transaction log が書ければOK 。 最終的なテーブルファイルは不変なので、書き出しがシンプル。 パーティションさえ均等なら割と簡単にスケールする ⼀件単位の書き込みは、ほぼ100 マイクロ秒以下
現時点で20000/sec ぐらいの書き込みがある 整合性を保ってカウントアップする処理は重い 複数ノードを跨いでCAS やロックが必要になる
読み込みの概要 Client Client R2 R2 R3 R3 1 1 2
3 4 4 5 6 7 8 9 10 11 12 R1 R1 replica node failed coodinator node resends after timeout Chosen node Coordinator node https://docs.datastax.com/ja/cassandra- jajp/3.0/cassandra/dml/dmlClientRequestsRead.html
読み込みの概要 https://docs.datastax.com/ja/cassandra-jajp/3.0/cassandra/dml/dmlAboutReads.html
読み込みパフォーマンス特性 ⼀件単位の読み込みに向いている 多くのデータをまとめて取得するには不向き 取得対象のパーティションとノード特定にCPU を使う クラスタのノード間でデータの通信が多く発⽣する パーティション毎のdigest 要求 read repair
presto での利⽤は本来は不向き パーティション数とノード数でバランスを取ることで 何とか⽬的のパフォーマンスを維持
テーブル設計の重要性 読み込みワークロードに合わせてテーブルを設計する、でないとまともにパフォ ーマンスが出ない。 ユースケース毎にテーブルがあり、データの重複は覚悟する。 とにかくパーティションキー以外を条件にクエリしないこと。
まとめ 読み込みパターンに合わせたテーブル設計をすること ⽤途が適切ならかなりのパフォーマンスが出せる パーティション数とデータの分散度合いのコントロールが重要
その他のTips CPU 、ディスクI/O 、ネットワークそれぞれかなり影響があるのでメトリックをち ゃんと取得しておくこと ホットデータはオンメモリで読み書きするのでメモリは多く セカンダリインデックスは基本使えない