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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Tomohiro Hashidate
June 04, 2019
Technology
1.3k
3
Share
Cassandraの活用事例とパフォーマンス特性
Repro Tech LT発表資料
Tomohiro Hashidate
June 04, 2019
More Decks by Tomohiro Hashidate
See All by Tomohiro Hashidate
Do Ruby::Box dream of Modular Monolith?
joker1007
1
350
ReproでのicebergのStreaming Writeの検証と実運用にむけた取り組み
joker1007
0
690
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
23
9.9k
Quarkusで作るInteractive Stream Application
joker1007
0
260
今改めてServiceクラスについて考える 〜あるRails開発者の10年〜
joker1007
25
21k
rubygem開発で鍛える設計力
joker1007
4
1.3k
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
3
1.4k
本番のトラフィック量でHudiを検証して見えてきた課題
joker1007
2
1.3k
5分で分かった気になるDebezium
joker1007
1
220
Other Decks in Technology
See All in Technology
20年前の「OSS革命」に学ぶ AI時代の生存戦略
samakada
0
470
20260428_Product Management Summit_tadokoroyoshiro
tadokoro_yoshiro
12
14k
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
290
Choose your own adventure in agentic design patterns
glaforge
0
150
AIを共同作業者にして書籍を執筆する方法 / How to Write a Book with AI as a Co-Creator
ama_ch
2
150
AgentCore×VPCでの設計パターンn選と勘所
har1101
3
300
M5Stack CoreS3とZephyr(RTOS)で Edge AIっぽいことしてみた
iotengineer22
0
280
実践ハーネスエンジニアリング:TAKTで実現するAIエージェント制御 / Practical Harness Engineering: AI Agent Control Enabled by TAKT
nrslib
12
4.8k
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
4
1.4k
AIコーディング時代における、ソフトウェアサプライチェーン攻撃に対する防衛術(簡易版)
soysoysoyb
0
120
運用システムにおけるデータ活用とPlatform
sansantech
PRO
0
120
「責任あるAIエージェント」こそ自社で開発しよう!
minorun365
9
2.2k
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
Into the Great Unknown - MozCon
thekraken
41
2.4k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
180
A designer walks into a library…
pauljervisheath
211
24k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
Designing for Timeless Needs
cassininazir
0
200
The browser strikes back
jonoalderson
0
980
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
The untapped power of vector embeddings
frankvandijk
2
1.7k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
130
Amusing Abliteration
ianozsvald
1
160
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 、ネットワークそれぞれかなり影響があるのでメトリックをち ゃんと取得しておくこと ホットデータはオンメモリで読み書きするのでメモリは多く セカンダリインデックスは基本使えない