There're obviously a zillion ways to do this.
Here's a simple one-liner I've found quite useful:
IFS=$'\n' sh -c 'for i in $(grep "^processor" /proc/cpuinfo); do dd if=/dev/urandom of=/dev/null bs=1024 & done'
It starts up instances of
dd
, each pulling pseudo-random data from
/dev/urandom
(actually the kernel providing this pseudo-random data creates the CPU load). The number of
dd
instances is taken from the number of processors reported by
/proc/cpuinfo
. To stop the extra load, you can easily kill all instances via
killall dd
(assuming there're no other
dd
instances running on the server that you've the right/permission to kill and that were not started by this one-liner). And this doesn't even require root access, any user will do. Of course on servers using advanced resource control (eg. cgroups) this won't work since the kernel will limit the total load one user can put on the system (regardless of how many processes you start up).
Recent comments
1 year 43 weeks ago
3 years 12 weeks ago
3 years 12 weeks ago
3 years 14 weeks ago
3 years 15 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 22 weeks ago
3 years 23 weeks ago