VPS & Dedicated Hosting: Site Performance Essentials & Tips
Overview
This article will explain how-to prevent your server from freezing up, including ways to fix common site performance problems on a VPS or Dedicated Server.
Before you start, measure your site's current speed at Google PageSpeed Insights; just take note of the provided 'Seconds to load'.
- Unsupported Suggestions
- P.S. How do you check what happened in the past?
- P.P.S. Search what others have done
Write down the original time.
- Tune your CMS site (WordPress, Joomla, etc.)
- Temporarily deactivate ALL Plugins/Modules/Addons.
- Retime your site once more at Google PageSpeed Insights.
- Write it down.
- Install a Plugin/Module/Addon that does "caching":
Examples: On WordPress, there's W3 Total Cache or WP Fastest Cache. W3TC is our top recommendation. (Several caching plugins usually have conflict or compatibility issues with other plugins. Some users are forced to search for replacement plugins just to make their site function efficiently, but from the reviews of active users, all of the other well-programmed plugins they use work together perfectly with W3TC.)
- Reactivate one of the other plugins/modules. Retime it with Google PageSpeed Insights and write it down.
- Disable that previous plugin/module and then enable the next one. Retime it with Google PageSpeed Insightsr and write it down.
- Keep on doing that to determine which plugin is causing slowness to your site's performance. You'll usually find one that takes significantly more time than the others. In rare cases, it's a combination of two. Then find a replacement plugin/module that isn't so resource-intensive as the faulty one.
- On WordPress, do the same series of time measurements with any Widgets.
- PHP FastCGI(fcgi) Handler
- Login to your WHM.
You may also follow this format (https://server.YOURDOMAIN:2087)
Make sure to replace YOURDOMAIN with the correct domain name on your account. - Go to Configure PHP & Suexec (You can also use the search box at the upper left of WHM).
- Then change the "Handler" to "fcgi" and click the submit button.
- Login to your WHM.
- Use a CDN (Content Delivery Network)
Cloudflare is our recommended CDN. To know more about Cloudflare, click here. It's free for all http:// sites.
Note: if you use https:// anywhere on the website, you have to buy a paid version of CloudFlare.
- Once activated, time it once more at Google PageSpeed Insights.
Unsupported Suggestions
Please understand that the recommendations below are outside the scope of our support. If you have further questions about them, you'll need to do your personal research online.
We will continue to help by pointing you in the right direction; by giving you the many pieces of information that we have found to be helpful. Additionally, some of the further resources online amongst many are forums.cpanel.net, dev.mysql.com/doc/, and httpd.apache.org.
- Use a PHP cache module such as Xcache or eAccelerator
You may want to research them before trying it out:
Important: Please note that we do not provide technical support for either of these.
Try this at a time when you can most afford for your website to be down, just in case you'll run into a problem.
- Via your WHM, search for EasyApache and select it.
- Give it time to load up.
- At the bottom of the Step 1 page, click "Start customizing based on profile."
- On Steps 2 and 3, click "Next Step." You don't have to do anything else other than click "Next Step" on each.
- On Step 4, Short Options -> tick the checkbox for the one that you want -- for example, "Xcache for PHP" -> scroll down, and click Save & Build.
This process can take 30 minutes or more to run. Use only 1 at a time. Time which one is faster for you. If it breaks your site, just go back to WHM -> EasyApache -> and rebuild without it -- uncheck it, and then rebuild it once more.
- After it's turned on, time it at again at Google PageSpeed Insights.
- Tune the MySQL database server settings in /etc/my.cnf. You can edit this file via SFTP using any SFTP program, like Filezilla (Username root and port 22).
Some places to learn about my.cnf optimization are:
- cPanel Forums
For example, many have had success with the Mysqltuner script mentioned in cPanel forums: mysql optimization suggestions.
- MySQL Forums
- Database Administrators Stack Exchange
- There are also sample my.cnf's in /usr/share/mysql that you can try swapping in to /etc/my.cnf and then restart your MySQL server. WHM -> Restart Services -> SQL Server (MySQL)
- cPanel Forums
- Time your site again at Google PageSpeed Insights.
- Tune the Apache webserver.
- One idea is using ApacheBuddy
- Try the various MPM modules listed in Easy Apache -> Exhaustive Options. There are "More Info" links next to each module.
- Load test your site using Siege or ab - Apache HTTP server benchmarking tool. Load testing will help you discover how many connections you can handle.
- Time it again.
- Buy additional RAM or CPU cores.
You can purchase additional CPU and RAM via the Addons -> Add Resources tab (at the top of your Control Panel.)
P.S. How do you check what happened in the past?
Check the website and server logs:
The following two logs can be downloaded from the Access Logs section of your Control Panel.
- /usr/local/apache/domlogs/YOURDOMAIN.COM
- /usr/local/apache/logs/error_log
The last log can be downloaded with an SFTP program, like Filezilla, using the username of root and port 22.
- /var/log/messages
Also, the `sar` shell command is good for history.
This command can be run via SSH from your main cPanel username or as root.
Example: sar -q for today and sar -q /var/log/sa/sa24 if you want to see the 24th day of the month. Edit it in whatever number is yesterday if you want to the ones from yesterday.
sar -r is also good for looking at RAM usage history.
P.P.S. Search what others have done
You can see what others are doing to optimize their servers at cPanel forums: Optimization.
cPanel forums: Troubleshooting high server loads on Linux servers is only one of many examples that can be found on the Optimization forum.
If you need further assistance, feel free to contact us via Chat or Phone:
- Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
- Phone Support -
- US: 888-401-4678
- International: +1 801-765-9400
You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.