{"id":13587039,"url":"https://github.com/vrmiguel/bustd","last_synced_at":"2025-04-05T11:11:27.061Z","repository":{"id":45302072,"uuid":"383324648","full_name":"vrmiguel/bustd","owner":"vrmiguel","description":"Process killer daemon for out-of-memory scenarios","archived":false,"fork":false,"pushed_at":"2023-10-30T22:22:44.000Z","size":119,"stargazers_count":223,"open_issues_count":5,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T10:09:10.127Z","etag":null,"topics":["daemon","hackathon","linux","oomkiller","out-of-memory","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vrmiguel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-07-06T03:11:32.000Z","updated_at":"2025-02-20T13:13:03.000Z","dependencies_parsed_at":"2022-07-14T16:01:10.578Z","dependency_job_id":"1bf7c613-f120-48e3-86c9-0b5f942a0c10","html_url":"https://github.com/vrmiguel/bustd","commit_stats":{"total_commits":84,"total_committers":5,"mean_commits":16.8,"dds":"0.19047619047619047","last_synced_commit":"2b4dd825d085d32aa32f0fbabbae4b62f048e01c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrmiguel%2Fbustd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrmiguel%2Fbustd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrmiguel%2Fbustd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vrmiguel%2Fbustd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vrmiguel","download_url":"https://codeload.github.com/vrmiguel/bustd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247325693,"owners_count":20920714,"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":["daemon","hackathon","linux","oomkiller","out-of-memory","rust"],"created_at":"2024-08-01T15:05:58.974Z","updated_at":"2025-04-05T11:11:27.034Z","avatar_url":"https://github.com/vrmiguel.png","language":"Rust","readme":"# `bustd`: Available memory or bust!\n\n`bustd` is a lightweight process killer daemon for out-of-memory scenarios for Linux!\n\n## Features\n\n### Small memory usage!\n\n`bustd` seems to use less memory than some other lean daemons such as `earlyoom`:\n\n```console\n$ ps -F -C bustd\nUID          PID    PPID  C    SZ   RSS PSR STIME TTY          TIME CMD\nvrmiguel  353609  187407  5   151     8   2 01:20 pts/2    00:00:00 target/x86_64-unknown-linux-musl/release/bustd -V -n\n\n$ ps -F -C earlyoom\nUID          PID    PPID  C    SZ   RSS PSR STIME TTY          TIME CMD\nvrmiguel  350497    9498  0   597   688   6 01:12 pts/1    00:00:00 ./earlyoom/\n```\n\n¹: RSS stands for resident set size and represents the portion of RAM occupied by a process.\n\n²: Compared when bustd was in [this commit](https://github.com/vrmiguel/bustd/commit/61beb097b3631afb231a76bb9187b802c9818793) and earlyoom in [this one](https://github.com/rfjakob/earlyoom/commit/509df072be79b3be2a1de6581499e360ab0180be).\n`bustd` compiled with musl libc and earlyoom with glibc through GCC 11.1. Different configurations would likely change these figures.\n\n\n### Small CPU usage\n\nMuch like `earlyoom` and `nohang`, `bustd` uses adaptive sleep times during its memory polling. Unlike these two, however, `bustd` does not read from `/proc/meminfo`, instead opting for the `sysinfo` syscall.\n\nThis approach has its up- and downsides. The amount of free RAM that `sysinfo` reads does not account for cached memory, while `MemAvailable` in `/proc/meminfo` does.\n\nThe `sysinfo` syscall is one order of magnitude faster, at least according to [this kernel patch](https://sourceware.org/legacy-ml/libc-alpha/2015-08/msg00512.html) (granted, from 2015).\n\nAs `bustd` can't solely rely on the free RAM readings of `sysinfo`, we check for memory stress through [Pressure Stall Information](https://www.kernel.org/doc/html/v5.8/accounting/psi.html).\n\n### `bustd` will try to lock all pages mapped into its address space\n\nMuch like `earlyoom`, `bustd` uses [`mlockall`](https://www.ibm.com/docs/en/aix/7.2?topic=m-mlockall-munlockall-subroutine) to avoid being sent to swap, which allows the daemon to remain responsive even when the system memory is under heavy load and susceptible to [thrashing](https://en.wikipedia.org/wiki/Thrashing_(computer_science)).\n\n### Checks for Pressure Stall Information\n\nThe Linux kernel, since version 4.20 (and built with `CONFIG_PSI=y`), presents canonical new pressure metrics for memory, CPU, and IO.\nIn the words of [Facebook Incubator](https://facebookmicrosites.github.io/psi/docs/overview):\n\n```\nPSI stats are like barometers that provide fair warning of impending resource \nshortages, enabling you to take more proactive, granular, and nuanced steps \nwhen resources start becoming scarce.\n```\n\nMore specifically, `bustd` checks for how long, in microseconds, processes have stalled in the last 10 seconds. By default, `bustd` will kill a process when processes have stalled for 25 microseconds in the last ten seconds.\n\n## Packaging\n\n### Arch Linux\n\nAvailable on the Arch User Repository\n\n### Gentoo\n\nAvailable on the [GURU project](https://gitweb.gentoo.org/repo/proj/guru.git)\n\n###  Pop!_OS\n\nAvailable on the [Pop!_OS PPA](https://launchpad.net/~system76/+archive/ubuntu/pop) (outdated)\n\n\n## Building\n\nRequirements:\n* [Rust toolchain](https://rustup.rs/)\n* Any C compiler\n* Linux 4.20+ built with `CONFIG_PSI=y`\n\n```shell\ngit clone https://github.com/vrmiguel/bustd\ncd bustd \u0026\u0026 cargo run --release\n```\n\nThe `-n, --no-daemon` flag is useful for running `bustd` through an init system such as `systemd`.\n\n## Prebuilt binaries\n\nBinaries are generated at every commit through [GitHub Actions](https://github.com/vrmiguel/bustd/actions)\n\n## TODO\n\n- [x] Allow for customization of the critical scenario (PSI cutoff)\n- [x] Command-line argument for disabling daemonization (useful for runnning `bustd` as a systemd service)\n- [x] Command-line argument to enable killing the entire process group, not just the chosen process itself\n- [x] Allow the user to setup a list of software that `bustd` should never kill\n- [ ] Notification sending and general notification customization settings\n","funding_links":[],"categories":["Rust","Applications","应用程序 Applications"],"sub_categories":["System tools","系统工具 System tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrmiguel%2Fbustd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvrmiguel%2Fbustd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvrmiguel%2Fbustd/lists"}