Python - how to check system load?

multithreading, python

Solution

Try psutil (https://github.com/giampaolo/psutil):

import psutil
psutil.cpu_percent()

psutil implements and emulates getloadavg(), also on Windows:

 >>> psutil.getloadavg()
 (3.14, 3.89, 4.67)

Problem

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?

Original source

Related problems