Skip to content

Commit 4d93d07

Browse files
committed
Explicit scale up field names and comments
1 parent 27f64b5 commit 4d93d07

File tree

8 files changed

+27
-26
lines changed

8 files changed

+27
-26
lines changed

quickwit/quickwit-common/src/shared_consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ pub const INGESTER_PRIMARY_SHARDS_PREFIX: &str = "ingester.primary_shards:";
6767
pub const SPLIT_FIELDS_FILE_NAME: &str = "split_fields";
6868

6969
/// More or less the indexing throughput of a core
70-
/// i.e PIPELINE_THROUGHPUT / PIPELINE_FULL_CAPACITY
70+
/// i.e. PIPELINE_THROUGHPUT / PIPELINE_FULL_CAPACITY
7171
pub const DEFAULT_SHARD_THROUGHPUT_LIMIT: ByteSize = ByteSize::mib(5);
72-
/// Large enough to absorb small bursts but should remain defensive against unbalanced shards
72+
/// Large enough to absorb small bursts but should remain defensive against unbalanced shards.
7373
pub const DEFAULT_SHARD_BURST_LIMIT: ByteSize = ByteSize::mib(50);
7474

7575
/// A compromise between "exponential" scale up and moderate shard count increase.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub struct ClusterConfig {
2424
pub default_index_root_uri: Uri,
2525
pub replication_factor: usize,
2626
pub shard_throughput_limit: ByteSize,
27-
pub shard_scaling_factor: f32,
27+
pub shard_scale_up_factor: f32,
2828
}
2929

3030
impl ClusterConfig {
@@ -36,7 +36,7 @@ impl ClusterConfig {
3636
default_index_root_uri: Uri::for_test("ram:///indexes"),
3737
replication_factor: 1,
3838
shard_throughput_limit: quickwit_common::shared_consts::DEFAULT_SHARD_THROUGHPUT_LIMIT,
39-
shard_scaling_factor: 1.01,
39+
shard_scale_up_factor: 1.01,
4040
}
4141
}
4242
}

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,10 @@ pub struct IngestApiConfig {
351351
pub content_length_limit: ByteSize,
352352
/// (hidden) Targeted throughput for each shard
353353
pub shard_throughput_limit: ByteSize,
354-
/// (hidden) Targeted throughput for each shard
354+
/// (hidden) Maximum accumulated throughput capacity for underutilized
355+
/// shards, allowing the throughput limit to be temporarily exceeded
355356
pub shard_burst_limit: ByteSize,
356-
/// (hidden) new_shard_count = ceil(old_shard_count * shard_scaling_factor)
357+
/// (hidden) new_shard_count = ceil(old_shard_count * shard_scale_up_factor)
357358
///
358359
/// Setting this too high will be cancelled out by the arbiter that prevents
359360
/// creating too many shards at once.
@@ -412,27 +413,27 @@ impl IngestApiConfig {
412413
self.max_queue_memory_usage
413414
);
414415
info!(
415-
"ingestion shard throughput limit: {:?}",
416+
"ingestion shard throughput limit: {}",
416417
self.shard_throughput_limit
417418
);
418419
ensure!(
419420
self.shard_throughput_limit >= ByteSize::mib(1)
420421
&& self.shard_throughput_limit <= ByteSize::mib(20),
421-
"shard_throughput_limit ({:?}) must be within 1mb and 20mb",
422+
"shard_throughput_limit ({}) must be within 1mb and 20mb",
422423
self.shard_throughput_limit
423424
);
424425
// The newline delimited format is persisted as something a bit larger
425426
// (lines prefixed with their length)
426427
let estimated_persist_size = ByteSize::b(3 * self.content_length_limit.as_u64() / 2);
427428
ensure!(
428429
self.shard_burst_limit >= estimated_persist_size,
429-
"shard_burst_limit ({:?}) must be at least 1.5*content_length_limit ({:?})",
430+
"shard_burst_limit ({}) must be at least 1.5*content_length_limit ({})",
430431
self.shard_burst_limit,
431432
estimated_persist_size,
432433
);
433434
ensure!(
434435
self.shard_scale_up_factor > 1.0,
435-
"shard_scale_up_factor ({:?}) must be greater than 1",
436+
"shard_scale_up_factor ({}) must be greater than 1",
436437
self.shard_scale_up_factor,
437438
);
438439
Ok(())

quickwit/quickwit-control-plane/src/control_plane.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl ControlPlane {
167167
ingester_pool.clone(),
168168
replication_factor,
169169
shard_throughput_limit_mib,
170-
cluster_config.shard_scaling_factor,
170+
cluster_config.shard_scale_up_factor,
171171
);
172172

173173
let readiness_tx = readiness_tx.clone();

quickwit/quickwit-control-plane/src/ingest/ingest_controller.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl IngestController {
285285
ingester_pool: IngesterPool,
286286
replication_factor: usize,
287287
max_shard_ingestion_throughput_mib_per_sec: f32,
288-
shard_scaling_factor: f32,
288+
shard_scale_up_factor: f32,
289289
) -> Self {
290290
IngestController {
291291
metastore,
@@ -295,7 +295,7 @@ impl IngestController {
295295
stats: IngestControllerStats::default(),
296296
scaling_arbiter: ScalingArbiter::with_max_shard_ingestion_throughput_mib_per_sec(
297297
max_shard_ingestion_throughput_mib_per_sec,
298-
shard_scaling_factor,
298+
shard_scale_up_factor,
299299
),
300300
}
301301
}
@@ -673,17 +673,17 @@ impl IngestController {
673673
shard_stats: ShardStats,
674674
model: &mut ControlPlaneModel,
675675
progress: &Progress,
676-
shards_to_create: usize,
676+
num_shards_to_open: usize,
677677
) -> MetastoreResult<()> {
678678
if !model
679-
.acquire_scaling_permits(&source_uid, ScalingMode::Up(shards_to_create))
679+
.acquire_scaling_permits(&source_uid, ScalingMode::Up(num_shards_to_open))
680680
.unwrap_or(false)
681681
{
682682
return Ok(());
683683
}
684-
let new_num_open_shards = shard_stats.num_open_shards + shards_to_create;
684+
let new_num_open_shards = shard_stats.num_open_shards + num_shards_to_open;
685685
let new_shards_per_source: HashMap<SourceUid, usize> =
686-
HashMap::from_iter([(source_uid.clone(), shards_to_create)]);
686+
HashMap::from_iter([(source_uid.clone(), num_shards_to_open)]);
687687
let successful_source_uids_res = self
688688
.try_open_shards(new_shards_per_source, model, &Default::default(), progress)
689689
.await;
@@ -695,7 +695,7 @@ impl IngestController {
695695
if successful_source_uids.is_empty() {
696696
// We did not manage to create the shard.
697697
// We can release our permit.
698-
model.release_scaling_permits(&source_uid, ScalingMode::Up(shards_to_create));
698+
model.release_scaling_permits(&source_uid, ScalingMode::Up(num_shards_to_open));
699699
warn!(
700700
index_uid=%source_uid.index_uid,
701701
source_id=%source_uid.source_id,
@@ -719,7 +719,7 @@ impl IngestController {
719719
source_id=%source_uid.source_id,
720720
"scaling up number of shards to {new_num_open_shards} failed: {metastore_error:?}"
721721
);
722-
model.release_scaling_permits(&source_uid, ScalingMode::Up(shards_to_create));
722+
model.release_scaling_permits(&source_uid, ScalingMode::Up(num_shards_to_open));
723723
Err(metastore_error)
724724
}
725725
}

quickwit/quickwit-control-plane/src/ingest/scaling_arbiter.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,22 @@ pub(crate) struct ScalingArbiter {
3030
// after scaling up, and double check that it is above the long term threshold.
3131
scale_up_shards_short_term_threshold_mib_per_sec: f32,
3232
scale_up_shards_long_term_threshold_mib_per_sec: f32,
33-
// The max increase factor of the number of shards in one scaling operation
34-
shard_scaling_factor: f32,
33+
// The max increase factor of the number of shards in one scale up operation
34+
shard_scale_up_factor: f32,
3535
}
3636

3737
impl ScalingArbiter {
3838
pub fn with_max_shard_ingestion_throughput_mib_per_sec(
3939
max_shard_throughput_mib_per_sec: f32,
40-
shard_scaling_factor: f32,
40+
shard_scale_up_factor: f32,
4141
) -> ScalingArbiter {
4242
ScalingArbiter {
4343
scale_up_shards_short_term_threshold_mib_per_sec: max_shard_throughput_mib_per_sec
4444
* 0.8f32,
4545
scale_up_shards_long_term_threshold_mib_per_sec: max_shard_throughput_mib_per_sec
4646
* 0.3f32,
4747
scale_down_shards_threshold_mib_per_sec: max_shard_throughput_mib_per_sec * 0.2f32,
48-
shard_scaling_factor,
48+
shard_scale_up_factor,
4949
}
5050
}
5151

@@ -65,7 +65,7 @@ impl ScalingArbiter {
6565

6666
// compute the next number of shards we should have according the scaling factor
6767
let target_number_shards =
68-
(shard_stats.num_open_shards as f32 * self.shard_scaling_factor).ceil() as usize;
68+
(shard_stats.num_open_shards as f32 * self.shard_scale_up_factor).ceil() as usize;
6969

7070
let new_number_shards = max_number_shards.min(target_number_shards);
7171

quickwit/quickwit-control-plane/src/model/shard_table.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use quickwit_proto::ingest::{Shard, ShardState};
2525
use quickwit_proto::types::{IndexUid, NodeId, ShardId, SourceId, SourceUid};
2626
use tracing::{error, info, warn};
2727

28-
/// Limits the number of shards that can be opened for scaling up a source to 5 per minute.
28+
/// Limits the number of scale up operations that can happen to a source to 5 per minute.
2929
const SCALING_UP_RATE_LIMITER_SETTINGS: RateLimiterSettings = RateLimiterSettings {
3030
burst_limit: 5,
3131
rate_limit: ConstantRate::new(5, Duration::from_secs(60)),

quickwit/quickwit-serve/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ async fn setup_control_plane(
10581058
default_index_root_uri,
10591059
replication_factor,
10601060
shard_throughput_limit: ingest_api_config.shard_throughput_limit,
1061-
shard_scaling_factor: ingest_api_config.shard_scale_up_factor,
1061+
shard_scale_up_factor: ingest_api_config.shard_scale_up_factor,
10621062
};
10631063
let (control_plane_mailbox, _control_plane_handle, mut readiness_rx) = ControlPlane::spawn(
10641064
universe,

0 commit comments

Comments
 (0)