Skip to content

Commit

Permalink
Computes the rate limiting burst value as a function of the ingest (#…
Browse files Browse the repository at this point in the history
…4172)

payload.

Closes #4171
  • Loading branch information
fulmicoton authored Nov 21, 2023
1 parent 131f64b commit 3f18626
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions quickwit/quickwit-serve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,18 +568,28 @@ async fn setup_ingest_v2(
);
let ingest_router_service = IngestRouterServiceClient::new(ingest_router);

// We compute the burst limit as something a bit larger than the content length limit, because
// we actually rewrite the `\n-delimited format into a tiny bit larger buffer, where the
// line length is prefixed.
let burst_limit = ByteSize::b(
(config.ingest_api_config.content_length_limit.as_u64() * 3 / 2)
.clamp(10_000_000, 200_000_000),
);
let rate_limiter_settings = RateLimiterSettings {
burst_limit,
..Default::default()
};
// Instantiate ingester.
let ingester_service_opt = if config.is_service_enabled(QuickwitService::Indexer) {
let wal_dir_path = config.data_dir_path.join("wal");
fs::create_dir_all(&wal_dir_path)?;

let ingester = Ingester::try_new(
self_node_id.clone(),
ingester_pool.clone(),
&wal_dir_path,
config.ingest_api_config.max_queue_disk_usage,
config.ingest_api_config.max_queue_memory_usage,
RateLimiterSettings::default(),
rate_limiter_settings,
replication_factor,
)
.await?;
Expand Down

0 comments on commit 3f18626

Please sign in to comment.