Skip to content

Commit

Permalink
Rate limit ingestion per shard to 5 MB/s
Browse files Browse the repository at this point in the history
  • Loading branch information
guilload committed Nov 9, 2023
1 parent f99b3de commit c55261b
Show file tree
Hide file tree
Showing 7 changed files with 315 additions and 6 deletions.
5 changes: 5 additions & 0 deletions quickwit/quickwit-common/src/tower/rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ impl ConstantRate {
let work = bytes.as_u64();
Self::new(work, period)
}

pub fn bytes_per_sec(bytes: ByteSize) -> Self {
let work = bytes.as_u64();
Self::new(work, Duration::from_secs(1))
}
}

impl Rate for ConstantRate {
Expand Down
3 changes: 3 additions & 0 deletions quickwit/quickwit-ingest/src/ingest_v2/fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ mod tests {
let state = Arc::new(RwLock::new(IngesterState {
mrecordlog,
shards: HashMap::new(),
rate_limiters: HashMap::new(),
replication_streams: HashMap::new(),
replication_tasks: HashMap::new(),
}));
Expand Down Expand Up @@ -794,6 +795,7 @@ mod tests {
let state = Arc::new(RwLock::new(IngesterState {
mrecordlog,
shards: HashMap::new(),
rate_limiters: HashMap::new(),
replication_streams: HashMap::new(),
replication_tasks: HashMap::new(),
}));
Expand Down Expand Up @@ -860,6 +862,7 @@ mod tests {
let state = Arc::new(RwLock::new(IngesterState {
mrecordlog,
shards: HashMap::new(),
rate_limiters: HashMap::new(),
replication_streams: HashMap::new(),
replication_tasks: HashMap::new(),
}));
Expand Down
Loading

0 comments on commit c55261b

Please sign in to comment.