If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

VPS CPU load

Started by sinelogixweb, Nov 27, 2022, 04:55 AM

Previous topic - Next topic

sinelogixwebTopic starter

Greetings! Currently, I have four different sites across VPS/VDS from various hosting providers. However, this month, my CPU load has significantly increased and is now at 100%.



I've noticed that two of my sites on the CentOS-7-amd64 server with ISP panel have been affected, while the third site on Ubuntu-16.04-amd64 with a free Vesta panel is working properly.

I'm curious to know if anyone else has experienced similar issues on their servers and what might be causing it. I haven't made any changes to the sites, except for uploading new content and experiencing slightly higher visitor traffic. It seems like the problem is on the server side, and I'm positive that it is.
  •  

selearnerlive

To check your CPU load percentage, run 'yum install htop' and then 'htop'. This will instantly show the name of the process that's causing the load.

In addition, you can install a server status monitoring tool such as servermonitoring.me, which is free. This service provides real-time insight into what's happening on your server.
  •  

timbarnard

Beating around the bush won't help in identifying the actual cause behind CPU or IO issues on your server. To understand what's creating the load, you'll need to investigate specific areas such as Apache, Nginx, PHP-FPM, MySQL, and queries to the same or different pages.

The only way to assess this issue accurately is by having SSH access to the server. The logs and screenshots of the problem cannot be posted on the forum, so it's best to request support from your hosting provider.

However, it's essential to back up your words with logs and screenshots for a reliable solution. Therefore, if your server administration has access to logs, ask support to conduct an in-depth analysis.

If the analysis has already been completed, then provide the screenshots or sections of logs to better understand the problem.
  •  

RanKumar

Apache can cause excessive CPU load due to faulty scripts, issues with audio/video, or data compression using mod_gzip. To address the problem, try disabling data compression or optimizing scripts.

MySQL can cause high disk load if it's not configured correctly or if queries aren't constructed properly. Temporary tables might be stored on disk because of insufficient memory buffers or complex queries. To fix this issue, increase max_heap_table_size and tmp_table_size directives in the my.cnf configuration file. You can use the mysqladmin -i 2 processlist -p command to locate the Created_tmp_disk_tables issue. To optimize settings, you can use scripts like mysqltuner.p and tuning-primer.

Keep in mind that an incorrect MySQL configuration may lead to increased RAM consumption and system resources.

MySQL tends to generate temporary tables on disk, especially when using BLOB/TEXT columns, GROUP BY/DISTINCT with column sizes greater than 512 bytes, or SELECT output with UNION/UNION ALL and column sizes exceeding 512 bytes.

If you're experiencing excessive processor load problems with MySQL, the issue is likely with broken indexes or tables. Check MySQL logs for more information, and run table checks using either phpMyAdmin or the mysqlcheck -Arp command with the MySQL administrator password.
  •  

Bernaldy

It's unfortunate to hear that you're experiencing increased CPU load on your servers. High CPU usage can be caused by various factors, and without more information, it can be challenging to pinpoint the exact cause. However, I can suggest a few possible reasons for the issue.

1. Increased visitor traffic: As you mentioned, if you've been experiencing higher visitor traffic on your sites, this can certainly lead to higher CPU usage. More users accessing your sites simultaneously can put a strain on the server resources.

2. Resource-intensive content: If you've uploaded new content that is more resource-intensive, such as large files, videos, or complex scripts, it can contribute to increased CPU usage. Make sure to optimize your content, compress images, and use efficient coding practices.

3. Malicious activity: Unfortunately, high CPU usage can also be a result of malicious activities like hacking attempts or DDoS attacks. Regularly monitoring server logs and implementing security measures can help identify and mitigate these issues.

4. Software or configuration changes: While you mentioned not making any changes to your sites, it's worth investigating if any software updates or configuration changes were automatically applied by your hosting provider. These updates could impact server performance.

To resolve the issue, consider the following steps:

1. Monitor server logs: Check for any unusual activity in the logs related to CPU usage or errors. This can provide valuable insights into the problem.

2. Utilize server monitoring tools: Implement a server monitoring tool to track resource usage over time. This can help identify patterns or specific events causing high CPU usage.

3. Optimize website performance: Review your websites for potential optimization opportunities, such as caching, optimizing database queries, or using a content delivery network (CDN).

4. Upgrade server resources: If your current server resources are insufficient to handle the increased load, consider upgrading to a hosting plan with higher CPU capacity or migrating to a more powerful server.

5. Contact your hosting provider: If the issue persists and you've exhausted all troubleshooting options, reach out to your hosting provider's support team. They may have additional insights or be able to help troubleshoot the problem.


Here are some additional steps you can take to further investigate and address the high CPU usage issue:

1. Identify specific processes: Use system monitoring tools like top or htop to identify the specific processes that are consuming the most CPU resources. This can help pinpoint which applications or services are causing the high usage.

2. Verify server configuration: Double-check your server configuration files, such as Apache or Nginx configurations, PHP settings, and database configurations. Ensure they are optimized for performance and not imposing unnecessary load on the CPU.

3. Check for background tasks: Look for any background tasks that might be running on the server, such as backups, cron jobs, or resource-intensive scripts. Disable or reschedule these tasks during peak hours to reduce the impact on CPU usage.

4. Analyze website code: If you suspect that the code of your websites might be causing the high CPU usage, review your application's code and scripts. Look for any inefficient coding practices or loops that could be unnecessarily consuming CPU resources.

5. Enable caching: Implement caching mechanisms like opcode caching (such as PHP OPcache), object caching, or page caching. Caching can significantly improve website performance and reduce the overall CPU load.

6. Optimize database queries: Poorly optimized database queries can result in high CPU usage. Analyze your database queries and ensure they are efficient and properly indexed. Consider using a query optimization tool or seeking assistance from a database administrator if needed.

7. Consider load balancing: If your websites continue to experience high CPU load even after optimization efforts, consider implementing load balancing techniques. Load balancing distributes incoming traffic across multiple servers, helping to distribute the CPU load more evenly.

8. Upgrade software and packages: Ensure that your server's operating system, web server, database, and other software components are up to date. Updating to the latest stable versions can often include important bug fixes and performance improvements.

9. Monitor for unusual traffic or attacks: Keep an eye out for any abnormal traffic patterns or potential security threats, such as brute-force attacks or suspicious access logs. Implement security measures like firewalls and intrusion detection systems to protect your server.


more steps you can try to further investigate and mitigate the high CPU load issue:

1. Enable server-side caching: Implement server-side caching mechanisms like Varnish or Redis cache to offload some of the CPU load from your web server. These caching systems can improve response times and reduce the need for resource-intensive processes.

2. Optimize your web server: Depending on whether you're using Apache or Nginx, there are various optimizations you can make. For example, tuning the number of worker processes/threads, adjusting connection timeouts, enabling compression, or utilizing modules like mod_deflate (for Apache) or gzip (for Nginx) to reduce data transfer sizes.

3. Analyze resource usage by visitors: You can use tools like Google Analytics or server-level analytics software (e.g., AWStats) to gain insights into visitor behavior and resource usage patterns. This information can help identify specific pages or user actions that are causing the high CPU load.

4. Update your CMS and plugins: If your websites are built on a content management system (CMS) like WordPress or Joomla, ensure that both the core CMS and any installed plugins/themes are up to date. Outdated or poorly coded plugins can contribute to high CPU usage.

5. Check for database issues: If your websites heavily rely on databases, examine the database performance. Ensure that indexes are properly set up, consider optimizing queries, and monitor slow query logs to identify potential bottlenecks.

6. Consider server load balancing: If you have multiple servers, distributing the load across them using load balancing techniques can help alleviate the high CPU usage issue. Load balancers distribute incoming requests among several servers, allowing for better resource utilization.

7. Monitor resource usage in real-time: Use tools like Munin, New Relic, or Grafana to monitor the real-time resource usage of your servers. This can provide valuable insights into CPU load trends and help identify specific time periods or events that result in high usage.

8. Consider upgrading hardware: If you've exhausted all software optimizations and your servers still struggle with high CPU load, it may be worth considering upgrading to more powerful hardware. This could involve moving to a dedicated server or choosing a hosting plan that offers higher CPU resources.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...