Skip to content

Commit e3f88a5

Browse files
committed
Increase burst limit
1 parent 647d02e commit e3f88a5

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;
@@ -323,11 +323,16 @@ impl SearcherConfig {
323323
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
324324
#[serde(deny_unknown_fields, default)]
325325
pub struct IngestApiConfig {
326+
/// Maximum memory space taken by the ingest WAL
326327
pub max_queue_memory_usage: ByteSize,
328+
/// Maximum disk space taken by the ingest WAL
327329
pub max_queue_disk_usage: ByteSize,
328330
replication_factor: usize,
329331
pub content_length_limit: ByteSize,
332+
/// [hidden] Targeted throughput for each shard
330333
pub shard_throughput_limit: ByteSize,
334+
/// [hidden] Targeted throughput for each shard
335+
pub shard_burst_limit: ByteSize,
331336
}
332337

333338
impl Default for IngestApiConfig {
@@ -338,6 +343,7 @@ impl Default for IngestApiConfig {
338343
replication_factor: 1,
339344
content_length_limit: ByteSize::mib(10),
340345
shard_throughput_limit: DEFAULT_SHARD_THROUGHPUT_LIMIT,
346+
shard_burst_limit: DEFAULT_SHARD_BURST_LIMIT,
341347
}
342348
}
343349
}
@@ -389,6 +395,15 @@ impl IngestApiConfig {
389395
"shard_throughput_limit ({:?}) must be within 1mb and 20mb",
390396
self.shard_throughput_limit
391397
);
398+
// The newline delimited format is persisted as something a bit larger
399+
// (lines prefixed with their length)
400+
let estimated_persist_size = ByteSize::b(3 * self.content_length_limit.as_u64() / 2);
401+
ensure!(
402+
self.shard_burst_limit >= estimated_persist_size,
403+
"shard_burst_limit ({:?}) must be at least 1.5*content_length_limit ({:?})",
404+
self.shard_burst_limit,
405+
estimated_persist_size,
406+
);
392407
Ok(())
393408
}
394409
}

quickwit/quickwit-serve/src/lib.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,6 @@ async fn setup_ingest_v2(
851851
) -> anyhow::Result<(IngestRouter, IngestRouterServiceClient, Option<Ingester>)> {
852852
// Instantiate ingest router.
853853
let self_node_id: NodeId = cluster.self_node_id().into();
854-
let content_length_limit = node_config.ingest_api_config.content_length_limit;
855854
let replication_factor = node_config
856855
.ingest_api_config
857856
.replication_factor()
@@ -873,15 +872,10 @@ async fn setup_ingest_v2(
873872
.stack_layer(INGEST_GRPC_SERVER_METRICS_LAYER.clone())
874873
.build(ingest_router.clone());
875874

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

0 commit comments

Comments
 (0)