Forums

CPU allowance suddenly increased

I am running a scheduled task since few weeks, the task is always the same and previously it was using around 60% of my CPU allowance. Lately, it is using more than 100% even though nothing in the code has changed. What could be the problem?

That's hard to say. If you are scraping something, are you processing more data from the source? Or do you have loops that may be looping for longer?

I am scraping yes, but nothing has changed so far in my script so I do not understand why it is taking so much more CPU.

I'm saying, what if the site you are scrapping has double the content- then your parsing script would use up double the cpu time. Or if you have a loop that say continuously hits a site and waits for a trigger condition to run some processing code, maybe that trigger condition is happening more often. Or if you have a loop that waits until a certain condition is met to grab data, maybe the site is blocking you and you are looping till timeout vs normally you would get the data right away.

It doesn't seem to be the case. The website API aren't changed and the amount of data I get is always the same. Also, I am logging timeouts and it appears that there were none... Is it possible to retrieve the history of the used CPU per day? So that I can compare the amount of CPU allowance used in the past with that script and the one it's using now and try to figure out what's going on.

No unfortunately we don't store the historical cpu usage. One thing to try could be to log the actual system time at different steps of your script, and see what is taking a long time. Now of course that may not be the most accurate but it is probably the best way to go from here.

Ok, I will try to profile the CPU usage. However, it would be nice to have more details about the CPU usage by default.