I am writing a script to check if the given urls are proper and resolve an IP. I'd like to fasten things up so I decided to put it into multiple threads. However, I want to make sure that the scripts does not overload the server it runs on. The question is: how can I check system load in the script? Or is there some way to determine how much threads can be run simultanously?
As suggested in this answer maybe using:
>>> import os
>>> os.getloadavg()
(0.66, 0.69, 0.58)
It's more what you're looking for since that's the server load, not just the cpu usage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With