{"id":814,"date":"2024-12-12T11:06:31","date_gmt":"2024-12-12T11:06:31","guid":{"rendered":"https:\/\/webhostingcochin.co.in\/blog\/?p=814"},"modified":"2024-12-12T11:24:09","modified_gmt":"2024-12-12T11:24:09","slug":"fixing-high-cpu-usage-in-plesk-servers","status":"publish","type":"post","link":"https:\/\/webhostingcochin.co.in\/blog\/fixing-high-cpu-usage-in-plesk-servers\/","title":{"rendered":"Fixing High CPU Usage in Plesk Servers"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"830\" height=\"524\" src=\"https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Windows-Plesk-Management.png\" alt=\"\" class=\"wp-image-825\" style=\"width:798px;height:auto\" srcset=\"https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Windows-Plesk-Management.png 830w, https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Windows-Plesk-Management-300x189.png 300w, https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Windows-Plesk-Management-768x485.png 768w\" sizes=\"auto, (max-width: 830px) 100vw, 830px\" \/><\/figure>\n\n\n\n<p>High CPU usage on a <a href=\"https:\/\/www.plesk.com\/\" data-type=\"link\" data-id=\"https:\/\/www.plesk.com\/\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Plesk<\/a> server can significantly affect its performance and may lead to service interruptions. To resolve this issue, you need to diagnose the root cause and implement the appropriate fixes. Here\u2019s a step-by-step approach:<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#1-identify-the-processes-using-high-cpu\">1. Identify the Processes Using High CPU<\/a><\/li><li><a href=\"#2-check-for-abnormal-traffic-or-attacks\">2. Check for Abnormal Traffic or Attacks<\/a><\/li><li><a href=\"#3-review-resource-intensive-websites-or-applications\">3. Review Resource-Intensive Websites or Applications<\/a><\/li><li><a href=\"#4-optimize-web-server-configuration\">4. Optimize Web Server Configuration<\/a><\/li><li><a href=\"#5-review-servers-hardware-resource-allocation\">5. Review Server\u2019s Hardware Resource Allocation<\/a><\/li><li><a href=\"#6-check-running-services\">6. Check Running Services<\/a><\/li><li><a href=\"#7-check-for-malware-or-malicious-scripts\">7. Check for Malware or Malicious Scripts<\/a><\/li><li><a href=\"#8-update-software-and-plesk\">8. Update Software and Plesk<\/a><\/li><li><a href=\"#9-adjust-php-settings\">9. Adjust PHP Settings<\/a><\/li><li><a href=\"#10-restart-services-or-reboot-the-server\">10. Restart Services or Reboot the Server<\/a><\/li><li><a href=\"#11-monitor-and-set-alerts-for-cpu-usage\">11. Monitor and Set Alerts for CPU Usage<\/a><\/li><li><a href=\"#conclusion\">Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-identify-the-processes-using-high-cpu\">1. <strong>Identify the Processes Using High CPU<\/strong><\/h3>\n\n\n\n<p>The first step is to identify which processes are consuming the most CPU resources on your server. You can do this via command line or through Plesk\u2019s monitoring tools.<\/p>\n\n\n\n<p><strong>Using Command Line:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log into your server via SSH as the root user.<\/li>\n\n\n\n<li>Run the following command to identify resource-hogging processes:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>top\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>This command displays the processes using the most CPU. You can press <code>P<\/code> to sort by CPU usage.<\/li>\n\n\n\n<li>If you want a more detailed process list, use:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>ps aux --sort=-%cpu\n<\/code><\/pre>\n\n\n\n<p><strong>Using Plesk:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Plesk also has a resource monitoring tool where you can view CPU usage by clicking on <strong>Tools &amp; Settings > Server Health<\/strong>.<\/li>\n\n\n\n<li>This will give you an overview of CPU load over time.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-check-for-abnormal-traffic-or-attacks\">2. <strong>Check for Abnormal Traffic or Attacks<\/strong><\/h3>\n\n\n\n<p>High CPU usage could be caused by an external attack, such as a Distributed Denial of Service (DDoS), or an abnormal surge in traffic.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check the server\u2019s logs for unusual patterns in traffic, especially around the time when CPU usage spikes.<\/li>\n\n\n\n<li>Review the <strong><a href=\"https:\/\/www.apache.org\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.apache.org\/\" rel=\"noreferrer noopener nofollow\">Apache<\/a><\/strong> or <strong>Nginx<\/strong> logs:\n<ul class=\"wp-block-list\">\n<li>Apache: <code>\/var\/log\/httpd\/access_log<\/code> (or <code>\/var\/log\/apache2\/access_log<\/code>)<\/li>\n\n\n\n<li>Nginx: <code>\/var\/log\/nginx\/access.log<\/code><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>You can also use tools like <code>netstat<\/code> to identify high numbers of open connections:bashCopy code<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>netstat -an | grep ESTABLISHED | wc -l\n<\/code><\/pre>\n\n\n\n<p>If you suspect a DDoS attack, implement firewall rules or use services like <a href=\"https:\/\/www.cloudflare.com\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.cloudflare.com\/\" rel=\"noreferrer noopener nofollow\">Cloudflare <\/a>to block malicious traffic.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-review-resource-intensive-websites-or-applications\">3. <strong>Review Resource-Intensive Websites or Applications<\/strong><\/h3>\n\n\n\n<p>Certain websites, applications, or scripts may consume excessive resources. Review these components to identify any issues.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>WordPress and other CMS<\/strong>: These often have plugins or themes that can be inefficient and consume excessive resources.<\/li>\n\n\n\n<li><strong>Database-intensive Applications<\/strong>: Applications that rely heavily on databases (e.g., WordPress, Magento) can cause high CPU usage, particularly if the database queries are not optimized.<\/li>\n\n\n\n<li><strong>Check MySQL or MariaDB<\/strong> (depending on your server configuration):\n<ul class=\"wp-block-list\">\n<li>Run the following command to analyze the database:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p -e \"SHOW PROCESSLIST;\"\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Look for long-running queries that may be consuming excessive CPU.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-optimize-web-server-configuration\">4. <strong>Optimize Web Server Configuration<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"500\" src=\"https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Plesk-Server-Management.png\" alt=\"\" class=\"wp-image-826\" style=\"width:461px;height:auto\" srcset=\"https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Plesk-Server-Management.png 500w, https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Plesk-Server-Management-300x300.png 300w, https:\/\/webhostingcochin.co.in\/blog\/wp-content\/uploads\/2024\/12\/Plesk-Server-Management-150x150.png 150w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.webhostingcochin.co.in\/vps-hosting\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/www.webhostingcochin.co.in\/vps-hosting\/\" rel=\"noreferrer noopener nofollow\">Web servers<\/a> such as Apache and Nginx can be optimized for better performance.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Apache<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Enable caching (mod_cache, mod_expires).<\/li>\n\n\n\n<li>Use <code>KeepAlive<\/code> with proper configuration.<\/li>\n\n\n\n<li>Adjust the number of worker processes based on server capacity (<code>MaxClients<\/code> in Apache).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Nginx<\/strong>:\n<ul class=\"wp-block-list\">\n<li>Ensure that the worker processes are configured efficiently by adjusting the <code>worker_processes<\/code> and <code>worker_connections<\/code> directives in the configuration file.<\/li>\n\n\n\n<li>Enable caching for static content.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-review-servers-hardware-resource-allocation\">5. <strong>Review Server\u2019s Hardware Resource Allocation<\/strong><\/h3>\n\n\n\n<p>Ensure your server\u2019s resources are sufficient for the current load:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Increase RAM<\/strong>: If the server is running out of memory, it could cause CPU to spike as processes get swapped to disk.<\/li>\n\n\n\n<li><strong>Upgrade CPU<\/strong>: If the server is consistently under heavy load, consider upgrading to a more powerful CPU.<\/li>\n\n\n\n<li><strong>Consider SSD<\/strong>: If you are still using traditional hard drives, upgrading to SSDs can significantly improve I\/O performance, thus reducing CPU load.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6-check-running-services\">6. <strong>Check Running Services<\/strong><\/h3>\n\n\n\n<p>Some services on the server may be consuming unnecessary resources. For example, backup services, email processing (e.g., spam filtering), or security tools may be resource-intensive.<\/p>\n\n\n\n<p>Check for cron jobs that run frequently and may be consuming CPU. Review the cron logs:<\/p>\n\n\n\n<p>Review Plesk extensions that are enabled, such as anti-virus, backup, or other monitoring tools. Consider disabling or optimizing them.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/var\/log\/cron\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7-check-for-malware-or-malicious-scripts\">7. <strong>Check for Malware or Malicious Scripts<\/strong><\/h3>\n\n\n\n<p>Malware or scripts running on your server can cause high CPU usage. Ensure that your server is secure.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run a malware scan to check for any malicious scripts or files using Plesk&#8217;s security tools or third-party software like <strong>ClamAV<\/strong> or <strong><a href=\"https:\/\/imunify360.com\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/imunify360.com\/\" rel=\"noreferrer noopener nofollow\">Imunify360<\/a><\/strong>.<\/li>\n\n\n\n<li>If malware is detected, immediately quarantine and remove the malicious files.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"8-update-software-and-plesk\">8. <strong>Update Software and Plesk<\/strong><\/h3>\n\n\n\n<p>Ensure that both Plesk and your server software (including Apache, Nginx, MySQL, PHP, etc.) are up to date. Outdated software may have bugs or inefficiencies that lead to high CPU usage.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update Plesk:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>plesk installer update\n<\/code><\/pre>\n\n\n\n<p>Update server software:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get update &amp;&amp; apt-get upgrade  # For Ubuntu\/Debian\nyum update                      # For CentOS\/RHEL\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"9-adjust-php-settings\">9. <strong>Adjust PHP Settings<\/strong><\/h3>\n\n\n\n<p>PHP processes can sometimes consume too much CPU, especially with inefficient scripts. Consider the following optimizations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Increase the <code>memory_limit<\/code> in PHP configuration.<\/li>\n\n\n\n<li>Optimize the number of PHP-FPM workers if using PHP-FPM.<\/li>\n\n\n\n<li>Review PHP error logs for issues such as excessive errors or warnings that might indicate poorly performing scripts.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"10-restart-services-or-reboot-the-server\">10. <strong>Restart Services or Reboot the Server<\/strong><\/h3>\n\n\n\n<p>After making optimizations or changes, restarting services can help reduce CPU load temporarily and apply new configurations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Restart the web server (Apache\/Nginx) and database (MySQL\/MariaDB):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>service apache2 restart      # Apache\nservice nginx restart        # Nginx\nservice mysql restart        # MySQL\/MariaDB\n<\/code><\/pre>\n\n\n\n<p>If needed, reboot the entire server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reboot\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"11-monitor-and-set-alerts-for-cpu-usage\">11. <strong>Monitor and Set Alerts for CPU Usage<\/strong><\/h3>\n\n\n\n<p>After resolving the issue, set up regular monitoring and alerts to proactively detect future high CPU usage.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Plesk provides monitoring tools in <strong>Tools &amp; Settings > Server Health<\/strong>.<\/li>\n\n\n\n<li>Use external monitoring services like <strong>UptimeRobot<\/strong>, <strong>Pingdom<\/strong>, or <strong>New Relic<\/strong> to get alerts about high CPU usage.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h3>\n\n\n\n<p>By following these steps, you should be able to diagnose and resolve high CPU usage issues on your Plesk server. Identifying the root cause\u2014whether it\u2019s inefficient scripts, an overload of traffic, or poorly configured services\u2014is key to ensuring smooth and efficient server operation. Regular monitoring and updates will also help keep CPU usage under control in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>High CPU usage on a Plesk server can significantly affect its performance and may lead to service interruptions. To resolve this issue, you need to diagnose the root cause and&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-814","post","type-post","status-publish","format-standard","hentry","category-dedicated"],"_links":{"self":[{"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/comments?post=814"}],"version-history":[{"count":9,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/posts\/814\/revisions"}],"predecessor-version":[{"id":831,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/posts\/814\/revisions\/831"}],"wp:attachment":[{"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/media?parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/categories?post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingcochin.co.in\/blog\/wp-json\/wp\/v2\/tags?post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}