I'm trying to build a service that blocks other requests if the server overloaded. But the load average of 1 minute is not good enough for this, the logic is something like this:
if load_average > core_count return render 503 end return the_requested_page
but when I try to stress the computer using
stress -c 12 -i 100 --timeout 10 command, the load_average showing something like this:
1, 3, 8, 15, 21, 20, 18, 15, 12, 11 ^ stress program ends here
how to get load average with smaller resolution (1-2 seconds, instead of 1 minute average)?
Extra information, I read the load average using this code