Skip to content

Commit f7734c5

Browse files
authored
Merge pull request #396 from ustiugov/scaling_readme
Added guidelines for scaling firecracker VMs count
2 parents bbbbb74 + 775bcf3 commit f7734c5

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs/scaling.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Scaling the number of Firecracker microVMs per host
2+
3+
To scale the number of microVMs past one thousand, one needs to properly configure
4+
the system constraints and provision enough networking resources for the microVMs.
5+
6+
On Ubuntu 18.04 Linux, one needs to properly configure the number of processes, threads, memory,
7+
open files that may simultaneously exist in a system as well as create enough
8+
virtual bridges (one bridge can serve up to 1023 interfaces).
9+
10+
To configure the system, one needs to set up the following parameters.
11+
Note that the exact values depend on your setting.
12+
13+
In `/etc/security/limits.conf`, set `nofile`, `nproc` and `stack` to the
14+
appropriate values for both normal users and root:
15+
```
16+
* soft nofile 1000000
17+
* hard nofile 1000000
18+
root soft nofile 1000000
19+
root hard nofile 1000000
20+
* soft nproc 4000000
21+
* hard nproc 4000000
22+
root soft nproc 4000000
23+
root hard nproc 4000000
24+
* soft stack 65536
25+
* hard stack 65536
26+
root soft stack 65536
27+
root hard stack 65536
28+
```
29+
30+
Additionally, one needs to provision the ARP cache to avoid garbage collection.
31+
```
32+
sudo sysctl -w net.ipv4.neigh.default.gc_thresh1=1024
33+
sudo sysctl -w net.ipv4.neigh.default.gc_thresh2=2048
34+
sudo sysctl -w net.ipv4.neigh.default.gc_thresh3=4096
35+
sudo sysctl -w net.ipv4.ip_local_port_range="32769 65535"
36+
```
37+
38+
Also, configure the maximum number of processes and threads in the system.
39+
```
40+
sudo sysctl -w kernel.pid_max=4194303
41+
sudo sysctl -w kernel.threads-max=999999999
42+
```
43+
44+
Finally, configure the number of tasks.
45+
To configure system-wide, uncomment and set `DefaultTasksMax=infinity`in `/etc/systemd/system.conf`.
46+
One also needs to set `UsersTasksMax=4000000000` in `/etc/systemd/logind.conf`
47+
(note that `infinity` is not a valid value here).
48+
49+
To configure the bridges for CNI, take a look at `demo-network` target in [Makefile](https://github.com/firecracker-microvm/firecracker-containerd/blob/master/Makefile)
50+
and replicate the code to create enough bridges (1 bridge can have up to 1023 interfaces attached).

0 commit comments

Comments
 (0)