Skip to content

Commit dee1d2b

Browse files
committed
Added guidelines for scaling firecracker VMs count
1 parent 37b2de2 commit dee1d2b

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 contraints and provision enough networking resources for the microVMs.
5+
6+
On Ubuntu 18.04 Linux, one needs to 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 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+
sudo sh -c "echo \"* soft nofile 1000000\" >> /etc/security/limits.conf"
17+
sudo sh -c "echo \"* hard nofile 1000000\" >> /etc/security/limits.conf"
18+
sudo sh -c "echo \"root soft nofile 1000000\" >> /etc/security/limits.conf"
19+
sudo sh -c "echo \"root hard nofile 1000000\" >> /etc/security/limits.conf"
20+
sudo sh -c "echo \"* soft nproc 4000000\" >> /etc/security/limits.conf"
21+
sudo sh -c "echo \"* hard nproc 4000000\" >> /etc/security/limits.conf"
22+
sudo sh -c "echo \"root soft nproc 4000000\" >> /etc/security/limits.conf"
23+
sudo sh -c "echo \"root hard nproc 4000000\" >> /etc/security/limits.conf"
24+
sudo sh -c "echo \"* soft stack 65536\" >> /etc/security/limits.conf"
25+
sudo sh -c "echo \"* hard stack 65536\" >> /etc/security/limits.conf"
26+
sudo sh -c "echo \"root soft stack 65536\" >> /etc/security/limits.conf"
27+
sudo sh -c "echo \"root hard stack 65536\" >> /etc/security/limits.conf"
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)