Skip to content

Commit d073bc4

Browse files
feat(EXC-1993): Increase sandbox limit (#4491)
EXC-1993 Increase the maximum number of canister sandboxes. This allows us to keep more sandboxes hot which will improve latency and throughput.
1 parent 9daac23 commit d073bc4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

rs/canister_sandbox/src/replica_controller/sandboxed_execution_controller.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ const SANDBOX_PROCESSES_TO_EVICT: usize = 200;
7575
/// The RSS to evict in one go in order to amortize for the eviction cost (1 GiB).
7676
const SANDBOX_PROCESSES_RSS_TO_EVICT: NumBytes = NumBytes::new(1024 * 1024 * 1024);
7777

78-
/// By default, assume each sandbox process consumes 50 MiB of RSS.
78+
/// By default, assume each sandbox process consumes 5 MiB of RSS.
7979
/// The actual memory usage is updated asynchronously.
8080
/// See `monitor_and_evict_sandbox_processes`
81-
const DEFAULT_SANDBOX_PROCESS_RSS: NumBytes = NumBytes::new(50 * 1024 * 1024);
81+
const DEFAULT_SANDBOX_PROCESS_RSS: NumBytes = NumBytes::new(5 * 1024 * 1024);
8282

8383
/// To speedup synchronous operations, the sandbox RSS-based eviction
8484
/// is triggered only when the system's available memory falls below

rs/config/src/embedders.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ const DEFAULT_WASMTIME_RAYON_COMPILATION_THREADS: usize = 10;
4646
const DEFAULT_PAGE_ALLOCATOR_THREADS: usize = 8;
4747

4848
/// Sandbox process eviction ensures that the number of sandbox processes is
49-
/// always below this threshold.
50-
pub(crate) const DEFAULT_MAX_SANDBOX_COUNT: usize = 7_000;
49+
/// always below this threshold. Idle sandboxes should be using at most ~5MiB
50+
/// resident memory with the on-disk compilation cache, so 10,000 sandboxes
51+
/// shouldn't be more than 50 GiB.
52+
pub(crate) const DEFAULT_MAX_SANDBOX_COUNT: usize = 10_000;
5153

5254
/// A sandbox process may be evicted after it has been idle for this
5355
/// duration and sandbox process eviction is activated.

0 commit comments

Comments
 (0)