Slackbot
02/03/2024, 11:29 AMGirish Sharma
02/03/2024, 11:29 AMPenghui
02/04/2024, 1:43 AM# Max number of entries to read from bookkeeper. By default it is 100 entries.
dispatcherMaxReadBatchSize=100
# Max size in bytes of entries to read from bookkeeper. By default it is 5MB.
dispatcherMaxReadSizeBytes=5242880
You can try to decrease the read batch size to reduce the requests to the bookie side. This is a known part we need to improve. The bookie API doesn't support batch reading, so the broker will send 100 read requests for each subscription. So, at most, you will have 100 * 300 read requests to bookies for a topic. BTW, the improvement has already started on the bookkeeper side. After the batch read API is available, then we can integrate Pulsar to adapt the new batch read API.
• Option 2: disable the sticky read (broker.conf)
# Enable/disable having read operations for a ledger to be sticky to a single bookie.
# If this flag is enabled, the client will use one single bookie (by preference) to read
# all entries for a ledger.
# Please notice that enabling sticky reads also requires that the ensemble size equals write quorum size for the ledger's
# persistence policies.
bookkeeperEnableStickyReads=true
Sticky Read is a performance optimization for data reading by leveraging the bookie's read-ahead cache. But the downside is all the read requests on a ledger will go to the same bookie. For your case, disabling the bookkeeper sticky reads will help spread out the requests to multiple replicas.
• Option 3: Increase the bookie pending read (bookkeeper.conf)
# Number of threads that should handle read requests. if zero, the reads would
# be handled by netty threads directly.
numReadWorkerThreads=8
# If read workers threads are enabled, limit the number of pending requests, to
# avoid the executor queue to grow indefinitely
maxPendingReadRequestsPerThread=2500
By default, one bookie will have 2500 * 8 max pending reads. If your bookie has more memory available, you can try to increase the pending requests.Girish Sharma
02/04/2024, 5:19 AMPenghui
02/04/2024, 5:23 AMGirish Sharma
02/04/2024, 5:24 AMPenghui
02/04/2024, 5:27 AMGirish Sharma
02/04/2024, 5:28 AMGirish Sharma
02/04/2024, 5:29 AMPenghui
02/04/2024, 5:30 AMGirish Sharma
02/04/2024, 5:54 AMPenghui
02/04/2024, 7:07 AM