Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Cherry pick/limit the memory #5909

Closed
wants to merge 5 commits into from
Closed

Cherry pick/limit the memory #5909

wants to merge 5 commits into from

Conversation

liangyepianzhou
Copy link

Motivation

Run the CI test and wait for review.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

eolivelli and others added 2 commits September 25, 2023 21:44
…m storage/cache to the write to the consumer channel) (apache#18245)

* InflightReadsLimiter - limit the memory used by reads end-to-end (from storage/cache to the write to the consumer channel)

Motivation:

Broker can go out of memory due to many reads enqueued on the PersistentDispatcherMultipleConsumers dispatchMessagesThread (that is used in case of dispatcherDispatchMessagesInSubscriptionThread set to true, that is the default value)
The limit of the amount of memory retained due to reads MUST take into account also the entries coming from the Cache.

When dispatcherDispatchMessagesInSubscriptionThread is false (the behaviour of Pulsar 2.10) there is some kind of natural (but still unpredictable!!) back pressure mechanism because the thread that receives the entries from BK of the cache dispatches immediately and synchronously the entries to the consumer and releases them

Modifications:

- Add a new component (InflightReadsLimiter) that keeps track of the overall amount of memory retained due to inflight reads.
- Add a new configuration entry managedLedgerMaxReadsInFlightSizeInMB
- The feature is disabled by default
- Add new metrics to track the values

* Change error message

* checkstyle

* Fix license

* remove duplicate method after cherry-pick

* Rename onDeallocate

(cherry picked from commit 6fec66b)
(cherry picked from commit 47c98e5)
@yaalsn yaalsn closed this Sep 25, 2023
@yaalsn yaalsn reopened this Sep 25, 2023
@codelipenghui
Copy link

@liangyepianzhou could you please work with @yaalsn to enable the CI for PRs? Otherwise, it's hard to know if the new change breaks something or not.

@liangyepianzhou
Copy link
Author

@liangyepianzhou could you please work with @yaalsn to enable the CI for PRs? Otherwise, it's hard to know if the new change breaks something or not.

Yeah, of course.

@yaalsn yaalsn closed this Sep 26, 2023
@yaalsn yaalsn reopened this Sep 26, 2023
@liangyepianzhou
Copy link
Author

@liangyepianzhou liangyepianzhou closed this by deleting the head repository Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants