---
title: KafkaとPulsar
tags: 
author: [Yahoo!デベロッパーネットワーク](https://www.docswell.com/user/ydnjp)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/DKE4NN6YJ1.jpg?width=480
description: イベントURL: https://kafka-apache-jp.connpass.com/event/222711/ イベント名: Apache Kafka Meetup Japan #9
published: September 27, 21
canonical: https://www.docswell.com/s/ydnjp/5EJE1K-2021-09-27-151532
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/DKE4NN6YJ1.jpg)

KafkaとPulsar
ヤフー株式会社 栗原 望
Copyright
©2021
(C)Yahoo
2020 Japan
Yahoo Corporation
Japan Corporation.
All rights
Allreserved.
Rights Reserved.


# Page. 2

![Page Image](https://bcdn.docswell.com/page/PL7155VNJG.jpg)

⾃⼰紹介
栗原 望 (くりはらのぞみ)
経歴:
•
2012/04 ヤフー株式会社に新卒⼊社
•
2012/10 ユーザーの属性情報に関する社内向けプラットフォームの開発・運⽤
•
2015/07 ヤフオク!のBEシステム再構築
•
2016/10 Apache Pulsarを使った社内向けメッセージングプラットフォームの開発・運⽤
•
2017/06~ Apache PulsarのPMC
趣味(社内同好会所属):
•
ぷよぷよ
•
ボードゲーム
©2021 Yahoo Japan Corporation All rights reserved.
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/8G7W553ME2.jpg)

Apache Pulsarとは
https://pulsar.apache.org/
•
Kafkaのライバル
•
もともとはYahoo! Inc.で社内向けのプラットフォームとして開発されていた
•
2016年9⽉ OSSとして公開
•
2017年6⽉ Apacheに移管
•
2018年9⽉ Apacheトップレベルプロジェクトに昇格
©2021 Yahoo Japan Corporation All rights reserved.
3


# Page. 4

![Page Image](https://bcdn.docswell.com/page/W4JZNNVMJ3.jpg)

機能⽐較
Kafka
Pulsar
クライアントライブラリ
Clients
Java, C/C++, Python, Node.js, Go, .NET,
Erlang, Ruby, Perl, … ※サードパーティ製含む
client-libraries
Java, C/C++, Python, Node.js, Go, .NET
データ加⼯/Stream処理
Kafka Streams
Pulsar Functions
他アプリケーションとの連携
Ecosystem: Storm, Spark, Flink, …
Kafka Connect
pulsar-adapters: Storm, Spark, Flink
Pulsar IO connetors
Exactly-once
KIP-98: Exactly Once Delivery and
Transactional Messaging
関連記事: Exactly-Once Semantics Are Possible:
Hereʼs How Kafka Does It
PIP 31: Transaction Support
メッセージのE2E暗号化
(Under Discussion) KIP-317: Add end-to-end
data encryption functionality to Apache Kafka
Encryption
★マルチテナンシー
利⽤者の利⽤単位: Topic
Kafka管理者がすべての設定を管理
利⽤者の利⽤単位: Tenant
Tenantの下にNamespace/Topicを作成
Pulsar管理者がTenant管理者に設定管理を委譲
★クラスタ間レプリケーション
MirrorMaker
Geo-replication
Replicated-subscriptions: cursor(offset)を同期
★:「Yahoo! JAPAN社内プラットフォーム」のユースケースにおいて重要視しているもの
©2021 Yahoo Japan Corporation All rights reserved.
4


# Page. 5

![Page Image](https://bcdn.docswell.com/page/KYE68855JV.jpg)

アーキテクチャ⽐較 (partition数=3, 複製数=2のとき)
Pulsar
Kafka
Topic
Part1
Part2
Broker1
Broker2
Broker3
Topic
Leader
Leader
Broker1
Broker2
Broker3
Part1
Part2
Part3
Bookie1
Bookie2
Bookie3
Seg1 Seg3 Seg4 Seg6
Seg1 Seg2 Seg4 Seg5
Part1
Part3
Leader
Seg2 Seg3
Seg5 Seg6
Part2
Part3
©2021 Yahoo Japan Corporation All rights reserved.
5


# Page. 6

![Page Image](https://bcdn.docswell.com/page/5GE599YG74.jpg)

アーキテクチャ⽐較 (partition数=3, 複製数=2のとき)
Pulsar
Kafka
Topic
Part1
Part2
Broker1
Broker2
Broker3
Topic
Leader
Leader
Broker1
Broker2
Broker3
Part1
Part2
Part3
Bookie1
Bookie2
Bookie3
Seg1 Seg3 Seg4 Seg6
Seg1 Seg2 Seg4 Seg5
Part1
Part3
Leader
Seg2 Seg3
Seg5 Seg6
Part2
• Brokerがデータを持つ
Part3
• データの分割単位: Partition
• データの分布: Leader + Follower (=複製数)
©2021 Yahoo Japan Corporation All rights reserved.
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/V97222GD7R.jpg)

アーキテクチャ⽐較 (partition数=3, 複製数=2のとき)
Pulsar
Kafka
Topic
Part1
Part2
Broker1
Broker2
Broker3
Topic
Leader
Leader
Broker1
Broker2
Broker3
Part1
Part2
Part3
Bookie1
Bookie2
Bookie3
Seg1 Seg3 Seg4 Seg6
Seg1 Seg2 Seg4 Seg5
Part1
Part3
Leader
Seg2 Seg3
Seg5 Seg6
Part2
• Brokerはデータを持たない (Stateless)
Part3
• データの分割単位: Segment (Partitionより細かい)
• データの分布: 複数のBookie (≧複製数)
©2021 Yahoo Japan Corporation All rights reserved.
7


# Page. 8

![Page Image](https://bcdn.docswell.com/page/5DJYYYVMJM.jpg)

パフォーマンス⽐較
Benchmarking Apache Kafka, Apache Pulsar, and RabbitMQ: Which is the Fastest?
Conﬂuent「Kafkaの勝ち!」
↓
Benchmarking Pulsar and Kafka - A More Accurate Perspective on Pulsarʼs Performance
StreamNative「Durability考慮して」
©2021 Yahoo Japan Corporation All rights reserved.
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/2V7NPPM3E8.jpg)

KoP – Kafka on Pulsar
https://github.com/streamnative/kop
Kafka ClientがPulsarに直接つながる
Protocol処理部分を抽象化
→ 1 pluginとしてKafka protocolを実装
©2021 Yahoo Japan Corporation All rights reserved.
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/GYJ933NPJ3.jpg)

まとめ
Pulsar
• Kafkaより後発のメッセージングプラットフォーム
• マルチテナンシー、クラスタ間レプリケーションなどが特徴的
• Brokerとストレージ(Bookie)が分離 → Brokerがstateless
• PartitionがSegmentに分割され複数のBookieに分布 → scalable
©2021 Yahoo Japan Corporation All rights reserved.
10


# Page. 11

![Page Image](https://bcdn.docswell.com/page/5GJ8MMKXJD.jpg)

宣伝
https://japan-pulsar-user-group.connpass.com/event/222026/
Apache Pulsar Meetup Japan #4 (オンライン開催)
2021/9/30(⽊) 19:00~
参加申込締切: 9/30(⽊) 18:00
©2021 Yahoo Japan Corporation All rights reserved.
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/MLJL33ZN7R.jpg)

©2021 Yahoo Japan Corporation All rights reserved.


# Page. 13

![Page Image](https://bcdn.docswell.com/page/547MDDVQ7W.jpg)

参考⽂献
•
Pulsar vs. Kafka ̶ Part 1 ̶ A More Accurate Perspective on Performance,
Architecture, and Features
•
Pulsar vs Kafka - Part 2 - Adoption, Use Cases, Diﬀerentiators, and Community
©2021 Yahoo Japan Corporation All rights reserved.
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/ZP7R442K79.jpg)

直近のリリース
Kafka
v2.4
ZK 3.5.6
•
•
•
v2.5
ZK 3.5.7
KIP-447: Producer
scalability for exactly
once semantics
2019年
•
v2.5
PIP-55: Refresh
Authentication
Credentials
Pulsar
v2.6
•
v2.7
includes the core Raft
implementation specified
in KIP-595
v2.8
•
2021年
2020年
•
v2.6
PIP-53: Contribute
DotPulsar to Apache
Pulsar
v3.0
KIP-405: Kafka
Tiered Storage
•
v2.7
PIP-31:
Transactional
Streaming
•
•
v2.8
現在
PIP-68: Exclusive
producer
PIP-82: Tenant
and namespace
level rate limiting
KIP: Kafka Improvement Proposals
PIP: Pulsar Improvement Proposals
©2021 Yahoo Japan Corporation All rights reserved.
14


