Monday, April 23, 2012

CPU Quota Errors

So your site is growing, your scripts are being heavily utilized, and then suddenly your webhost sends you an email, warning you about the CPU quota errors and that if you do not sort them out, your hosting account can be stopped or cancelled.



Basically, CPU Quota Errors are usually triggered when a user uses more than 20% of the CPU on the server. or when a process takes more than 30 CPU seconds (Numbers may vary but not much). Those errors are set up that way to avoid server-lockups if too many people are logging on to the same server at once. You will need to optimize your code to avoid these errors.

If you wish to investigate the cause of this further there are some logs within your site files that may provide some further information. You can locate these log files by logging into your cPanel then enter your File Manager.

When in the File Manager, open the folder labeled 'tmp'. Inside this folder there are 2 folders that You may have information pertaining to this issue, the cpu_exceeded_logs and mysql_slow_queries. If you open either of these folders, select the file you wish to view, and choose "Show File" from the options on the right, they will contain information to show what may have been causing the excessive server CPU usage.

While your site will generally come back up after 5-10 minutes from causing those errors, it is still recommended that you optimize your code and/or index your databases to prevent this from happening again.

No comments:

Post a Comment