Forums

Threading - CPU Intensive

It would seem threading is really CPU intensive - any tips on how to minimise it? I've been through 25% of my 10,000 CPU seconds in the last 30 mins - that with plenty of sleep throughout :(

Happy to give code example as needed

A code example would help -- launching a new thread, or context-switching between them, shouldn't be too CPU-intensive, so there's presumably some other factor in play...

I think it may have been a leak... is there a way to see processes running? ps -A is not working

Getting the following, though I've cleared all processes from the "fetch processes section":

thread.error: can't start new thread

Are you running this from a console, or a scheduled task? I ask because they have separate process lists (on their respective tabs).

console

How many threads have you started when you get that message?

Only 3

This is definitely odd. Can we take a look at your code? We can see it from our admin interface, but we always ask permission first. If we can, then just let us know which file is showing the problem, and how you're running it (eg. "python3.6 path/to/myscript.py" or whatever).