CPU Usage Reaching 100% Limit
-
I have a wordpress+woocommerce website with average 300 visitors per day. I am facing an issue for some time that my site is using 100% of the CPU usage. It only happens when I am logged in the admin section doing basic things like creating new products, processing orders or even when I am updating plugins. For few seconds or more, the CPU usage peaks to 100% of limit provided by hosting company.
I talked to hosting company about it but they weren’t helpful. All i get from them are threatening messages that they will suspend my account.
I tried literally everything. I have tried disabling plugins, changed back to default theme. I have also installed plugin to control Heartbeat API but nothing seems to be working. Could somebody please help.
-
This may bcs of a plugin, do you have cpanel?
Hi @farhadvn I tried disabling plugins but it didn’t work. But yes i do have cpanel.
Ok, do you blocked bots in your website?
P.S also please check .user.ini or php.ini and write content!
Is your wp cron active?
Hi @farhadvn thanks for the reply.
I could not find any user.ini or php.ini file. Where are they usually located?
I never made any changes in wp cron settings so not sure if its active or not. However there is one entry is wp-config file
define( 'WP_CRON_LOCK_TIMEOUT', 120 );I checked error logs and found on entry again and again.
WP_MEMORY_LIMIT’ - assumed '‘WP_MEMORY_LIMIT’' in wp-config.php on line 88 PHP Notice: Use of undefined constant ‘256M’ - assumed '‘256M’' in wp-config.php on line 88In root directory of public_html (hidden by default, check setting and active showing hidden file.)
Also say me your wp config custom defines.
Add this to wp config:
define('DISABLE_WP_CRON', true);Delete this from wp config:
define( 'WP_CRON_LOCK_TIMEOUT', 120 );Go to cpanel, cron jobs:
Add a job, select
common jobas 5 min, and put this incommand:wget -q -O - https://yoursite.com/wp-cron.php?doing_wp_cronRemember, replace
yoursite.comby your own url.Hi there, Please read this blog post. It will be helpful for you.
Click on the link
Note: Use google re-captcha plugin
-
This reply was modified 6 years, 5 months ago by
Toufiqur Rahman.
I recommend asking at https://wordpress.org/support/plugin/woocommerce so the plugin’s developers and support community can help you with this.
Dear @farhadvn I looked into the root directory of public_html but there is no user.ini or php.in file. Even changed setting to show hidden files.
I have added the cron job with cpanel and disabled the cron in config as you suggested.
This is how my config file looks like.
<?php /** Enable W3 Total Cache */ define('WP_CACHE', true); // Added by W3 Total Cache /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the * installation. You don't have to use the web site, you can * copy this file to "wp-config.php" and fill in the values. * * This file contains the following configurations: * * * MySQL settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://codex.wordpress.org/Editing_wp-config.php * * @package WordPress */ // ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ //Added by WP-Cache Manager define( 'WPCACHEHOME', 'plugins/wp-super-cache/' ); //Added by WP-Cache Manager define('DB_NAME', 'removed'); /** MySQL database username */ define('DB_USER', 'removed'); /** MySQL database password */ define('DB_PASSWORD', 'removed'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', ''); /**#@+ * Authentication Unique Keys and Salts. * * Change these to different unique phrases! * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service} * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again. * * @since 2.6.0 */ define('AUTH_KEY', 'removed'); define('SECURE_AUTH_KEY', 'removed'); define('LOGGED_IN_KEY', 'removed'); define('NONCE_KEY', 'removed'); define('AUTH_SALT', 'removed'); define('SECURE_AUTH_SALT', 'removed'); define('LOGGED_IN_SALT', 'removed'); define('NONCE_SALT', 'removed'); /**#@-*/ /** * WordPress Database Table prefix. * * You can have multiple installations in one database if you give each * a unique prefix. Only numbers, letters, and underscores please! */ $table_prefix = 'wpvz_'; /** * For developers: WordPress debugging mode. * * Change this to true to enable the display of notices during development. * It is strongly recommended that plugin and theme developers use WP_DEBUG * in their development environments. * * For information on other constants that can be used for debugging, * visit the Codex. * * @link https://codex.wordpress.org/Debugging_in_WordPress */ ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_DISPLAY', false); define( 'AUTOSAVE_INTERVAL', 300 ); define( 'WP_POST_REVISIONS', 5 ); define( 'EMPTY_TRASH_DAYS', 7 ); define('DISABLE_WP_CRON', true); /* That's all, stop editing! Happy blogging. */ define(‘WP_MEMORY_LIMIT’, ‘256M’); /** Absolute path to the WordPress directory. */ if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); /** Sets up WordPress vars and included files. */ require_once(ABSPATH . 'wp-settings.php'); error_reporting(E_ALL); ini_set('display_errors', 1);@mayank29gupta No problem for ini files.
Everthing looklike good, only delete the last line:
error_reporting(E_ALL); ini_set('display_errors', 1);And change
error_reporting(E_ALL);in 2th line toerror_reporting(0);if you dont need to php error logging. (Save first one for debugging times)please install this plugin:
https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/
And active features one by one, also captcha. (Dont active bruteforce protection)
This is a free & useful security plugin
Then check your cpu usage.
Note: if not fixed, simple check your cache plugin and unused plugins, check update status of them, if not helped, there is should be a plugin problem that needed to be reported to woo team. However normally with this works should be fixed.
Thanks @farhadvn i will do as you instructed. Meanwhile could you please tell me what should be acceptable CPU usage limit? As I can check on cpanel, I am consistently hitting over 50% of CPU limit several times a day. Most of these times, I am not even accessing the Admin area. In fact I just noticed that I hit 100% usage briefly but I wasn’t accessing the website.
@mayank29gupta It is based on many factors as number & system of plugins, theme, features & number of visitors and hits.
For theme, i forgot it, you should combine css files and active browser caching, it will be very helpful. Save your sever load and bandwidth.
Test your site by gtmetrix.com, it say 2 grade, say me both, with load time and number of requests.Change your https://en.m.wikipedia.org/wiki/Grave_accent for
'
define('WP_MEMORY_LIMIT','256M');
also make sure you don’t use all the images in a single folder.
https://wordpress.org/support/topic/media-folders-on-the-server/@farhadvn Gmetrix score is as following.
PageSpeed Score – A 92%
YSlow Score – C 72%Load Time: 4.2 seconds
Total Page Size – 710kb
Requests: 70For your reference I am attaching screenshot of today’s cpu consumption.
-
This reply was modified 6 years, 4 months ago by
mayank29gupta.
-
This reply was modified 6 years, 5 months ago by
The topic ‘CPU Usage Reaching 100% Limit’ is closed to new replies.