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 DreamHost VPS.
How to optimize your PS
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.
View the following article for detailed information on how to check your access.log file and see who is hitting it the most:
Private servers are virtual servers running on a single host machine. The host machine controls IP tables for all private servers on it.
It's not possible to install and control your own custom IP tables on your private server while it's being managed by DreamHost.
If you wish to run your own custom IP tables, you must upgrade to a Dedicated Server and manually install this software.
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. To prevent this from happening, you can review the Preventing hotlinking article.
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 DreamHost 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.
View the following article for details on how to enable this feature:
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).
- View Optimizing Page Load Time and make sure you have a popular WordPress caching plugin installed and configured. For example, W3TC or WP Super Cache.
- Finally, compressing your image files improves loading time and reduces overall memory usage.
- Managing your VPS memory usage
- Private server overview
- Recovering from memory saturation
- Simulating high traffic
- Using the 'ps' command to troubleshoot your website
- Web server performance comparison
- How do I reboot my VPS?