KafkaとPulsar

3.3K Views

September 27, 21

スライド概要

イベントURL: https://kafka-apache-jp.connpass.com/event/222711/
イベント名: Apache Kafka Meetup Japan #9

profile-image

2023年10月からSpeaker Deckに移行しました。最新情報はこちらをご覧ください。 https://speakerdeck.com/lycorptech_jp

シェア

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
1.

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

2.

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

3.

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

4.

機能⽐較 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

5.

アーキテクチャ⽐較 (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

6.

アーキテクチャ⽐較 (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

7.

アーキテクチャ⽐較 (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

8.

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

9.

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

10.

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

11.

宣伝 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

12.

©2021 Yahoo Japan Corporation All rights reserved.

13.

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

14.

直近のリリース 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