SlideShare a Scribd company logo
Apache Kafka 
分散システムのツアー #3 
Chris 
2014/10/15 
#m3dev 
https://github.com/m3dev/distrib-systems-tour
Kafka 
● PubSubメッセージ・キュー 
● LinkedIn発 
● 売り 
○ パフォーマンス 
○ スケーラビリティ 
○ 永続性 
○ 柔軟な配布モデル:コンシューマ・グループ 
● Scala実装、多言語のクライアント
アーキテクチャ 
Producer Producer Producer Producer 
Kafka cluster 
Broker Broker Broker 
Consumer Group 1 Consumer Group 2 
Consumer Consumer Consumer Consumer 
ZooKeeper 
HDD HDD HDD
コンシューマ・グループ 
● 全てのメッセージを全てのconsumer group(の 
consumerのいずれか)に配布する 
● 例) 
○ メッセージ 1, 2, 3, 4 
○ コンシューマグループ A, B 
○ Aにコンシューマ2台:A1, A2 
○ Bにコンシューマ2台:B1, B2 
Group A Group B 
A1 A2 B1 B2 
① ③ ② ④ ③ ④ ① ②
コンシューマ・グループ 
● スペシャルケース 
○ 全てのコンシューマが同じグループに所属 
■ 普通のキュー 
○ コンシューマはそれぞれ別グループ 
■ 普通のPub-Sub
(とある consumer group の中の話です) 
パーティション 
● トピックを複数の partition に分ける 
● Producer が message ⇔ partition の振り分け 
を決める 
● Kafka broker が partition ⇔ consumer の振り 
分けを決める 
● 制限:Consumer数 ≦ Partition数 
Producer 
Producer 
Partition 1 
Partition 2 
Consumer 
Partition 3 
Consumer
永続性 
● Brokerはメッセージをファイルに書き込む 
● Consumerがメッセージを消費しても、一定期間 
brokerに残る 
● Consumerが自身の経過を管理するので、巻き 
戻して再読み込みができる
パフォーマンス 
$ brew install kafka 
$ cd /usr/local/opt/kafka 
$ bin/start-zookeeper-server.sh libexec/config/zookeeper.properties & 
$ bin/kafka-server-start.sh libexec/config/server.properties & 
$ bin/kafka-topics.sh --create --zookeeper localhost:2181  
--replication-factor 1 --partitions 1  
--topic test 
$ bin/kafka-producer-perf-test.sh --broker-list localhost:9092  
--topics test --messages 1000000 
結果:49,568 messages/sec 
(Late 2011 MBP, 100 byte msgs)
スケーラビリティ 
LinkedIn社で1千億メッセージ/日! 
https://twitter.com/jaykreps/status/479749975853641729
使い所:リアルタイム通知
使い所:レポーティング
使い所:多目的イベント活用
ハンズオン! 
OSX: brew install kafka 
or, AWS上に稼働中のKafka を使う 
192.168.51.119:9092 
https://github.com/m3dev/distrib-systems-tour

More Related Content

PPTX
社内勉強会(Docker)
PDF
CDP in NAGOYA
PDF
k8sクラスタ構築
PDF
Kafkaによるリアルタイム処理
PDF
Fast Data を扱うためのデザインパターン
PPTX
Cassandra Summit 2016 注目セッション報告
PDF
Azure container as a service v0.1.19.1213
PDF
AWS re:Invent2017で見た AWSの強さとは
社内勉強会(Docker)
CDP in NAGOYA
k8sクラスタ構築
Kafkaによるリアルタイム処理
Fast Data を扱うためのデザインパターン
Cassandra Summit 2016 注目セッション報告
Azure container as a service v0.1.19.1213
AWS re:Invent2017で見た AWSの強さとは

Similar to Tour of Distributed Systems 3 - Apache Kafka (7)

PDF
OpenBSD/luna88k on LUNA-88K2, at OSC 2013 Nagoya
PDF
Docker ComposeでMastodonが必要なものを梱包する話
PDF
SaaS/クラウドコンピューティングでのオープンソース活用とセキュリティ
PDF
Kubernetesを触ってみた
PDF
NetBSDのクロスビルドのしくみとインストール済みLive Imageの作成
PDF
Akkaとは。アクターモデル とは。
PDF
EditShare システムの紹介
OpenBSD/luna88k on LUNA-88K2, at OSC 2013 Nagoya
Docker ComposeでMastodonが必要なものを梱包する話
SaaS/クラウドコンピューティングでのオープンソース活用とセキュリティ
Kubernetesを触ってみた
NetBSDのクロスビルドのしくみとインストール済みLive Imageの作成
Akkaとは。アクターモデル とは。
EditShare システムの紹介
Ad

More from Chris Birchall (11)

PDF
Scala.js & friends: SCALA ALL THE THINGS
PDF
Rust 超入門
PPTX
Tour of distributed systems 2 - Cassandra
PDF
Guess the Country - Playing with Twitter Streaming API
PDF
Tour of distributed systems 1 - ZooKeeper
PDF
ScalaCache: simple caching in Scala
PDF
PDF
Load testing with gatling
PDF
Debugging and Testing ES Systems
PDF
Phone Home: A client-side error collection system
PDF
Branching Strategies: Feature Branches vs Branch by Abstraction
Scala.js & friends: SCALA ALL THE THINGS
Rust 超入門
Tour of distributed systems 2 - Cassandra
Guess the Country - Playing with Twitter Streaming API
Tour of distributed systems 1 - ZooKeeper
ScalaCache: simple caching in Scala
Load testing with gatling
Debugging and Testing ES Systems
Phone Home: A client-side error collection system
Branching Strategies: Feature Branches vs Branch by Abstraction
Ad

Tour of Distributed Systems 3 - Apache Kafka