Apache Pulsar

repository·master·Indexed 12 days ago

https://github.com/apache/pulsar

A distributed pub-sub messaging platform designed for high scalability, low latency, and multi-tenancy. It supports both topic and queue semantics and is built for deployment as a hosted service. The platform includes support for Kubernetes deployment, Docker Compose environments, and OAuth 2.0 Client Credentials authentication.

Tokens
299.5K
Snippets
674
Records
1.2K
Agent score
96%

What's inside Pulsar

  1. Introduction to the Pulsar Java Client V5 API

    master

    The Pulsar Java Client V5 API is a new, non-breaking replacement for the existing pulsar-client-api. It is designed to support Scalable Topics (where topic segments are managed dynamically by the broker) and provides a cleaner, more type-safe interface by separating different consumption models into distinct consumer types.

    Key improvements include:

    • Opaque Topic Model: Removes partitioning details (like partition indexes) from the client API, treating topics as single endpoints.
    • Purpose-built Consumers: Replaces the single Consumer interface with specialized types for streaming, queuing, and checkpointing.
    • Modern Java Idioms: Uses Duration, Instant, Optional, and ServiceLoader instead of legacy patterns.
    • Side-by-side Coexistence: The V5 API is shipped in new modules (pulsar-client-api-v5 and pulsar-client-v5) and can coexist with the existing v4 client in the same JVM.
    <!-- Dependency structure -->
    <dependency>
        <groupId>org.apache.pulsar</groupId>
        <artifactId>pulsar-client-api-v5</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.pulsar</groupId>
        <artifactId>pulsar-client-v5</artifactId>
    </dependency>
  2. Overview of Pulsar Manager

    master
    Pulsar Manager is a web-based GUI management and monitoring tool designed for administrators to manage and monitor Apache Pulsar clusters. Unlike the standard Pulsar Dashboard which focuses primarily on monitoring, Pulsar Manager provides full management capabilities, including CRUD operations on tenants, namespaces, topics, and subscriptions. It is designed to handle multiple Pulsar environments (e.g., Staging vs. Production) and multiple geo-replicated clusters within a single interface.
  3. Overview of PIP-478: New SPIs for Authentication, TLS, and HTTP

    master

    PIP-478 introduces three new Service Provider Interfaces (SPIs) to modernize the Pulsar Java client and resolve architectural issues in the v4 surface. This proposal is a breaking change that replaces older, synchronous, or poorly segregated interfaces with more robust, asynchronous, and purpose-driven ones.

    Key changes include:

    • v5 Authentication SPI: An asynchronous, capability-segregated replacement for the synchronous Authentication stub introduced in PIP-466. It addresses issues where the Netty event loop would block during token refreshes.
    • PulsarTlsFactory SPI: A purpose-driven SPI for TLS material loading, replacing the older PulsarSslFactory (PIP-337).
    • PulsarHttpClient SPI: A framework-managed SPI for HTTP operations.
    • Security Defaults: Pulsar 5.0 TLS is now secure by default, enabling hostname verification and requiring Subject Alternative Names (SAN).

    Note on Breaking Changes: This PIP removes the PIP-337 PulsarSslFactory entirely. Developers using custom SSL loading logic via PulsarSslFactory must migrate to the new PulsarTlsFactory SPI.

  4. Overview of PIP-264: OpenTelemetry Metrics Support

    master

    PIP-264 is a parent Proposal Improvement Plan (PIP) aimed at modernizing the Pulsar metrics system by consolidating it under OpenTelemetry (OTel).

    Core Objectives

    • Scalability: Enable monitoring of brokers with very large topic counts (10k, 100k, and potentially 1M+) by implementing internal aggregation and fine-grained filtering.
    • Standardization: Replace fragmented metric libraries with a single, industry-standard implementation using OpenTelemetry.
    • Improved Observability: Solve issues related to high cardinality, non-conformant histograms, and inconsistent naming conventions.
    • Plugin & Function Support: Provide a consistent way for plugin authors and Pulsar Function developers to integrate and report custom metrics.

    Key Design Shifts

    • Aggregation & Filtering: To handle high cardinality, metrics will be aggregated into topic groups and filtered to prevent overwhelming monitoring systems.
    • Metric Types: Moving from Summary types to Histogram types at the namespace and broker levels to improve visualization and compatibility with tools like Prometheus.
    • Eliminating Delta Resets: Removing the practice of delta-resetting metrics to prevent data loss during scrapes.
  5. Overview of the New Pulsar Broker Load Balancer (PIP-192)

    master

    PIP-192 is a major architectural update to the Pulsar load balancer designed to improve cluster utilization, transparency, and configuration simplicity.

    Key improvements include:

    • Improved Logic: More efficient topic-broker assignment, bundle splitting, and bundle unloading.
    • Decentralized Decisions: Distributing assignment and split decisions to local brokers while synchronizing unloading via a leader broker.
    • Reduced Overhead: Minimizing load data replication and replacing ZK-based metadata stores with a new bundle state channel (table-view) for better consistency and fault tolerance.
    • Enhanced Observability: New logs and metrics to make load balancing decisions transparent.
    • Administrative Control: New Admin CLI capabilities to manually transfer bundles and override system decisions.
  6. Capabilities of the Pulsar Edge Component

    master

    The Pulsar Edge Component is designed to provide the following functional capabilities:

    • Function Management: A REST interface to submit function packages (e.g., .jar files, .py files) and a REST interface to start, stop, create, and configure Pulsar functions.
    • CLI Parity: Support for the same interface as the Pulsar CLI, including secure SSL/TLS communication for REST endpoints.
    • Runtime & Execution: A dedicated runtime environment for executing Pulsar functions locally.
    • Data Forwarding: The ability to forward messages to multiple topics on a downstream Pulsar cluster over TCP.
    • Throughput Optimization: Support for message batching before forwarding to the Pulsar cluster to improve throughput in high-volume environments.
    • Bidirectional Communication (Proposed): A communication back-channel allowing Pulsar clients to send instructions back to the Edge component (e.g., sending a command to a device after an alert is detected).
  7. Key features of Scalable Topics (Topics v5)

    master

    The Scalable Topics implementation (Topics v5) introduces several architectural improvements for elastic scaling:

    • Range-based routing: Ensures key ordering is preserved during topology changes.
    • New Client API: A ground-up redesign with separate type-safe interfaces for different consumer types.
    • Push-based lookup: Uses a persistent, push-based lookup session so clients receive topology updates without polling.
    • Consumer Controller: Uses leader election and persistent assignment state for stable segment assignment.
    • Improved Consumer Model: Uses a persistent lease and consumer session model to reduce out-of-order and duplicate message processing.
    • Improved Producer Protocol: Supports application-level flow control, removing the dependency on TCP/IP flow control.
    • New Message Entry Format: Updated to support scalable topic requirements.
  8. Use Pulsarctl as an alternative to pulsar-admin

    master
    Pulsarctl is a Go-based command-line tool and library designed to manage Apache Pulsar resources via the Pulsar REST API. It serves as a more user-friendly alternative to pulsar-admin, offering better error descriptions, fewer dependencies, and integrated BookKeeper operations. It supports JWT and TLS authentication.
  9. Goals of the OpenTelemetry migration (PIP-264)

    master

    The migration to OpenTelemetry (OTel) aims to modernize Pulsar's observability with the following objectives:

    • Cardinality Management: Introduce 'Topic Metric Groups' to allow monitoring 10k to 1M topics without high cardinality costs.
    • Granular Filtering: Allow filtering metrics at the namespace, topic metric group, topic, consumer, producer, or subscription level.
    • Standardization:
      • Replace Summary with explicit bucket Histograms.
      • Consolidate all metric usage into the OpenTelemetry library.
      • Adhere to OTel Semantic Conventions for naming.
      • Support the OTLP protocol for efficient exporting.
    • Robustness:
      • Stop using delta resets (ensure counters only increase).
      • Eliminate static metric registries to prevent flaky tests.
      • Provide a rich, typed interface for Plugin and Function authors.
      • Ensure histogram reporting is Prometheus-conformant.
  10. What is the Pluggable Metadata Interface (PIP-45)?

    master

    PIP-45 introduces a unified, pluggable interface designed to abstract all Pulsar metadata interactions. Currently, Pulsar relies heavily on ZooKeeper for metadata and coordination, with ZooKeeper client API calls scattered throughout the codebase. This interface consolidates those accesses into a single generic MetadataStore interface.

    Key Characteristics:

    • Backward Compatibility: The default implementation remains based on ZooKeeper, maintaining 100% compatibility with existing metadata locations and formats.
    • Pluggable Backends: The architecture allows for multiple backend implementations, including:
      • ZooKeeper (Default)
      • Etcd
      • In-memory (for unit testing)
      • Local disk (for Pulsar standalone usage)
    • API Status: The interface is considered "Beta" and may undergo breaking changes until multiple concrete implementations are stabilized. Consequently, it is initially treated as an internal Pulsar API and is not yet open for external user plugins.
  11. Overview of the Scalable Topic Controller (PIP-468)

    master

    The Scalable Topic Controller is a broker-side component introduced as part of the Scalable Topics initiative (PIP-460). It manages the lifecycle and topology of scalable topics, which are built on a Directed Acyclic Graph (DAG) of range segments that can be split or merged to scale independently.

    The controller is responsible for:

    • Segment lifecycle management: Creating, terminating, and deleting the underlying segment topics.
    • Segment layout coordination: Executing split and merge operations with strict ordering guarantees to prevent message loss and ensure subscription cursors are present before producer redirection.
    • Consumer assignment: Coordinating which consumers receive messages from specific segments for a given subscription.
    • Leader election: Ensuring exactly one broker acts as the controller for each scalable topic with automatic failover.
    • DAG watch sessions: Pushing topology updates to connected producers and consumers whenever the segment layout changes.