Guide for optimizing your site for the purpose of using less system resources
This section can be used as a guide for optimizing your site for the purpose of using less system resources. Well-optimized sites also load quicker for your visitors.
While any site can be CPU and memory-intensive, some software has a higher potential to occupy more system resources than others. Software that we most commonly see attributed to high CPU/memory usage are listed below:
- Wordpress - How to Optimize Wordpress
- Joomla/Mambo - How to Optimize Joomla/Mambo
- Gallery2 - Gallery2 Optimization Tips
- Vbulletin - vBulletin Optimization Tips
- Magento - Increasing Magento's Performance
*Note: the developers of Magento have warned about high resource usage, indicating that it may not be shared-server friendly
Tips for Reducing Resource Usage
For many sites, there are some standard ways of optimizing your site to consume less resources on the server.
- Check: You can use this online optimization tool to help you pinpoint what parts of your site may be causing a problem. In many cases, the parts that take the longest to load also take more memory and CPU for the server to serve.
- Caching: Since PHP and MySQL are server-interpreted languages, the server has to compile every PHP page and process every MySQL query. If you are running a PHP and/or MySQL-driven site, caching can reduce your usage dramatically. Caching essentially stores called PHP pages as static HTML files, so the next time the page is loaded, the cached HTML file is served instead. If you are running a pre-bundled software package (like Wordpress, Joomla, etc) it likely already either has a built-in caching option or a third-party caching plugin that you can install. If you are a programmer or would rather implement your own caching mechanism, the below links may help you get started:
- MySQL optimization: As databases grow and with regular use, they gain overhead and may need to be re-indexed. The quickest way to address this is by logging into your cPanel > phpMyAdmin and running the 'optimize' or 'repair' commands against your database. [Instructions] . You also may need to restructure or index your database so your MySQL queries run quickly.
We will usually let you know if the problem we're seeing with your site is related to MySQL. In most cases these issues need to be addressed by your site's programming or the developer of the software you are running. Optimization (as described above) may help, but if the problem is a database coding issue it should be addressed by a programmer. Generally speaking, delayed inserts are not suitable for shared hosting. If your application is using delayed inserts, exporting your database without that option checked, then re-importing it.
In some cases, delayed inserts are caused by instructions in your site's application programming, where a MySQL statement will contain a line such as "INSERT DELAYED INTO ...", where you can simply change this to "INSERT INTO ...".
- Hotlink protection: Hotlinking is more common with sites that serve a lot of images, such as gallery sites. Hotlinking is a term that describes when another site directly links to images on your site, and is generally frowned upon and described as "bandwidth stealing." You can enable hotlink protection in your cPanel, but be sure to include your addon/parked/sub-domains in the 'allow' list so that all your sites function properly.
- Robots.txt: Search engines and robots can account for a large percentage of a site's traffic, and most of this traffic can be unnecessary so reducing it can save a lot of resources on the server. You don't want to eliminate search engines altogether, but you should restrict them from being able to access directories that don't contain content you need indexes, and you should block unfamiliar bots and spiders that are frequenting your site. You can identify the spiders and bots crawling your site by looking at your AWstats, and restrict their activity using a robots.txt file: [Help]. You can also block undesired robots by using the IP deny manager in your cPanel.
- Reducing image size: reducing the size of images loading on your site can reduce resouce usage. The recommended formats for website images are PNG, JPEG/JPG, and GIF. BMP files tend to be extremeley large, and gif files tend to have reduced quality. Therefore, it's recommended to downsize images and convert them to more acceptable web formats that are easier for your visitors to load
- Compression: Compression saves bandwidth at the expense of CPU. The amount of bandwidth saved with page compression is minimal at best (usually less than 10%) and since our accounts come with so much bandwidth, it's not worth the extra CPU power consumed by the server compressing your pages before sending them. If you are using compression for your site, we recommend that you disable it.Upgrading
If your site is using a large amount of system resources it is not always indicative of something negative. If you don't receive a lot of traffic and your site is using a lot of CPU and memory, the problem is most likely a scripting issue. On the reverse, most successful sites start out on shared hosting and eventually outgrow that platform and need a more robust and dedicated solution.
Most customers with high-resource sites are able to stay within a V-dedicated system (256, 512, or 1024) for an extended period of time without requiring an upgrade to a Dedicated server, but some customers end up needing one or more dedicated servers to carry the load of their site(s). Our system administration staff will usually recommend a minimum platform for you based on your site's resource usage.
In most cases when you choose to upgrade we will handle moving your account over to the VPS or Dedicated server, and most moves do not result in downtime for your site(s).