I didn’t have a clue what server memory usage meant when I was shopping for a server. I never even considered it. The storage space the host offered was so huge, I assumed I could put 50 accounts on one server and everything would be fine. Until I ended up having problems with repeatedly crashing servers and forced reboots.
I didn’t know that all 40MB of a website’s WordPress files were requested from the server when someone landed on a page. Add a calendar and shopping cart, and the size can easily jump over 100MB per site every time a visitor lands on a page.
I had 14 different websites on one server with 768MB of memory. 13 of these had WordPress installations. Do the math and collectively the sites on the server were sucking up two-thirds of the available memory.
If people were visiting all those sites at the same time, that left only 250MB of memory for functions, like shopping carts. When sites spiked, it would overrun the total memory available. I started having problems with high server memory usage when the server crashed (repeatedly). And the host would reluctantly force a reboot of the server.
The hosting company (excellent customer service department) suggested that I
- optimize the databases
- add a caching plugin
- delete unused or replace inefficient plugins
- optimize the theme
- and, of course, upgrade to a plan with more memory
I was tempted… but I knew that if I simply upgraded to a larger plan, the inefficiency of my sites would eventually crash the server again. I had become a ‘digital hoarder’, leaving everything I ‘might’ need on the server. It was time to learn how to optimize my sites.
These ‘suggestions’ for improving server memory usage scared me because I was unfamiliar with them. But once I found the right tools, the first success spurred me on. Since then, there have been no more forced reboots. This is how I cleaned up my server memory usage.
Tools I Used to Clean Up Server Memory Usage
BackWPUp: Optimize the Database
I love this plugin. Not only does it back your files up on a schedule you choose, it optimizes the database. The backups can be stored on the server, on Dropbox, CDNs, or emailed. There is very little configuration to do. Just install BackWPUp, set up a schedule and choose your backup plan, what to do with the backup. It also deletes old backups in the folder as it uploads new ones. Use a free Dropbox account and upload the backups into separate client folders.
DB Cache Reloaded Fix & Hypercache: Cache Your Pages
I found WP Super Cache and WP Total Cache way over my head – too much ‘stuff’ I was clueless about. Then I came across DB Cache Reloaded Fix on a European host – it was added to all WordPress installations by the hosting company. This little plugin can reduce the HTTP requests by 70%. That takes a tremendous load off the server. Another simple installation. And another bonus is that it works with Jigoshop. I also use Hyper Cache in conjunction with DB Cache Reloaded Fix.
P3 Plugin Profiler: Find Out Which Plugins are Dragging
The P3 plugin can be used temporarily to show you which plugins take a long time to load. Also, you are shown exactly how many requests to the server are being made. And what percentage of your load time is due to plugins. It’s extremely satisfying to run this plugin, and then add a caching plugin to see what a huge difference it makes.
Granted, some plugins are very large and they might provide a functionality you need. I found that popular event plugins and shopping carts are all about the same size/load time. So I concentrated on either replacing or eliminating other plugins.
Where I could add a code snippet instead of a plugin, I did so. Google Analytics code, for instance, can be added directly to the header.php file, or in the case of Genesis themes, into the header scripts under Theme Settings.
The Genesis Theme Framework, Plugins and the Fabulous Dynamik
Finally moving to Genesis was the smartest thing I’ve done. I called Genesis ‘The Big Boys Club’, where coders and programmers hung out. The forum was intimidating. I knew it was the best theme framework available because it was used by so many big bloggers. But I spent the first year heavily dependent on Firebug in Firefox, tweaking the CSS so I could get sites looking the way I wanted. Until I discovered the fabulous Dynamik theme builder for Genesis…
Several contributors to the Genesis forum build plugins for Genesis, so I tried to stick to their plugins. Then Dynamik provided ways to widgetize the homepage, edit the footers, really make a site mobile responsive for different screens, and offered 800 design settings for the most minute details, including sidebars. Heaven. I eliminated all extraneous plugins and do add a few code snippets to center the navigation menus or header, or CSS to add colored content boxes.
Other Fixes to Free Up Server Memory Usage
After looking at my sites, I realized there was more I could do for my clients to help server memory usage. I learned how to:
- re-size and compress images
- delete old emails from the server
Some clients upload images directly out of a camera that can be over 3500px wide – each image could be over 1MB. The larger the image, the larger the image size and the slower it loads. Put 50 items in a shopping cart with an image-heavy blog and this can add a massive load on the server. Imsanity prevents uploads larger than a size you specify. If the content area is 800px wide, that’s the maximum width an image needs to be. In addition to preventing huge image uploads, this plugin will also bulk re-size images that have already been uploaded. And you can control the image quality level. WordPress defaults to 90% quality; Imsanity lets you bring it up to 100% where images are important on a site. Nice.
Another way to reduce image size is to compress them. There are free sites that will compress pngs or jpgs. This can reduce the image size 60% to 80%. I use PNGs for my headers so TinyPNG.org was a godsend. But not only does this save memory, it speeds up the loading of the header.
Some email accounts held over 250MB of old emails! As a service to clients, I set up email accounts in the cPanel and then set up forwarders to their regular email. This meant that their site would store emails until they were deleted, only sending a copy to the client. For a while, I manually deleted the old emails until I figured out how to set up email accounts correctly.
To forward mail to another account without saving mail on the server, just create a forwarder instead of a regular email account. If the email account already exists, you can delete it in cPanel and just use the Forwarder. Afterward, all mail will be forwarded to the client without saving anything on the server. Voila! Server memory usage improved.
I should mention Pingdom.com which retrieves the files from a site and lists them for you in the order they are called up, showing you exactly how long each file took to load. What I found was that a Facebook ‘banner’ which I happened to love (the one with all the Friends faces on it) took forever to load. I decided to eliminate that banner and simply replace it with an image of the banner, linking it to the client’s Facebook page. Okay, it’s not ‘live’ or ‘up to date’ with all your Friends faces, but it does the trick of adding human faces to an otherwise image-light site.