All Projects → vrmiguel → bustd

vrmiguel / bustd

Licence: MIT license
Process killer daemon for out-of-memory scenarios

Programming Languages

rust
11053 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to bustd

git-push-hackathon
$ git push hackathon 💻
Stars: ✭ 71 (-60.99%)
Mutual labels:  hackathon
HackathonStarter
Hackathon starter kit for iOS
Stars: ✭ 41 (-77.47%)
Mutual labels:  hackathon
MicrosoftCloudWorkshop-Asia
Microsoft Cloud Workshop Asia for Intelligent Cloud / Intelligent Edge
Stars: ✭ 20 (-89.01%)
Mutual labels:  hackathon
hackiiitv18-submissions
This repository contains all submissions of HackIIITV 2018
Stars: ✭ 18 (-90.11%)
Mutual labels:  hackathon
mpv-trakt-sync-daemon
Python daemon that scrobbles watch progress from https://mpv.io to https://trakt.tv
Stars: ✭ 41 (-77.47%)
Mutual labels:  daemon
vps host server
VPS Hosting Server Daemon for provisioning, monitoring, and communications with the central system.
Stars: ✭ 12 (-93.41%)
Mutual labels:  daemon
hacktrack
HackaTrack 🛤: Say goodbye 👋🏾 to stress and unproductivity in hackathons 👩🏾‍💻!
Stars: ✭ 61 (-66.48%)
Mutual labels:  hackathon
materializecss starter
A Starter Boilerplate for Materializecss, ionicons, font-awesome and Animatecss
Stars: ✭ 58 (-68.13%)
Mutual labels:  hackathon
rescrobbled
MPRIS music scrobbler daemon
Stars: ✭ 152 (-16.48%)
Mutual labels:  daemon
GChan
Scrape boards and threads from 4chan (8kun WIP). Downloads images, videos and HTML if desired.
Stars: ✭ 31 (-82.97%)
Mutual labels:  daemon
final-pm
Finally a good node.js process manager.
Stars: ✭ 21 (-88.46%)
Mutual labels:  daemon
DevSoc21
Official website for DEVSOC 21, our annual flagship hackathon.
Stars: ✭ 15 (-91.76%)
Mutual labels:  hackathon
Voice4Rural
A complete one stop solution for all the problems of Rural area people. 👩🏻‍🌾
Stars: ✭ 12 (-93.41%)
Mutual labels:  hackathon
oneshot-audio
Experiment with "one-shot learning" techniques to recognize a voice signature
Stars: ✭ 22 (-87.91%)
Mutual labels:  hackathon
funcd
Daemon for functional keys (works without X11)
Stars: ✭ 14 (-92.31%)
Mutual labels:  daemon
v-switch
Virtual Encrypted Switch across the network, using UDP + AES + TAP
Stars: ✭ 27 (-85.16%)
Mutual labels:  daemon
applytics
Perform Sentiment Analysis on reviews of your apps
Stars: ✭ 21 (-88.46%)
Mutual labels:  hackathon
Swatch
Watcher for Unit Tests written in Swift
Stars: ✭ 55 (-69.78%)
Mutual labels:  daemon
npshell
Command line music queue manager. A music player from the comfort of your own shell.
Stars: ✭ 15 (-91.76%)
Mutual labels:  daemon
Robot-Lawyer
A friendly chatbot to help generate legal documents. Won CourtHack2016.
Stars: ✭ 36 (-80.22%)
Mutual labels:  hackathon

bustd: Available memory or bust!

bustd is a lightweight process killer daemon for out-of-memory scenarios for Linux!

Features

Small memory usage!

bustd seems to use less memory than some other lean daemons such as earlyoom:

$ ps -F -C bustd
UID          PID    PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
vrmiguel  353609  187407  5   151     8   2 01:20 pts/2    00:00:00 target/x86_64-unknown-linux-musl/release/bustd -V -n

$ ps -F -C earlyoom
UID          PID    PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
vrmiguel  350497    9498  0   597   688   6 01:12 pts/1    00:00:00 ./earlyoom/

¹: RSS stands for resident set size and represents the portion of RAM occupied by a process.

²: Compared when bustd was in this commit and earlyoom in this one. bustd compiled with musl libc and earlyoom with glibc through GCC 11.1. Different configurations would likely change these figures.

Small CPU usage

Much 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.

This 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.

The sysinfo syscall is one order of magnitude faster, at least according to this kernel patch (granted, from 2015).

As bustd can't solely rely on the free RAM readings of sysinfo, we check for memory stress through Pressure Stall Information.

bustd will try to lock all pages mapped into its address space

Much like earlyoom, bustd uses mlockall 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.

Checks for Pressure Stall Information

The Linux kernel, since version 4.20 (and built with CONFIG_PSI=y), presents canonical new pressure metrics for memory, CPU, and IO. In the words of Facebook Incubator:

PSI stats are like barometers that provide fair warning of impending resource 
shortages, enabling you to take more proactive, granular, and nuanced steps 
when resources start becoming scarce.

More 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.

Packaging

Arch Linux

Available on the Arch User Repository

aur/bustd-git r81.caab293-3 (+1 0.93) 
    Process killer daemon for out-of-memory scenarios
aur/bustd-pacman-hooks 0.1.0-1 (+2 1.13) 
    Series of Pacman Hooks to Ensure 'bustd' is Always Running an Up-to-Date Binary
aur/bustd 0.1.0-1 (+2 1.13) (Desatualizado: 2022-02-25) 
    Process Killer Daemon for Out-of-Memory Scenarios, written in Rust

Gentoo

Available on the GURU project

Pop!_OS

Available on the Pop!_OS PPA (outdated)

Building

Requirements:

git clone https://github.com/vrmiguel/bustd
cd bustd && cargo run --release

The -n, --no-daemon flag is useful for running bustd through an init system such as systemd.

Prebuilt binaries

Binaries are generated at every commit through GitHub Actions

TODO

  • Allow for customization of the critical scenario (PSI cutoff)
  • Command-line argument for disabling daemonization (useful for runnning bustd as a systemd service)
  • Command-line argument to enable killing the entire process group, not just the chosen process itself
  • Allow the user to setup a list of software that bustd should never kill
  • Notification sending and general notification customization settings
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].