{"id":18497819,"url":"https://github.com/containers/engine-stressor","last_synced_at":"2025-04-09T00:30:43.254Z","repository":{"id":245012588,"uuid":"816880546","full_name":"containers/engine-stressor","owner":"containers","description":"A engine container stressor project","archived":false,"fork":false,"pushed_at":"2025-01-17T10:21:28.000Z","size":143,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-23T19:44:41.893Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/containers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-18T15:16:57.000Z","updated_at":"2025-01-17T10:21:31.000Z","dependencies_parsed_at":"2024-07-06T20:29:34.436Z","dependency_job_id":"a76354a6-c9ac-4584-94aa-c41da37cc044","html_url":"https://github.com/containers/engine-stressor","commit_stats":null,"previous_names":["containers/engine-stressor"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containers%2Fengine-stressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containers%2Fengine-stressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containers%2Fengine-stressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/containers%2Fengine-stressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/containers","download_url":"https://codeload.github.com/containers/engine-stressor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247949688,"owners_count":21023368,"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-11-06T13:36:05.192Z","updated_at":"2025-04-09T00:30:42.780Z","avatar_url":"https://github.com/containers.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# engine-stressor\n\nA stressor tool for container engines.\n\nThis latest revision is based on Podman, cgroupv2, and systemd. It creates a cgroupv2 namespace with limited resources according to user input and starts 'N' containers to ensure Podman engine behaves correctly.\n\nAdditionally, it is possible to enable a stress feature that uses the stress-ng tool to stress each container in parallel and verify if the applications and services running in the container environment are stable and secure. This tool also ensures that containers do not exceed their resource limits, even in the presence of memory, CPU, or other system interferences.\n\nFurthermore, it is an excellent way to test container scalability and interference between containers using Podman, allowing you to trigger 100, 1k, 5k, or even 1 million containers.\n\nWhy this project?\n\nWhen working in the auto industry, it's important to prove for certifications that components in the entire solution are as resilient as possible and do not fail in the initial rounds in different angles of tests.\n\nWhy bash?\n\nWe just call existing programs, no need to add extra layer of python, golang or rust for calling program at this moment.\n\n# ASCII Diagram\n```\n+-------------------------------------------------------+\n|                      User Space                       |\n|                                                       |\n|  +-----------------------+                            |\n|  |    engine-stressor    |                            |\n|  |    (Bash Script)      |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |      systemd-run      |                            |\n|  |      (CLI Command)    |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |        systemd        |                            |\n|  |   (Service Manager)   |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +---------------------------------+                  |\n|  |         Slice                   |                  |\n|  |    (e.g., engine-stressor.slice)|                  |\n|  +-----------+---------------------+                  |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |       cgroupv2        |                            |\n|  |    (Control Groups)   |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |        podman         |                            |\n|  |   (Container Engine)  |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |     Optional:         |                            |\n|  |      stress-ng        |                            |\n|  | (Stress Testing Tool) |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n|  +-----------------------+                            |\n|  |        glibc          |                            |\n|  |  (C Library for       |                            |\n|  |   System Calls)       |                            |\n|  +-----------+-----------+                            |\n|              |                                        |\n|              v                                        |\n+--------------+----------------------------------------+\n|                      Kernel Space                     |\n|                                                       |\n|  +-----------------------+                            |\n|  |        Kernel         |                            |\n|  |    (Linux Kernel)     |                            |\n|  +-----------+-----------+                            |\n|              ^                                        |\n|              |                                        |\n|  +-----------------------+                            |\n|  |       cgroupv2        |                            |\n|  |    (Kernel Part)      |                            |\n|  +-----------------------+                            |\n|                                                       |\n+-------------------------------------------------------+\n```\n\n# How to install and run it?\n\n## git clone\nClone the repo and install via make\n\n```bash\n$ git clone https://github.com/containers/engine-stressor\n$ pushd engine-stressor\n    $ sudo make install\n    Installation complete.\n$ popd\n\n$ sudo engine-stressor\n```\n\n# Monitoring resources\n\nOption 1: Using watch + systemd-cgls (cgroup ls) on the host:\n```\nsudo watch -n 1 \\\n    \"systemd-cgls /sys/fs/cgroup/engine_stressor.slice\"\n```\n\nOption 2:\nUse systemd-cgtop to monitor resource usage of slices and services (on the host):\n\n```\nsudo systemd-cgtop\n```\n\n# Running\n\nLet's start with an example below:  \n\n*\"Create a Podman network named my_network, a volume named my_volume, and 200 containers using the automotive-osbuild image with the image command sleep 3600.\"*\n\n```\nsudo CLEANUP=true \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"quay.io/centos-sig-automotive/automotive-osbuild\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"200\" \\\n     ./engine-stressor\n```\n\n# Stressing mode\n\nHow to run in the stress mode?\n\nAdd the **STRESS_** env variables as showed below.\n\n```\nsudo CLEANUP=false \\\n     VERBOSE=true \\\n     LIST_CURRENT_STATE=true \\\n     STRESS_CPU=\"6\" \\\n     STRESS_DISK=\"8\" \\\n     STRESS_DISK_SIZE=\"1G\" \\\n     STRESS_MEMORY=\"1G\" \\\n     STRESS_VM_STRESSOR_INSTANCES=100 \\\n     STRESS_TIME=\"60s\" \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"quay.io/centos-sig-automotive/automotive-osbuild\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"100\" \\\n     ./engine-stressor\n```\n\nOutput:\n```\n\u003csnip\u003e\nPASS: All containers requested are running successfully.\nINFO: Running stress-ng in container test_container_100...\nstress-ng: info:  [48] setting to a 1 min, 0 secs run per stressor\nstress-ng: info:  [48] dispatching hogs: 100 vm, 6 cpu, 8 hdd\nstress-ng: info:  [52] setting to a 1 min, 0 secs run per stressor\nstress-ng: info:  [52] dispatching hogs: 100 vm, 6 cpu, 8 hdd\nstress-ng: info:  [45] setting to a 1 min, 0 secs run per stressor\nstress-ng: info:  [45] dispatching hogs: 100 vm, 6 cpu, 8 hdd\nstress-ng: info:  [48] skipped: 0\nstress-ng: info:  [48] passed: 114: vm (100) cpu (6) hdd (8)\nstress-ng: info:  [48] failed: 0\nstress-ng: info:  [48] metrics untrustworthy: 0\nstress-ng: info:  [48] successful run completed in 1 min, 22.14 secs\nstress-ng: info:  [52] skipped: 0\nstress-ng: info:  [52] passed: 114: vm (100) cpu (6) hdd (8)\nstress-ng: info:  [52] failed: 0\nstress-ng: info:  [52] metrics untrustworthy: 0\nstress-ng: info:  [52] successful run completed in 1 min, 22.27 secs\nstress-ng: info:  [45] skipped: 0\nstress-ng: info:  [45] passed: 114: vm (100) cpu (6) hdd (8)\nstress-ng: info:  [45] failed: 0\nstress-ng: info:  [45] metrics untrustworthy: 0\nstress-ng: info:  [45] successful run completed in 1 min, 22.49 secs\n\u003csnip\u003e\n```\n\n# Other examples\n\n*\"Create a Podman network named my_network, a volume named my_volume, and 100 containers using the alpine image with the image command sleep 3600. List current network, storage and verbose mode. Once created, remove everything, as this setup is just for testing the environment!\"*\n\n```\nsudo CLEANUP=true \\\n     VERBOSE=true \\\n     LIST_CURRENT_STATE=true \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"alpine\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"100\" \\\n     ./engine-stressor\n```\n\n**Still interested to continue reading about?**\n\nSee the output for a PASS test (no VERBOSE mode or LIST_CURRENT_STATE):\n```\nsudo CLEANUP=false \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"alpine\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"100\" \\\n     ./engine-stressor\n```\n\nOutput\n```\nPASS: volume my_volume created.\nPASS: network my_network created.\nPASS: All containers requested are running successfully.\nPASS: Total number of containers created in parallel: 100\nPASS: Time taken: 1 seconds.\n\nPASS: All tests passed.\n```\n\nChecking if really worked:\n```\n$ sudo podman ps\nCONTAINER ID  IMAGE                            COMMAND     CREATED        STATUS        PORTS       NAMES\ne7c04505c83d  docker.io/library/alpine:latest  sleep 3600  2 seconds ago  Up 2 seconds              test_container_1\nabb513b64cd5  docker.io/library/alpine:latest  sleep 3600  2 seconds ago  Up 2 seconds              test_container_2\n....\n```\n\nChecking volume and network created:\n```\n$ sudo podman volume ls | grep my_volume\nlocal       my_volume\n\n$ podman network ls | grep my_network\n1a33f12e7eee  my_network  bridge\n```\n\nOutput for a FAIL test:\n```\nsudo CLEANUP=false \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"alpine\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"100\" \\\n     ./engine-stressor\n\nError: volume with name my_volume already exists: volume already exists\nFAIL: unable to create volume my_volume.\n```\n\nLet's get an output from a more verbose mode (VERBOSE=true plus LIST_CURRENT_STATE=true):\n\n```\nsudo CLEANUP=true \\\n     VERBOSE=true \\\n     LIST_CURRENT_STATE=true \\\n     NETWORK_NAME=\"my_network\" \\\n     VOLUME_NAME=\"my_volume\" \\\n     IMAGE_NAME_CONTAINER=\"alpine\" \\\n     IMAGE_COMMAND=\"sleep 3600\" \\\n     NUMBER_OF_CONTAINERS=\"3\" \\\n     ./engine-stressor\n\nINFO: =======================================================\nINFO: VERBOSE MODE IS ON\nINFO: =======================================================\nINFO: NETWORK_NAME is my_network\nINFO: VOLUME_NAME is my_volume\nINFO: NUMBER_OF_CONTAINERS is 100\nINFO: IMAGE_NAME_CONTAINER is alpine\nINFO: IMAGE_COMMAND is sleep 3600\nINFO: LIST_CURRENT_STATE is set\n\nINFO: ===============================================\nINFO:              Listing current podman processes\nINFO: ===============================================\nINFO: CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES\nINFO: ===============================================\n\nINFO: ===============================================\nINFO:              Listing current podman volume\nINFO: ===============================================\nINFO: DRIVER      VOLUME NAME\nINFO: local       test\nINFO: local       super\nINFO: local       dogz\nINFO: local       medogz\nINFO: ===============================================\n\nINFO: ===============================================\nINFO:              Listing current podman network\nINFO: ===============================================\nINFO: NETWORK ID    NAME        DRIVER\nINFO: 41af11b0f3d5  netcow      bridge\nINFO: 2f259bab93aa  podman      bridge\nINFO: ===============================================\nINFO: creating volume my_volume\nPASS: volume my_volume created.\nINFO: creating network my_network\nPASS: network my_network created.\nINFO: creating container test_container_1\nINFO: creating container test_container_2\n...\nPASS: All containers requested are running successfully.\nPASS: Total number of containers created in parallel: 100\nPASS: Time taken: 1 seconds.\n\nINFO: ===============================================\nINFO:              Listing current podman processes\nINFO: ===============================================\nINFO: CONTAINER ID  IMAGE                            COMMAND     CREATED                 STATUS                 PORTS       NAMES\nINFO: 1012e9a1e865  docker.io/library/alpine:latest  sleep 3600  Less than a second ago  Up Less than a second              test_container_2\nINFO: 1ee043d0a2ed  docker.io/library/alpine:latest  sleep 3600  Less than a second ago  Up Less than a second              test_container_1\n....\nINFO: ===============================================\n\nINFO: ===============================================\nINFO:              Listing current podman volume\nINFO: ===============================================\nINFO: DRIVER      VOLUME NAME\nINFO: local       my_volume\nINFO: local       test\nINFO: local       super\nINFO: local       dogz\nINFO: local       medogz\nINFO: ===============================================\n\nINFO: ===============================================\nINFO:              Listing current podman network\nINFO: ===============================================\nINFO: NETWORK ID    NAME        DRIVER\nINFO: 2a2543c7b7d9  my_network  bridge\nINFO: 41af11b0f3d5  netcow      bridge\nINFO: 2f259bab93aa  podman      bridge\nINFO: ===============================================\n\nPASS: All tests passed.\n```\n\n# Building rpm\n\nUse rpmbuild tool to create an rpm package.\n\n```bash\n$ git clone https://github.com/containers/engine-stressor\n$ mv engine-stressor engine-stressor-0.1.0\n$ tar cvz -f v0.1.0.tar.gz engine-stressor-0.1.0\n$ cp v0.1.0.tar.gz ~/rpmbuild/SOURCES/\n$ cd engine-stressor\n$ rpmbuild -ba engine-stressor.spec\n```\n\n# Additional help\n## How to enable cgroup v2?\n```\nsudo grubby --update-kernel=ALL --args=\"systemd.unified_cgroup_hierarchy=1\"\n```\n\nReboot the system for the changes to take effect.\n\n## Configuring sudo without asking password\nTo configure sudo to not ask for a password, you need to modify the /etc/sudoers file.\nThis can be done using the visudo command, which safely edits the sudoers file.\n\n```bash\nsudo visudo\n```\n\nAdd the following line to the file:\n```bash\nusername_to_run_script_here ALL=(ALL) NOPASSWD: ALL\n```\n\n# Behind the scenes\n\nAs engine-stressor is based on cgroupv2 and systemd lets share some\ncommon knowledge.\n\nIn systemd and cgroup v2 terminology, a \"slice\" is a unit of resource\nmanagement that groups together related services or scopes. When you\ncreate a slice using systemd, it also creates the corresponding cgroup\nhierarchy under the cgroup v2 filesystem.\n\nList Processes in the Podman Stressor Slice\n```\nsystemd-cgls /sys/fs/cgroup/engine_stressor.slice\nDirectory /sys/fs/cgroup/engine_stressor.slice:\n├─run-r809b4252c4834592933b123056e6254d.scope …\n│ └─1944002 /usr/bin/conmon --api-version 1 -c be7879833ce654481fe90c1abd3ccd1b3b2ed93f6974494cf43cff92a0\u003e\n├─run-r6851c76c5ca74580ba2353b7f6b7df0d.scope …\n│ └─1944165 /usr/bin/conmon --api-version 1 -c 514c304c5c66481a4a05ab0c8366635dc98400a9d8cfa5c58ace33e5dc\u003e\n└─run-r25ae5d9b81fd43a79fbc203bbea2ad59.scope …\n  └─1944087 /usr/bin/conmon --api-version 1 -c 76b2df670d9536ff7d145c98607627f941e1dd59a910d5516350ef2e70\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainers%2Fengine-stressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontainers%2Fengine-stressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontainers%2Fengine-stressor/lists"}