GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Broker] Disable memory limit controller for broker client and replication clients by lhotari · Pull Request #15723 · apache/pulsar

Conversation

@lhotari

@lhotari lhotari commented May 23, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Fixes #15691

Motivation

There's a performance regression in 2.10 in geo-replication since the client memory limit is enabled by default in "PIP-120: Enable client memory limit by default", #13306 .

Modifications

  • disable memory limit by default for broker client and replication clients
  • restore the default maxPendingMessages & maxPendingMessagesAcrossPartitions limits for producers to the defaults used before PIP-120 changes when the memory limit is disabled.
    • The broker client's producer is used in a few location and it would be more consistent also for other applications when the defaults are adjusted if the memory limit is disabled.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@lhotari lhotari added type/bug The PR fixed a bug or issue reported a bug release/2.10.1 labels May 23, 2022
@lhotari lhotari added this to the 2.11.0 milestone May 23, 2022
@lhotari lhotari self-assigned this May 23, 2022
@github-actions

github-actions Bot commented May 23, 2022

Copy link
Copy Markdown

@lhotari:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the doc-label-missing label May 23, 2022
@lhotari lhotari mentioned this pull request May 23, 2022
[Broker] Support configuration of the memory allocated to replication producer #15691
Closed
@lhotari
lhotari requested review from codelipenghui, eolivelli, merlimat and michaeljmarshall May 23, 2022 17:31
michaeljmarshall
michaeljmarshall approved these changes May 23, 2022
View reviewed changes
@lhotari lhotari mentioned this pull request May 23, 2022
[Broker] Replicator producer should have blockIfQueueFull=true #15724
Closed
@lhotari lhotari added the doc-not-needed Your PR changes do not impact docs label May 23, 2022
@github-actions github-actions Bot removed the doc-label-missing label May 23, 2022
@github-actions

github-actions Bot commented May 23, 2022

Copy link
Copy Markdown

@lhotari:Thanks for providing doc info!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lhotari

lhotari commented May 23, 2022

Copy link
Copy Markdown
Member Author

I also added #15724 to address a problem seen in #15691

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

merlimat
merlimat approved these changes May 23, 2022
View reviewed changes
merlimat
merlimat reviewed May 23, 2022
View reviewed changes
Comment thread conf/broker.conf Resolved

Uh oh!

There was an error while loading. Please reload this page.

michaeljmarshall
michaeljmarshall requested changes May 23, 2022
View reviewed changes

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this is only a partial solution. We should configure all clients with the correct configuration.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@lhotari

lhotari commented May 24, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

It looks like this is only a partial solution. We should configure all clients with the correct configuration.

@michaeljmarshall It's intentional that this PR addresses only the replication clients. That's the problem that we have faced.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

michaeljmarshall
michaeljmarshall approved these changes May 24, 2022
View reviewed changes
@michaeljmarshall

michaeljmarshall commented May 24, 2022

Copy link
Copy Markdown
Member

It looks like this is only a partial solution. We should configure all clients with the correct configuration.

@michaeljmarshall It's intentional that this PR addresses only the replication clients. That's the problem that we have faced.

@lhotari - sorry, I completely missed the configuration name. Do you think it'll make sense long term to have this separate config? I have been thinking about consolidating client configuration in to simplify broker client configuration.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lhotari

lhotari commented May 24, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

@lhotari - sorry, I completely missed the configuration name. Do you think it'll make sense long term to have this separate config? I have been thinking about consolidating client configuration in to simplify broker client configuration.

@michaeljmarshall Good point. After all it might be worth hard coding the setting to 0 for the actual broker client + all replication clients as @merlimat suggested. The benefit of this would be that we don't unnecessarily introduce new settings which aren't useful in the end. I will revisit this PR.

We can add the way to configure the limits later.

merlimat reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lhotari
lhotari marked this pull request as draft May 24, 2022 04:43
@lhotari lhotari changed the title [Broker] Add replicationClientMemoryLimitBytes setting for configuring replication client memory limit [Broker] Disable memory limit controller for broker client and replication clients May 24, 2022
@lhotari
lhotari force-pushed the lh-replication-client-memory-limit branch from 6fb1287 to 3c277ce Compare May 24, 2022 07:57
@lhotari
lhotari marked this pull request as ready for review May 24, 2022 08:02
@lhotari
[Broker] Disable memory limit controller for broker client and replic…
61d4a8c
…ation clients

- disable memory limit by default for broker client and replication clients
- restore maxPendingMessages and maxPendingMessagesAcrossPartitions when memory limit is
  disabled so that pre-PIP-120 default configuration is restored when limit is disabled
@lhotari
lhotari force-pushed the lh-replication-client-memory-limit branch from 3c277ce to 61d4a8c Compare May 24, 2022 08:03
@lhotari
lhotari requested a review from nicoloboschi May 24, 2022 08:04
eolivelli
eolivelli approved these changes May 24, 2022
View reviewed changes

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

we should add this to branch-2.10

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced May 24, 2022
[Cli tools] Disable Pulsar client memory limit by default #15748
Merged
[Broker, Functions, Websocket] Disable memory limit controller in internal Pulsar clients #15752
Merged
lhotari added a commit to datastax/pulsar that referenced this pull request May 24, 2022
@lhotari
[Broker] Disable memory limit controller for broker client and replic…
4a2f75e
…ation clients (apache#15723)

- disable memory limit by default for broker client and replication clients
- restore maxPendingMessages and maxPendingMessagesAcrossPartitions when memory limit is
  disabled so that pre-PIP-120 default configuration is restored when limit is disabled
HQebupt
HQebupt approved these changes May 24, 2022
View reviewed changes
@lhotari

lhotari commented May 24, 2022

Copy link
Copy Markdown
Member Author

/pulsarbot rerun-failure-checks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

merlimat
merlimat approved these changes May 25, 2022
View reviewed changes
@merlimat
merlimat merged commit 563a7cb into apache:master May 25, 2022
merlimat pushed a commit that referenced this pull request May 25, 2022
@lhotari @merlimat
[Broker] Disable memory limit controller for broker client and replic…
a56f041
…ation clients (#15723)

- disable memory limit by default for broker client and replication clients
- restore maxPendingMessages and maxPendingMessagesAcrossPartitions when memory limit is
  disabled so that pre-PIP-120 default configuration is restored when limit is disabled
lhotari added a commit that referenced this pull request May 25, 2022
@lhotari
Fix cherry-picking issue with #15723
d2f0346
- this method was missing from a56f041
@lhotari lhotari added the cherry-picked/branch-2.10 label Jun 6, 2022
This was referenced Aug 17, 2026
[fix][cli] Restore the 64M default client memory limit in pulsar-perf #26341
Closed
[fix][client] Apply no-memory-limit producer queue defaults at producer creation #26342
Merged
lhotari added a commit to lhotari/pulsar that referenced this pull request Aug 18, 2026
@lhotari
[fix][client] Apply the no-memory-limit producer queue defaults only …
9390c14
…where unset

### Motivation

When the client memory limit is disabled there is no byte-based backpressure left, so apache#15723 gave
producers the pre-PIP-120 pending-message defaults instead of letting them buffer without any
limit. Its commit message states the intent: "restore maxPendingMessages and
maxPendingMessagesAcrossPartitions when memory limit is disabled so that pre-PIP-120 default
configuration is restored when limit is disabled".

They are defaults, and PIP-120 is the same commit that changed them to 0 and documented 0 as
"disable the pending messages check". An application that configures a limit therefore has to keep
winning over them, including with an explicit 0.

The previous approach seeded the defaults onto the builder in `newProducer(Schema)`, which left
three holes:

1. The no-argument `newProducer()` never got them, so the WebSocket proxy's producer handler, the
   Functions log appender and the Functions worker are unbounded today.
2. A caller that later passed a limit through - a CLI flag or a config value sitting at its own
   default - silently replaced them.
3. Seeding `maxPendingMessages` to 1000 made a later `maxPendingMessagesAcrossPartitions(500)`
   throw, which a Functions `ProducerConfig` setting only that limit walks straight into.

### Modifications

`maxPendingMessages` is a primitive whose unset value is 0, and 0 is also a meaningful explicit
value, so the configuration alone cannot tell "never configured" from "explicitly unbounded".
`ProducerBuilderImpl` records which of the two limits the application configured - through the
setters or through `loadConf` - and carries that across `clone()`. At producer creation the client
fills in only the limits that were never configured, on a copy of the configuration so nothing
leaks into the next producer built from the same builder. A limit that is already positive counts
as configured however the configuration was populated.

Tracking this on the builder rather than on the configuration is not a preference: `loadConf` goes
through `ConfigurationDataUtils.loadData`, which rebuilds the configuration by replaying every
property through the setters, so a marker held there would be re-set on every call.

An explicit `maxPendingMessages(0)` also suppresses the across-partitions default, so one call is
enough to ask for a producer with no message-count limit whatever the topic's shape - filling in
the budget would put a per-partition limit straight back.

The V5 client is deliberately left out. It reaches producer creation through
`createSegmentProducerAsync` and exposes no pending-message setting at all, so its client memory
limit is the only backpressure it has, and the only thing an application can turn off.

The WebSocket proxy takes `maxPendingMessages` from a query parameter and its client has no memory
limit by default, so a remote client could now ask for an unbounded pending queue inside the shared
proxy. A non-positive value is ignored there.

Assisted-by: Claude Code (Opus 5)
@lhotari lhotari mentioned this pull request Aug 18, 2026
[fix][cli][branch-4.2] Don't pass unset pulsar-perf pending-message options to the producer #26371
Merged
4 of 15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@merlimat merlimat merlimat approved these changes
@HQebupt HQebupt HQebupt approved these changes
@eolivelli eolivelli eolivelli approved these changes
@michaeljmarshall michaeljmarshall michaeljmarshall approved these changes
@codelipenghui codelipenghui Awaiting requested review from codelipenghui
@nicoloboschi nicoloboschi Awaiting requested review from nicoloboschi

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@lhotari lhotari

Labels

cherry-picked/branch-2.10 doc-not-needed Your PR changes do not impact docs release/2.10.1 type/bug The PR fixed a bug or issue reported a bug

Projects

None yet

Milestone

2.11.0

Development

Successfully merging this pull request may close these issues.

[Broker] Support configuration of the memory allocated to replication producer

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@lhotari @michaeljmarshall @merlimat @HQebupt @eolivelli
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.