{"id":14110452,"url":"https://github.com/firecracker-microvm/firecracker-demo","last_synced_at":"2025-04-07T06:13:00.358Z","repository":{"id":41832661,"uuid":"158255404","full_name":"firecracker-microvm/firecracker-demo","owner":"firecracker-microvm","description":"A demo running 4000 Firecracker microVMs.","archived":false,"fork":false,"pushed_at":"2022-10-18T14:20:32.000Z","size":48273,"stargazers_count":254,"open_issues_count":2,"forks_count":57,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-03-31T05:05:42.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://firecracker-microvm.io","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/firecracker-microvm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-19T16:19:20.000Z","updated_at":"2025-02-13T12:47:50.000Z","dependencies_parsed_at":"2023-01-20T01:04:33.920Z","dependency_job_id":null,"html_url":"https://github.com/firecracker-microvm/firecracker-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firecracker-microvm%2Ffirecracker-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firecracker-microvm%2Ffirecracker-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firecracker-microvm%2Ffirecracker-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/firecracker-microvm%2Ffirecracker-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/firecracker-microvm","download_url":"https://codeload.github.com/firecracker-microvm/firecracker-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601449,"owners_count":20964864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-14T10:02:51.393Z","updated_at":"2025-04-07T06:13:00.335Z","avatar_url":"https://github.com/firecracker-microvm.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Firecracker-demo\n\n## Disclaimer\n\nThis demo showcases Firecracker's agility and high-density capabiliies.\n**It's been run on an EC2 i3.metal host (the defaults start 4000 microVMs)\nwith an Ubuntu and an Amazon Linux 2 host OS, from an Ubuntu client.**\n\nDeviations from this setup will probably lead to issues and/or sub-par performance.\nIf you want to help us support the demo on more platforms...we take\npull requests :)\n\n## Step-by-Step Instructions\n\nGet this repo on an EC2 Intel metal instance.\nOpen two terminals/ssh-connections to the instance.\n\n### Terminal window 1\n\nwill show a heatmap of network traffic done by each microVM.\n\n```bash\npython3 microvm-tiles.py\n```\n\n### Terminal window 2\n\nwill control the rest of the demo.\n\nRaise the maximum processes limit.\n\n```bash\nsudo tee -a /etc/security/limits.conf \u003c\u003cEOL\n$USER soft nproc 16384\n$USER hard nproc 16384\nEOL\n```\n\nNote: In the above configuration, `$USER` expands\nto the ec2 instance logged-in user.\n\nReload the ssh session to have the new limit applied.\n\nInstall additional dependencies: `python3` and `iperf3`.\n\nFix permissions on `/dev/kvm`:\n\n```bash\nsudo chmod 777 /dev/kvm\n```\n\nCreate 4000 TAPs, configure networking for them and start 4k `iperf3` servers\neach bound to their respective TAP.\n\n```bash\nsudo ./0.initial-setup.sh 4000\n```\n\n#### Start 4000 Firecracker microVMs\n\nUse 6 parallel threads to configure and start **4000** microVMs. Each\nthread will get an equal slice of the 4k total and sequentially configure\nand issue the start command for each microVM.\n\nThe script will report **total duration** as well as **mutation rate**.\n\n```bash\n# start a total of 4k uVMs from 6 parallel threads\n./parallel-start-many.sh 0 4000 6\n# ... wait for it ... should take around 60 seconds ... watch the heatmap\n```\n\nEach microVM has a workload (iperf client) and will run it in a loop with\na random `sleep` between iterations.\n\nLooking at the heatmap you should see **six** 'snakes' advancing which\nare the microVMs that have just been powered up and are doing their first\niteration of the workload. Once that's done, the random sleep will lead\nto random lighting of the heatmap.\n\n#### Pick a microVM and play with it\n\nPick a number `0 \u003c= ID \u003c 4000`. For this example `42` was chosen.\n\n```bash\nID=\"42\"\n# get the IP for that microVM\nip addr show fc-$ID-tap0 | grep \"inet \"\n       inet 169.254.0.170  netmask 255.255.255.252  broadcast 0.0.0.0\n\n# IP of microVM on other side is *one less*\nssh -i resources/rootfs.id_rsa root@169.254.0.169\n```\n\nYou're now inside the microVM. Do as you please.\n\nLet's make it stand out in the heatmap.\n\n```bash\n# stop the workload service\nlocalhost:~# rc-service demo-workload stop\n * Stopping demo-workload ...                                    [ ok ]\n# manually run iperf with a higher bandwidth than the rest\nlocalhost:~# iperf3 -c $(./gateway-ip.sh) -b 104857600\n# check out the heatmap\n```\n\nThis microVM should now shine brighter in the heatmap.\n\nDemonstrate the network throughput of this microVM:\n\n```bash\nlocalhost:~# iperf3 -c $(./gateway-ip.sh)\nConnecting to host 169.254.0.170, port 5201\n[  5] local 169.254.0.169 port 53392 connected to 169.254.0.170 port 5201\n[ ID] Interval           Transfer     Bitrate         Retr  Cwnd\n[  5]   0.00-1.00   sec  1.72 GBytes  14.8 Gbits/sec    0    952 KBytes\n[  5]   1.00-2.00   sec  1.67 GBytes  14.4 Gbits/sec    0    952 KBytes\n[  5]   2.00-3.00   sec  1.76 GBytes  15.1 Gbits/sec    0    952 KBytes\n[  5]   3.00-4.00   sec  1.69 GBytes  14.5 Gbits/sec    0    952 KBytes\n[  5]   4.00-5.00   sec  1.69 GBytes  14.5 Gbits/sec    0    952 KBytes\n[  5]   5.00-6.00   sec  1.66 GBytes  14.3 Gbits/sec    0    952 KBytes\n[  5]   6.00-7.00   sec  1.67 GBytes  14.4 Gbits/sec    0    952 KBytes\n[  5]   7.00-8.00   sec  1.77 GBytes  15.2 Gbits/sec    0    952 KBytes\n[  5]   8.00-9.00   sec  1.76 GBytes  15.1 Gbits/sec    0    952 KBytes\n[  5]   9.00-10.00  sec  1.42 GBytes  12.2 Gbits/sec    0    952 KBytes\n- - - - - - - - - - - - - - - - - - - - - - - - -\n[ ID] Interval           Transfer     Bitrate         Retr\n[  5]   0.00-10.00  sec  16.8 GBytes  14.4 Gbits/sec    0             sender\n[  5]   0.00-10.00  sec  16.8 GBytes  14.4 Gbits/sec                  receiver\n\niperf Done.\n```\n\n#### Plot the 4000 Firecracker microVMs boot times\n\nTo plot the boot times, on your local machine or any non-headless setup:\n\n```bash\nscp -i \u003cidentity-key\u003e ec2-user@\u003ci3.metal-ip\u003e:firecracker-demo/{data.log,gnuplot.script} .\ngnuplot gnuplot.script\nxdg-open boot-time.png  # on Ubuntu. For other distros just use your default .png viewer.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirecracker-microvm%2Ffirecracker-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffirecracker-microvm%2Ffirecracker-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffirecracker-microvm%2Ffirecracker-demo/lists"}