From 93c1474b9dc2a4c665ffd9c01cc457acdd9384b3 Mon Sep 17 00:00:00 2001 From: William Chong Date: Tue, 9 Sep 2025 07:52:05 +0000 Subject: [PATCH] Document backpressure options on read and subscription --- docs/api/reading-events.md | 15 ++++++++++++++- docs/api/subscriptions.md | 13 +++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs/api/reading-events.md b/docs/api/reading-events.md index c5ed67d3..c19c3054 100644 --- a/docs/api/reading-events.md +++ b/docs/api/reading-events.md @@ -385,4 +385,17 @@ publisher.subscribe(new Subscriber() { latch.await(); ``` -::: \ No newline at end of file +::: + +## Configuring Backpressure + +The client allows you to configure backpressure to control how many events are buffered on the client side before requesting more from the server. + +| Option | Description | Default Value | +|----------------|-----------------------------------------------------------------------------|---------------| +| batchSize | The maximum number of events the client will request from the server in a single batch. | 512 | +| thresholdRatio | The fraction of the `batchSize` at which the client will send a new request for more events. | 0.25 | + +By default, the client requests up to 512 events at a time. It will automatically +request more events when the number of buffered (unprocessed) events falls below +25% of the batch size. \ No newline at end of file diff --git a/docs/api/subscriptions.md b/docs/api/subscriptions.md index eca18b9d..f8b8ca0e 100644 --- a/docs/api/subscriptions.md +++ b/docs/api/subscriptions.md @@ -406,3 +406,16 @@ For example: - If `n` = 2, the notification is sent every 64 events. - If `n` = 3, it is sent every 96 events, and so on. ::: + +## Configuring Backpressure + +The client allows you to configure backpressure to control how many events are buffered on the client side before requesting more from the server. + +| Option | Description | Default Value | +|----------------|-----------------------------------------------------------------------------|---------------| +| batchSize | The maximum number of events the client will request from the server in a single batch. | 512 | +| thresholdRatio | The fraction of the `batchSize` at which the client will send a new request for more events. | 0.25 | + +By default, the client requests up to 512 events at a time. It will automatically +request more events when the number of buffered (unprocessed) events falls below +25% of the batch size. \ No newline at end of file