# Apache Pulsar

Apache Pulsar 是一个开源、分布式的发布—订阅消息与流处理平台，专为云环境构建，最初由雅虎（Yahoo）开发，现为 Apache 软件基金会的顶级项目。<sup>[1](https://pulsar.apache.org/)</sup><sup> • </sup><sup>[2](https://cwiki.apache.org/confluence/spaces/INCUBATOR/pages/110694328/PulsarProposal)</sup> 它将传统消息队列（如 RabbitMQ）的功能与基于日志的流处理系统（如 [Apache Kafka](https://www.edgepedia.org/zh/apache-kafka)）的功能融合于单一平台，支持多租户、跨地域复制和分层存储。<sup>[1](https://pulsar.apache.org/)</sup><sup> • </sup><sup>[3](https://docs.byteplus.com/en/docs/E-MapReduce/pulsar_note)</sup>

| 关键事实 | 详情 |
|---|---|
| 起源 | 雅虎自 2011 年起开发的系统；2016 年 9 月以 Apache 许可证开源；2017 年进入 Apache 孵化器；2018 年 9 月成为顶级项目<sup>[2](https://cwiki.apache.org/confluence/spaces/INCUBATOR/pages/110694328/PulsarProposal)</sup><sup> • </sup><sup>[4](https://developer.yahoo.com/blogs/20211026/)</sup><sup> • </sup><sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup> |
| 架构 | 计算与存储分离：无状态代理（broker）处理发布—订阅逻辑；Apache BookKeeper 的“簿记节点”（bookie）持久化存储消息；ZooKeeper 提供协调与元数据存储<sup>[6](https://staticintl.cloudcachetci.com/doc/pdf/product/pdf/1110_42917_en.pdf)</sup><sup> • </sup><sup>[7](https://pulsar.apache.org/docs/2.7.2/concepts-architecture-overview/)</sup> |
| 规模与延迟 | 单集群支持多达一百万个独立主题；消息可逐条消费或以流方式消费，延迟低于 10 毫秒；可扩展至数百个节点而无需重新洗牌数据<sup>[1](https://pulsar.apache.org/)</sup> |
| 客户端 | 六种官方维护的客户端语言：Java、Go、Python、C++、Node.js 和 C#<sup>[1](https://pulsar.apache.org/)</sup> |
| 发布模式 | 自 3.0（2023 年 5 月）首个 LTS 版本起，计划每 18 个月发布一个 LTS 版本，提供 24 个月的缺陷修复和 36 个月的安全补丁；当前 LTS 为 5.0（2026 年 10 月 5 日）<sup>[8](https://pulsar.apache.org/blog/2024/01/12/pulsar-2023-year-in-review/)</sup><sup> • </sup><sup>[9](https://pulsar.apache.org/contribute/release-policy/)</sup> |
| 部署 | 可运行于 Docker 和 Kubernetes；提供容器镜像和 Helm chart<sup>[10](https://pulsar.apache.org/download/)</sup> |

## 历史

Pulsar 源自雅虎自 2011 年起开发的系统。该公司于 2016 年 9 月将当前版本开源，2017 年将其提交至 Apache 孵化器，2018 年 9 月它毕业成为 Apache 顶级项目；ASF 董事会于 2018 年 9 月 19 日设立该项目，并任命 Matteo Merli 为副总裁。<sup>[2](https://cwiki.apache.org/confluence/spaces/INCUBATOR/pages/110694328/PulsarProposal)</sup><sup> • </sup><sup>[4](https://developer.yahoo.com/blogs/20211026/)</sup><sup> • </sup><sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup> 雅虎自身一直将 Pulsar 作为托管服务运行。<sup>[4](https://developer.yahoo.com/blogs/20211026/)</sup>

该项目的发布规范在 2023 年发生了变化。在此之前，维护周期约为 3 到 4 个月，迫使用户频繁升级旧版本。社区采用了语义化版本控制的变体，用 `LTS.feature.patch` 取代 `major.minor.patch`：3.0.0 成为首个长期支持版本，3.1.0 和 3.2.0 等版本则是其间的功能版本。项目目标是每 18 个月发布一个 LTS，缺陷修复持续 24 个月，安全漏洞补丁持续 36 个月。<sup>[8](https://pulsar.apache.org/blog/2024/01/12/pulsar-2023-year-in-review/)</sup> 当前 LTS 版本 Apache Pulsar 5.0.0 于 2026 年 10 月 5 日发布，引入了新的可扩展主题 API（Scalable Topics API），这是多项提案组成的“Topics v5”计划的成果；集群可从 4.x 升级，同时保留现有主题、客户端和 ZooKeeper 元数据。<sup>[11](https://pulsar.apache.org/blog/2026/10/05/announcing-apache-pulsar-5-0/)</sup><sup> • </sup><sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup>

## 架构

Pulsar 将计算与存储分离。发布和订阅的计算逻辑运行在**代理**（broker）中，代理是无状态的：它们不持久化存储元数据，因此可以快速连接和断开，并在集群内处理负载均衡。消息数据存放在有状态的持久化层 Apache BookKeeper 中，这是一组称为**簿记节点**（bookie）的存储节点。<sup>[6](https://staticintl.cloudcachetci.com/doc/pdf/product/pdf/1110_42917_en.pdf)</sup>

在集群内，代理接收来自生产者的传入消息并进行负载均衡，将消息分发给消费者，将消息存入 BookKeeper 实例，并依赖集群专用的 ZooKeeper 集群进行协调和配置；一个实例级的 ZooKeeper 集群——配置存储——负责协调跨集群任务，如跨地域复制。<sup>[7](https://pulsar.apache.org/docs/2.7.2/concepts-architecture-overview/)</sup> 出于性能考虑，消息通常从受管账本缓存中分发；当积压超出缓存时，代理从 BookKeeper 读取条目。<sup>[7](https://pulsar.apache.org/docs/2.7.2/concepts-architecture-overview/)</sup>

这种分层设计正是快速水平扩展的基础。由于存储层独立，添加节点无需重新洗牌数据，因此新建节点可立即投入使用以处理负载。<sup>[1](https://pulsar.apache.org/)</sup><sup> • </sup><sup>[12](https://pulsar.apache.org/use-cases/)</sup> Pulsar 还支持自动负载均衡：主题包（topic bundle）会自动迁移，热点主题包会被拆分并均匀分布到各代理上。<sup>[1](https://pulsar.apache.org/)</sup>

## 消息模型

Pulsar 在主题之上提供简单的发布—订阅语义，保证至少一次投递，为订阅者自动管理游标，并支持跨数据中心复制。<sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup> 生产者向主题发布消息；消费者订阅后可以**逐条**确认消息——如同 RabbitMQ 等经典消息队列的风格——也可以**按分区累积**确认，类似流式日志的偏移量风格。<sup>[1](https://pulsar.apache.org/)</sup>

持久化是可配置的。在持久化主题上，消息通过 BookKeeper 的持久存储保证投递，并保证在向写入方应用返回确认之前消息已写入磁盘。非持久化主题仅将消息数据保存在内存中，在某些情况下可能稍快，但放弃了这些持久性保证。<sup>[13](https://pulsar.incubator.apache.org/docs/5.0.x/concepts-messaging/)</sup> 消息重投使用至少一次语义，确保消息在投递失败后被重新处理。<sup>[13](https://pulsar.incubator.apache.org/docs/5.0.x/concepts-messaging/)</sup>

**分层存储**扩展了存储模型：较旧的积压数据从 BookKeeper 卸载到长期、更廉价的存储，同时客户端仍可透明地读取积压数据。卸载使用 Apache jclouds，支持 [Amazon S3](https://www.edgepedia.org/zh/amazon-s3)、Google Cloud Storage、Azure 和阿里云 OSS。<sup>[14](https://pulsar.incubator.apache.org/docs/4.2.x/tiered-storage-overview/)</sup><sup> • </sup><sup>[15](https://pulsar.apache.org/docs/2.11.x/concepts-overview/)</sup>

## 面向多团队平台的功能

Pulsar 被设计为**多租户**系统。一个集群可以服务整个组织，租户提供资源隔离、通过租户策略进行访问控制，并可在需要强力防范噪声邻居干扰时将特定代理隔离给某个租户。<sup>[1](https://pulsar.apache.org/)</sup> 跨区域的跨地域复制可防范整个可用区故障，具有可配置的复制策略和客户端自动故障转移到健康集群的能力。<sup>[1](https://pulsar.apache.org/)</sup>

该平台还内置了无服务器编程模型：Pulsar Functions 让开发者无需部署完整应用即可用 Java、Go 或 Python 处理消息，并捆绑了 [Kubernetes](https://www.edgepedia.org/zh/kubernetes) 运行时。官方维护的连接器可向 MySQL、Elasticsearch 和 [Cassandra](https://www.edgepedia.org/zh/cassandra) 等系统流式导入数据，或从这些系统中流式导出数据。<sup>[1](https://pulsar.apache.org/)</sup>

## 用例

项目文档将其用例归纳为几种常见模式：<sup>[12](https://pulsar.apache.org/use-cases/)</sup>

- **公司级消息平台。** 运行多种消息技术（例如 Kafka、ActiveMQ 和 RabbitMQ，通常由不同团队管理）的组织可以将它们整合到 Pulsar 上。多租户、细粒度访问控制、跨地域复制和 Kubernetes 就绪性适合集中管理但仍为团队提供自助服务的平台，而单一平台消除了跨不同代理桥接微服务的成本。<sup>[12](https://pulsar.apache.org/use-cases/)</sup>
- **任务队列。** 共享订阅将消息乱序分发给众多消费者，逐条确认让消费者可以将某条特定消息标记为完成。典型工作负载包括视频转码、缩略图生成，以及在界面于 10 毫秒内作出响应后进行的后台处理。<sup>[12](https://pulsar.apache.org/use-cases/)</sup>
- **可扩展的 RPC 与微服务通信。** 服务通过主题和消息上的间接 API 调用进行通信，避免了专门的服务发现、负载均衡和重试基础设施；水平可扩展性让平台能在几分钟内吸收大量请求涌入。<sup>[12](https://pulsar.apache.org/use-cases/)</sup><sup> • </sup><sup>[16](https://www.ibm.com/think/topics/apache-pulsar)</sup>
- **关键任务应用。** 对于银行、支付和订单场景，消息被复制到多个 BookKeeper 节点，并在发送写入确认时已写入磁盘，因此机器断电不会丢失已确认的消息。<sup>[12](https://pulsar.apache.org/use-cases/)</sup>

IBM 指出，Pulsar 正是因这些原因常被选用于消息技术整合，并且它现在每天在各大组织中管理数千亿个事件。<sup>[16](https://www.ibm.com/think/topics/apache-pulsar)</sup>

## 性能与对比

Pulsar 经常与 Apache Kafka 及其他代理进行基准对比，独立结果因配置和工作负载而异。一项针对企业级部署的 arXiv 研究在三个裸金属 Kubernetes 节点上运行 Pulsar 4.0.8（Java 21 和 ZGC 垃圾回收），验证了每秒 1,499,947 条消息、发布延迟中位数 3.88 毫秒，并预测在 15 台机器上使用五个独立集群可达每秒 1500 万条消息。<sup>[17](https://arxiv.org/abs/2603.29113)</sup> 另一项跨消息框架的比较研究测得 Kafka 峰值吞吐量为每秒 120 万条消息、p95 延迟 18 毫秒，Pulsar 为每秒 95 万条消息、p95 延迟 22 毫秒，且多租户能力更优。<sup>[18](https://arxiv.org/abs/2510.04404)</sup> 一项基于 JVM 的 Kafka、Artemis、Pulsar 和 RocketMQ 研究发现，Kafka 的延迟在不同消息大小下稳定一致，Artemis 擅长处理延迟，而 Pulsar 在其测试条件下延迟逐步攀升。<sup>[19](https://www.mdpi.com/2079-9292/12/23/4792)</sup> 这些差异取决于持久性设置、批处理和工作负载形态，而非单一的排名。<sup>[20](https://www.ijfmr.com/papers/2023/6/47563.pdf)</sup>

## 社区与项目状态

该项目的主 GitHub 仓库在 2023 年贡献者突破 600 人，自毕业以来有 639 名贡献者的 12K+ 次提交、12.2K+ GitHub 星标和 10K+ Slack 用户。<sup>[8](https://pulsar.apache.org/blog/2024/01/12/pulsar-2023-year-in-review/)</sup> ASF 董事会 2026 年 6 月的报告描述了活跃的邮件列表活动和每季度一波 Pulsar 改进提案，一个季度内有近 30 个 PIP 活跃，约为上一季度的两倍，集中在可扩展主题（Topics v5）计划上。<sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup> 项目在核心服务器之外还维护 C++、Go、Python 和 Node.js 的并行客户端发布线。<sup>[5](https://apache.org/foundation/board/minutes/Pulsar.html)</sup>

## References

1. [Apache Pulsar, project homepage](https://pulsar.apache.org/)
2. [Pulsar Proposal, Apache Incubator](https://cwiki.apache.org/confluence/spaces/INCUBATOR/pages/110694328/PulsarProposal)
3. [What is Apache Pulsar? (BytePlus documentation)](https://docs.byteplus.com/en/docs/E-MapReduce/pulsar_note)
4. [Yahoo Developer Network: Apache Pulsar blog post](https://developer.yahoo.com/blogs/20211026/)
5. [Board history: Pulsar, Apache Software Foundation](https://apache.org/foundation/board/minutes/Pulsar.html)
6. [TDMQ for Apache Pulsar, Developer Guide (Tencent Cloud)](https://staticintl.cloudcachetci.com/doc/pdf/product/pdf/1110_42917_en.pdf)
7. [Architecture Overview, Apache Pulsar 2.7.2 documentation](https://pulsar.apache.org/docs/2.7.2/concepts-architecture-overview/)
8. [Apache Pulsar 2023 Year in Review, Apache Pulsar blog](https://pulsar.apache.org/blog/2024/01/12/pulsar-2023-year-in-review/)
9. [Release policy, Apache Pulsar](https://pulsar.apache.org/contribute/release-policy/)
10. [Downloads, Apache Pulsar](https://pulsar.apache.org/download/)
11. [Apache Pulsar 5.0 LTS: Scalable Topics and Faster Existing Workloads, Apache Pulsar blog](https://pulsar.apache.org/blog/2026/10/05/announcing-apache-pulsar-5-0/)
12. [Pulsar Use Cases, Apache Pulsar](https://pulsar.apache.org/use-cases/)
13. [Messaging, Apache Pulsar documentation](https://pulsar.incubator.apache.org/docs/5.0.x/concepts-messaging/)
14. [Overview of tiered storage, Apache Pulsar documentation](https://pulsar.incubator.apache.org/docs/4.2.x/tiered-storage-overview/)
15. [Pulsar Overview, Apache Pulsar documentation](https://pulsar.apache.org/docs/2.11.x/concepts-overview/)
16. [What Is Apache Pulsar?, IBM Think](https://www.ibm.com/think/topics/apache-pulsar)
17. [1.5 Million Messages Per Second on 3 Machines: Benchmarking and Latency Optimization of Apache Pulsar at Enterprise Scale, arXiv](https://arxiv.org/abs/2603.29113)
18. [Next-Generation Event-Driven Architectures, arXiv](https://arxiv.org/abs/2510.04404)
19. [Comparative Evaluation of JVM-Based Message Queue Services, MDPI Electronics](https://www.mdpi.com/2079-9292/12/23/4792)
20. [Benchmark comparison of messaging platforms, IJFMR](https://www.ijfmr.com/papers/2023/6/47563.pdf)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Data mining, warehousing, and big data › Big data platforms and frameworks

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/apache-pulsar

English original: https://www.edgepedia.org/apache-pulsar
