Optimize your VPS Machines for maximum performance and reliability
VPS optimization overview
Optimizing your private server helps it to use less memory which saves you money as well as speeding up your websites. This article describes the steps to pinpoint and mitigate the source of any memory issues on a VPS.
How to optimize your VPS
Blocking abusive access
Common problems for sites are caused by search engine indexing bots hammering them. When search engine bots hit a site, they usually hit it pretty hard. Finding abusive bots like this can often be more of an art than a science, but you can get some data on this by analyzing the access.log file for your websites.
To minimize the issue of abusive bots, you should definitely set up a Robots.txt file. This file can help to control what bots are allowed to search and how often.
Preventing image hotlinking
Hotlinking is when a site other than your own includes an image in their site that is actually hosted on your server. They do this by directly referencing the image’s URL from your site in their own. This can cause massive problems for you if some of your hosted images are hotlinked in another popular site. Even a relatively low traffic site can cause poor server performance if this is the case.
Caching your site
As you’ve probably seen by now, PHP processes can take up a significant amount of memory. If your site is getting hammered with traffic, the fewer hits that have to spawn a PHP CGI process, the better. This can be accomplished by enabling caching on your site. Essentially, caching renders a PHP script and then “caches” that HTML output as a file. The next time that page is accessed, the server outputs the static HTML page, rather than process the PHP script again. The task of serving a static file requires far less memory and generally serves more efficiently, than the processing and execution of a PHP script. So if you’re having memory trouble on your PS, it’s essential that you confirm that you’re running software that has caching functionality and that you enable the use of this feature.
Also, if you expect a large volume of website visitors, you can enable Cloudflare. This is a service that OneHost Cloud partners with to add additional caching options for your websites.
Another improvement you can make in order to reduce memory usage is to turn on OPcache for your domains that run PHP-based sites. OPcache is a caching engine built into PHP. When enabled, it dramatically increases the performance of websites that utilize PHP.
If you’re running multiple instances of the WordPress software on your private server, you should definitely review the ‘WordPress Optimization’ category for detailed articles.
Make sure to do the following with each installation:
- Always run the most recent version of WordPress
- Install only essential plugins.
- Keep your plugins up-to-date.
- Remove/delete unused plugins as opposed to just deactivating them.
Confirm your active theme isn’t generating any errors in your error.log file (located in the same directory as the access.log).
If you have an older VPS and have enabled XCache in the past, please keep in mind that running a third-party WordPress caching plugin simultaneously with your panel’s XCache option can actually increase overall memory usage. It’s best to pick either one or the other for your caching needs.
Finally, compressing your image files improves loading time and reduces overall memory usage.
Hosting a website on a VPS has its benefits and with the right optimization methods you can have a fast and secure website with minimal maintenance. If a VPS is not for you then you can check our our Shared Hosting with cPanel. You can also view our VPS Hosting plans here for high performance cloud hosting.