Resource Consumption Issues (CPU Usage) and Common Errors Associated with It
Resource consumption issues (CPU Usage) are often linked to severe site slowdown, and in extreme cases, the site may stop entirely with one of the following error messages. It’s important to note that these error messages are not always caused by resource consumption, but it is one of the potential causes.
Common Error Messages:
- 500 Internal Server Error
- 501 Not Implemented
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout
- 507 Insufficient Storage Space
- 408 Request Timeout
- 413 Request Entity Too Large
- 429 Too Many Requests
- 522 Connection Timed Out
- White Screen of Death: A blank page appears without any content
We will discuss the causes and solutions, but I want to clarify that we won’t be solving each problem individually. Instead, we aim to address all errors and improve the overall site condition. However, we will differentiate between:
- The problem occurring suddenly: This is the most critical.
- The problem appearing at the beginning of site design: This is less critical as there is no risk of making a wrong decision that could lead to site loss or operational halt.
Today, we will focus on the first type, where the issue appears suddenly.
Initially, some site owners or WordPress developers report that CPU usage is excessively high. When it reaches 100%, the site freezes, and error messages, as shown in the table above, begin to appear.
Solutions in Case One of the Errors Appears
We will work in two phases:
First Phase: Essential for Solving Any of These Issues
- Increase PHP memory limit
- Increase the execution time limit
- Increase the wait timeout
These can be done in several ways. You can search for detailed methods online. One method is adding the following code inside the .htaccess
file:
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
Second: Rename the theme file to force deactivation and use another theme to check if the problem is theme-related. If the problem is solved, it means the theme caused it. If not, it’s likely the theme version is unofficial or contains errors. You can download the latest version and re-upload it, which will not affect your site content at all.
Third: Check your storage space—are you using all of it? Investigate the cause. It could be due to daily backups consuming space, in which case you can delete the excess backups and leave one or two.
Fourth: Disable security plugins. Ensure you deactivate any plugins related to security or site acceleration, as these could be primary causes of the error messages mentioned earlier.
Fifth: Disable plugins by renaming the plugins
folder in the File Manager. This forces the site to deactivate all plugins. Wait a few minutes to see if the issue is resolved. If it is, one of the plugins likely caused the problem. Re-enable them one by one until you find the culprit and then disable it.
Sixth: Check the number of notifications in the dashboard. There’s a high chance your server is flooded with notifications, leading to resource overuse. You can temporarily disable emails until you install suitable protection or contact your service provider.
Second Phase: Many people work on this phase, and it’s not wrong, but if you complete the first phase as a preventive measure, it will significantly improve server performance and site efficiency. We will now focus on the error messages and explain their causes and specific solutions without repeating the steps from the first phase, addressing only the unique step required for each error.
Error Messages and Proposed Solutions:
500 Internal Server Error
- Cause: Server issue or coding errors.
- Solution: Rename the
.htaccess
file to disable it, which will be regenerated when you save the permalinks in the dashboard. If it doesn’t work and you’ve completed the steps in the first phase, contact your hosting provider.
501 Not Implemented
- Cause: The requested feature is not supported or enabled.
- Solution:
- Ensure that HTTP requests in WordPress are supported.
- Disable all plugins and try using a default theme.
- Check and temporarily rename the
.htaccess
file. - Increase PHP resources through the
.htaccess
file. - Contact hosting support if the issue persists.
502 Bad Gateway
- Cause: Network issues, incorrect proxy settings, or site overload.
- Solution:
- First, follow the solutions from the first phase.
- Then, check for site overload.
- Review Cloudflare settings.
- Contact technical support if the issue remains unresolved.
Remaining Error Messages: Almost all the available solutions have been covered in the first phase. If they don’t work, you’ll need to contact your service provider.
Best regards,
Programmer / Mostafa Salim