eolivelli opened a new pull request, #17953:
URL: https://github.com/apache/pulsar/pull/17953

   Fixes #17952 17952
   
   Modifications:
   
   Result:
   This prevents the broker from going to OutOfMemory (direct memory) in case 
of many concurrent reads from the bookie
   
   <!--
   ### Contribution Checklist
     
     - PR title format should be *[type][component] summary*. For details, see 
*[Guideline - Pulsar PR Naming 
Convention](https://docs.google.com/document/d/1d8Pw6ZbWk-_pCKdOmdvx9rnhPiyuxwq60_TrD68d7BA/edit#heading=h.trs9rsex3xom)*.
 
   
     - Fill out the template below to describe the changes contributed by the 
pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from 
multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and 
this checklist, leaving only the filled out template below.
   -->
   
   ### Motivation
   
   see #17952 
   There is currently no limit on the amount of memory that is needed to 
transfer the read results from storage (BK or Tiered Storage).
   We need a way to protect the broker from allocating too much memory.
   
   ### Modifications
   
   - limit the global number of pending reads to BookKeeper
   - new configuration entry `managedLedgerMaxPendingReadsBufferSizeInMB` (0 = 
feature disabled)
   - we estimate the entry size per-topic, using the size of the last read 
entry (new metric pulsar_ml_pending_reads_estimated_entry_size, per topic)
   - new metric pulsar_ml_pending_reads_buffer_sizeto get the estimated size of 
in-flight read requests in bytes
   - if the feature is disabled this changed does not add significant overhead
   
   
   ### Verifying this change
   
   This change added tests.
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [ ] `doc` <!-- Your PR contains doc changes -->
   - [x] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: <!-- ENTER URL HERE -->
   
   <!--
   After opening this PR, the build in apache/pulsar will fail and instructions 
will
   be provided for opening a PR in the PR author's forked repository.
   
   apache/pulsar pull requests should be first tested in your own fork since 
the 
   apache/pulsar CI based on GitHub Actions has constrained resources and quota.
   GitHub Actions provides separate quota for pull requests that are executed 
in 
   a forked repository.
   
   The tests will be run in the forked repository until all PR review comments 
have
   been handled, the tests pass and the PR is approved by a reviewer.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to