
Ask HN: Limiting CPU, memory, and I/O usage on a program for testing - zatkin
It’s great that we’re now in an era of computing where we have an immense and vast amount of computational power at the edge of our fingertips, but it’s also a burden because it leaves us vulnerable to writing software that consumes far more CPU, memory, and I&#x2F;O than necessary.<p>Does anyone know of software that allows you to test with certain (CPU, RAM, I&#x2F;O) thresholds in place? And also, what about monitoring tools to see how much CPU, memory, and I&#x2F;O a program consumes when run?
======
mschuster91
Well you can always launch your software inside a limited VM, I'm thinking of
cgroups for limiting CPU if a VM is unfeasible.

Limiting network bandwidth (or introducing random packet drops etc.) can be
done with pf.

Monitoring CPU/MEM load is best done with htop (if you're interested in long
term metrics, look for Nagios).

Short term IO (HDD!) load is best done via iotop. Oh, and iftop is your friend
for on-demand monitoring of network.

