Tiered Storage Offload Driver Configuration for Cloud-Native Environments
0 reputation · 14 Nov 2023, 05:07 UTC
0 reputation · 14 Nov 2023, 05:07 UTC
Apache Pulsar supports tiered storage to move cold data from BookKeeper ledgers to external object stores. While local development environments often utilize a local file system implementation for this feature, production deployments typically transition to cloud providers like AWS S3 or Google Cloud Storage.
A primary challenge arises when moving from a local filesystem to a cloud-based managedLedgerOffloadDriver. The transition introduces dependencies on external IAM roles, VPC peering, and different consistency models that are not present in local testing. Specifically, the interaction between the offload threshold and the latency of the external storage provider can impact read performance for consumers accessing offloaded data.
What are the recommended configuration parameters to ensure the broker maintains stability when the external storage provider experiences high latency or temporary access denials? How does the system handle metadata consistency during the transition from BookKeeper to an eventually consistent cloud store?
The short answer: in Apache Pulsar, broker stability during cloud offload problems comes from treating offload as a background, retryable task and keeping BookKeeper as the source of truth. The offload driver never blocks foreground writes, and ledger metadata in ZooKeeper (or the configured metadata store) is only updated after the object store confirms the data, so a slow or failing S3/GCS backend degrades offload progress — not correctness.
Confirmed behavior (well-established Pulsar design):
Likely explanation for instability reports: most production issues come from misaligned thresholds (offloading too aggressively so hot reads hit the remote tier) or undersized read buffers/connection pools against the object store, not from the offload mechanism itself.
In broker.conf (or the operator CRD equivalent):
managedLedgerOffloadDriver=aws-s3 # or google-cloud-storage
s3ManagedLedgerOffloadBucket=my-bucket
s3ManagedLedgerOffloadRegion=us-east-1
s3ManagedLedgerOffloadRole=my-offload-role # IAM, not static keys
s3ManagedLedgerOffloadMaxBlockSizeInBytes=67108864
s3ManagedLedgerOffloadReadBufferSizeInBytes=1048576Then control when offload triggers, per namespace or topic:
pulsar-admin namespaces set-offload-threshold my-tenant/my-ns --size 10G
pulsar-admin namespaces set-offload-deletion-lag my-tenant/my-ns --lag 24hPractical recommendations for high-latency or flaky providers:
Pulsar does not rely on the object store's consistency model for correctness. The sequence is: upload all blocks of the ledger, then atomically update the managed-ledger metadata to point at the offloaded copy. Because the metadata store is strongly consistent, a broker either sees the ledger as local (reads from BookKeeper) or offloaded (reads from the object store) — never a half-uploaded state. Eventual consistency in the object store is absorbed by the fact that metadata flips only after the driver has confirmed the upload.
pulsar-admin topics stats-internal my-tenant/my-ns/persistent/my-topic and inspect ledgers[].offloaded.Note: exact property names vary across Pulsar versions and offload drivers; verify against the documentation for your deployed version. One detail worth confirming for your environment: which Pulsar version and whether you run brokers under an operator, since that changes where these keys are set.
Use comments to ask for clarification. Post a solution as an answer.
31,775 reputation · 14 Nov 2023, 08:54 UTC
One failure mode the existing answer doesn't cover: when offload fails persistently (expired IAM session, bucket policy change), the ledger stays in BookKeeper — which is correct behavior — but it also means local ledgers can't be deleted until offload completes. If your retention policy assumes offload has already moved data out, a broken offload pipeline turns into unbounded BookKeeper disk growth. This is the most common way a "temporary" S3 403 becomes a broker outage days later.
Practical mitigations:
pulsar-admin topics stats-internal, not just on the offload task itself.managedLedgerOffloadDeletionLagMs conservatively so a stuck upload doesn't immediately collide with retention-driven deletion.Also worth noting: the filesystem offloader is fine for local dev but unsafe in multi-broker clusters, since offloaded blocks live on one broker's disk. Verify exact config key names against your Pulsar version's broker.conf reference — they have shifted across releases.