{"id":15048939,"url":"https://github.com/cirocosta/stress","last_synced_at":"2025-07-24T09:39:35.945Z","repository":{"id":50750599,"uuid":"95241491","full_name":"cirocosta/stress","owner":"cirocosta","description":"Single-purpose tools to stress resources","archived":false,"fork":false,"pushed_at":"2017-12-14T13:34:24.000Z","size":666,"stargazers_count":29,"open_issues_count":14,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T03:12:09.061Z","etag":null,"topics":["c","c-language","cpu","disk","docker","memory","stress"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cirocosta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-23T17:24:59.000Z","updated_at":"2023-08-16T22:39:15.000Z","dependencies_parsed_at":"2022-09-10T18:02:33.761Z","dependency_job_id":null,"html_url":"https://github.com/cirocosta/stress","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/cirocosta%2Fstress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fstress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fstress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cirocosta%2Fstress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cirocosta","download_url":"https://codeload.github.com/cirocosta/stress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248140922,"owners_count":21054369,"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":["c","c-language","cpu","disk","docker","memory","stress"],"created_at":"2024-09-24T21:17:15.654Z","updated_at":"2025-04-10T01:34:26.829Z","avatar_url":"https://github.com/cirocosta.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stress 🔥\n\n\u003e Collection of tools to stress a machine (cpu, mem, pid, disk).\n\n**TOC**\n\n- [cpu](#cpu)\n  - [Example](#example)\n- [mem](#mem)\n  - [Example](#example-1)\n- [pid](#pid)\n  - [Example](#example-2)\n- [disk](#disk)\n  - [Example](#example-3)\n- [files](#files)\n  - [Example](#example-4)\n- [context-switches](#context-switches)\n  - [Example](#example-5)\n\n- [LICENSE](#license)\n\n## cpu\n\nRuns load on `n` processes:\n\n### Example\n\n```\ndocker run cirocosta/stress cpu -n 3\n[2] - child started\n[1] - child started\n[0] - child started\n[1] Waiting for SIGINT\n\ndocker stats\n\nCONTAINER      CPU %     MEM USAGE / LIMIT   PIDS\nb391ce600bb4   300.83%   604KiB / 8.759GiB   4\n```\n\n## mem \n\nTries to allocate up to `n` MB of memory (with actual initialization of the memory).\n\nArguments:\n- `n` MB of memory to allocate\n\n### Example\n\n```\ndocker run cirocosta/stress mem -n 1024\n1024 MB will be allocated\nAllocated: 1024\nDone.[1] Waiting for SIGINT\n\n\ndocker stats --no-stream\nCONTAINER       CPU %    MEM USAGE / LIMIT     MEM %     PIDS\n40080ad19a1b    0.00%    1.002GiB / 8.759GiB   11.45%    1\n\n\ndocker exec 40080ad19a1b pmap -x 1\n1: mem -n 1024\nAddress\t\t  Kbytes     PSS   Dirty    Swap  Mode  Mapping\n000055c423976000      24      24       0       0  r-xp  /usr/local/bin/mem\n000055c423b7b000       8       8       8       0  rw-p  /usr/local/bin/mem\n000055c4251e2000 1048576 1048576 1048576       0  rw-p  [heap]\n00007fffaa5c8000     132       8       8       0  rw-p  [stack]\n00007fffaa5eb000       8       0       0       0  r--p  [vvar]\n00007fffaa5ed000       8       0       0       0  r-xp  [vdso]\nffffffffff600000       4       0       0       0  r-xp  [vsyscall]\n----------------  ------  ------  ------  ------\ntotal\t\t 1048760 1048616 1048592       0\n```\n\n\n## pid\n\nAllocates N processes and then suspends the execution.\n\nArguments:\n- `-n` number of PIDS\n\n### Example\n\n```\ndocker run cirocosta/stress pid -n 200 \nStarting to spawn 200 blocking children\n[1] Waiting for SIGINT\n\n\nCONTAINER      CPU %    PIDS\n38a9e2d1bae0   0.00%    200\n\n```\n\n\n## disk\n\nTries to write `n` MBs of data to a file (`disk-out.txt`).\n\nArguments:\n- `-n` number of MBs to write to the file\n- `-f` name of the file\n- `-b` block after writing (optional)\n\n\n### Example\n\n```\ndocker run --rm cirocosta/stress disk -n 1024 -f ./disk-out.txt\n-rw-r--r--    1 root     root        1.0G Jun 24 17:50 disk-out.txt\n```\n\n## files\n\nCreates `n` number of files under `./stress-files`.\n\nArguments:\n- `-n` number of files to create\n\n\n### Example\n\n```\ndocker run --rm cirocosta/stress files -n 100\nls ./stress-files\n\nfile1   file12  file16  file2   file23  file27  file30  file34  file38  file41  file45  file49  file52  file56  file6   file63  file67  file70  file74  file78  file81  file85  file89  file92  file96\nfile10  file13  file17  file20  file24  file28  file31  file35  file39  file42  file46  file5   file53  file57  file60  file64  file68  file71  file75  file79  file82  file86  file9   file93  file97\nfile100 file14  file18  file21  file25  file29  file32  file36  file4   file43  file47  file50  file54  file58  file61  file65  file69  file72  file76  file8   file83  file87  file90  file94  file98\nfile11  file15  file19  file22  file26  file3   file33  file37  file40  file44  file48  file51  file55  file59  file62  file66  file7   file73  file77  file80  file84  file88  file91  file95  file99\n```\n\n## context-switches\n\nCreates `50` threads which rotate between `n` CPUs executing, in a ring-buffer manner, cpu sticking and execution of dumb `while` loops.\n\nArguments:\n- none\n\n\n### Example\n\n```\ndocker run --rm cirocosta/stress context-switches\n```\n\n\nThis leads to:\n\n![image](https://user-images.githubusercontent.com/3574444/27996167-b6053f3c-64b2-11e7-9c07-6240f147c0eb.png)\n\n\n## write\n\nCreates 2 threads which are responsible for `write` \u0026 `lseek` forever in two files by writing `n` MBs to each file.\n\nArguments:\n- `n` - size of the files (MB)\n- `d` - base directory to write files to\n\n\n### Example\n\n\n```\ndocker run --rm cirocosta/stress write -n 1\n\n\n\nCONTAINER           CPU %         ...       BLOCK I/O           PIDS\nd809a7dee8c6        5.22%         ...       0B / 3.78GB         1\n```\n\n## tcp\n\nSeparated in two binaries (tcp-server and tcp-client) it simply starts a TCP echo server in one side and in the order contiguously sends and reads chunks of 4KB.\n\nArguments:\n- `-f` ip where the server lives (client only)\n- `-n` port (client and server)\n\n\n### Example\n\n```\ndocker run --rm --network host cirocosta/stress tcp-client -f 127.0.0.1 -n 1337\ndocker run --rm --network host cirocosta/stress tcp-server -n 1337\n\n\n# after some seconds:\nCONTAINER       ..    NET I/O             BLOCK I/O     PIDS\nfd1df18bd1e9    ..    3.25GB / 3.25GB     0B / 0B       2\n```\n\n\n## LICENSE\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirocosta%2Fstress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcirocosta%2Fstress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcirocosta%2Fstress/lists"}