Skip to content

Commit 19a8c91

Browse files
committed
Increase burst limit
1 parent 98098bb commit 19a8c91

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

quickwit/quickwit-common/src/shared_consts.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ pub const INGESTER_PRIMARY_SHARDS_PREFIX: &str = "ingester.primary_shards:";
6666
/// File name for the encoded list of fields in the split
6767
pub const SPLIT_FIELDS_FILE_NAME: &str = "split_fields";
6868

69+
/// More or less the indexing throughput of a core
70+
/// i.e PIPELINE_THROUGHPUT / PIPELINE_FULL_CAPACITY
6971
pub const DEFAULT_SHARD_THROUGHPUT_LIMIT: ByteSize = ByteSize::mib(5);
72+
///
73+
pub const DEFAULT_SHARD_BURST_LIMIT: ByteSize = ByteSize::mib(50);
7074

7175
// (Just a reexport).
7276
pub use bytesize::MIB;

quickwit/quickwit-config/src/node_config/mod.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use anyhow::{bail, ensure};
2525
use bytesize::ByteSize;
2626
use http::HeaderMap;
2727
use quickwit_common::net::HostAddr;
28-
use quickwit_common::shared_consts::DEFAULT_SHARD_THROUGHPUT_LIMIT;
28+
use quickwit_common::shared_consts::{DEFAULT_SHARD_BURST_LIMIT, DEFAULT_SHARD_THROUGHPUT_LIMIT};
2929
use quickwit_common::uri::Uri;
3030
use quickwit_proto::indexing::CpuCapacity;
3131
use quickwit_proto::types::NodeId;
@@ -341,11 +341,16 @@ impl SearcherConfig {
341341
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
342342
#[serde(deny_unknown_fields, default)]
343343
pub struct IngestApiConfig {
344+
/// Maximum memory space taken by the ingest WAL
344345
pub max_queue_memory_usage: ByteSize,
346+
/// Maximum disk space taken by the ingest WAL
345347
pub max_queue_disk_usage: ByteSize,
346348
replication_factor: usize,
347349
pub content_length_limit: ByteSize,
350+
/// [hidden] Targeted throughput for each shard
348351
pub shard_throughput_limit: ByteSize,
352+
/// [hidden] Targeted throughput for each shard
353+
pub shard_burst_limit: ByteSize,
349354
}
350355

351356
impl Default for IngestApiConfig {
@@ -356,6 +361,7 @@ impl Default for IngestApiConfig {
356361
replication_factor: 1,
357362
content_length_limit: ByteSize::mib(10),
358363
shard_throughput_limit: DEFAULT_SHARD_THROUGHPUT_LIMIT,
364+
shard_burst_limit: DEFAULT_SHARD_BURST_LIMIT,
359365
}
360366
}
361367
}
@@ -407,6 +413,15 @@ impl IngestApiConfig {
407413
"shard_throughput_limit ({:?}) must be within 1mb and 20mb",
408414
self.shard_throughput_limit
409415
);
416+
// The newline delimited format is persisted as something a bit larger
417+
// (lines prefixed with their length)
418+
let estimated_persist_size = ByteSize::b(3 * self.content_length_limit.as_u64() / 2);
419+
ensure!(
420+
self.shard_burst_limit >= estimated_persist_size,
421+
"shard_burst_limit ({:?}) must be at least 1.5*content_length_limit ({:?})",
422+
self.shard_burst_limit,
423+
estimated_persist_size,
424+
);
410425
Ok(())
411426
}
412427
}

quickwit/quickwit-serve/src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,6 @@ async fn setup_ingest_v2(
853853
) -> anyhow::Result<(IngestRouter, IngestRouterServiceClient, Option<Ingester>)> {
854854
// Instantiate ingest router.
855855
let self_node_id: NodeId = cluster.self_node_id().into();
856-
let content_length_limit = node_config.ingest_api_config.content_length_limit;
857856
let replication_factor = node_config
858857
.ingest_api_config
859858
.replication_factor()
@@ -875,15 +874,10 @@ async fn setup_ingest_v2(
875874
.stack_layer(INGEST_GRPC_SERVER_METRICS_LAYER.clone())
876875
.build(ingest_router.clone());
877876

878-
// We compute the burst limit as something a bit larger than the content length limit, because
879-
// we actually rewrite the `\n-delimited format into a tiny bit larger buffer, where the
880-
// line length is prefixed.
881-
let burst_limit = (content_length_limit.as_u64() * 3 / 2).clamp(10_000_000, 200_000_000);
882-
883877
let rate_limit =
884878
ConstantRate::bytes_per_sec(node_config.ingest_api_config.shard_throughput_limit);
885879
let rate_limiter_settings = RateLimiterSettings {
886-
burst_limit,
880+
burst_limit: node_config.ingest_api_config.shard_burst_limit.as_u64(),
887881
rate_limit,
888882
// Refill every 100ms.
889883
refill_period: Duration::from_millis(100),

0 commit comments

Comments
 (0)