Server Resource Optimisation

9 Replies ·

  1. Hi

    I’ve been building a site for a while and I have configured many different plugins. I’m running into memory issues and fatal errors due to memory.

    I’ve got an optimised theme. I’ve updated all plugins, removed any that are not useful. All plugins I have are by reputable authors and are popular plugins with great support.

    I’m still running at 140mb without visitors!

    I have a caching plugin installed as well.

    I’ve used:

    P3 (Plugin Performance Profiler)


    and it shows a general spread across various plugins but nothing out of the ordinary!

    I’ve reduced image sizes, as well as optimised the database.

    The hosting provider can’t tell me what memory is used by each script.

    How would you recommend going through and optimising the site to reduce the memory?

    Any help is appreciated as I’ve been reading for ages and it just doesn’t seem like any of the solutions are working!

  2. fob

    Hi,

    first of all I would suggest to upgrade the web package in order to avoid trouble like this while working with an extended CMS and testing out new things. ๐Ÿ˜‰

    In Germany people often have trouble with memory consumption of language files (translations). Some seem to have additional trouble with significantly increasing memory consumption after switching from a 32bit system to 64bit. Sometimes it is just a a single upgrade that did not run smooth, especially when the web package is not powerful enough to complete.

    I think with “P3 Profiler” you checked out server load values only. Did you?
    In the past I had some good experience with “WP System Health”. It seems to be outdated. May be “TPC” can show you some more details about your plugin memory usage?

    https://wordpress.org/plugins/tpc-memory-usage/

    I remember someone from the German WP Forum who fighted and fighted against memory consumption issues. In the end he tried a fresh install and the problem was gone with the wind. I would suggest to try a manual reinstall to avoid missing files.

    Good luck!

  3. Justin Tadlock

    One thing to do is to deactivate individual plugins one at a time to see if there are improvements.

    I’m not sure what host you’re with either. Some Web hosts simply are not great at hosting WordPress. WP itself can be a memory hog, and if the hosting is not optimized for WP, things can go wrong.

  4. Lab41

    I’ve done each plugin one at a time.

    1) With all deactivated it’s showing it using 55mb RAM. (Using TPC memory usage), which seems quite high?
    2) I’ve gone with Siteground who are highly recommended wordpress hosts.
    3) What’s the best way to clean up an old database? (I’ve run an optimiser, but how do you clear out old junk, and snippets from deleted posts and plugins?)

  5. Lab41

    4) Can deactivated plugins use memory while deactivated?

    5) Is apache or lightspeed better for WP sites?

  6. Justin Tadlock

    1) With all deactivated itโ€™s showing it using 55mb RAM. (Using TPC memory usage), which seems quite high?

    I’m not sure what’s high or not. This isn’t really my area of expertise.

    2) Iโ€™ve gone with Siteground who are highly recommended wordpress hosts.

    I don’t think I’ve ever heard of them. Are you using their managed WordPress hosting service? I know managed hosting tends to have some limits on plugins you can use and other things. They should also be extremely familiar with WordPress and should be able to help you fix problems like this. Otherwise, I’d opt for different managed WP hosting (assuming you’re using their managed WP hosting service).

    3) Whatโ€™s the best way to clean up an old database? (Iโ€™ve run an optimiser, but how do you clear out old junk, and snippets from deleted posts and plugins?)

    I do a basic repair and optimize from the phpMyAdmin control panel. There may be plugins available to help clean out unused stuff, but I’m unfamiliar with most of them.

    One that I do like is: https://wordpress.org/plugins/wp-optimize/

    4) Can deactivated plugins use memory while deactivated?

    On the Plugins page in the admin or any page that checks for updates, they can. Otherwise, they shouldn’t. But, that also depends on the plugins that you have active too. Some plugins that look at other plugins (maybe like a profiler) may or may not look at deactivated plugins.

    In any case, it’s best to remove any unused plugins if you can.

    5) Is apache or lightspeed better for WP sites?

    I’ve only ever used Apache on Linux and Windows. I really can’t speak to how well anything else works.

  7. Lab41

    Thanks for the detailed response! It’s been a mountainous learning curve delving into site speed!

  8. fob

    Speeding up things is a never ending story. You can do a lot around the server and a lot more within the project itself.

    I recently ordered a new server and had a look at the network rollout before (peerings, routings, network latency, … of the new data center). On this server my customers will get some hard- and software upgrades to be better prepaired for SPDY and http 2.0:

    – NGINX PROXY in front of Apache,
    – SSD instead of SATA HDDs,
    – Hardware RAID instead of Software RAID,
    – stronger CPU,
    – much more RAM,
    – dedicated IP and SSL (if they like to follow the Google idea to speed up and secure everything),
    – …

    With NGINX (PROXY) and SPDY (http 2.0) on board “self optimization” (compression and tunneling) should work much better than before.

    NGINX will cache and deliver all the static files while Apache will only work on dynamic jobs. This way you can use and speed up existing software as it is, without having to translate configurations (e.g. .htaccess files) for new servers. It should work out of the box as it is.

    On the other hand you will have to rethink your CDN strategy (if existing).
    With http 2.0 server loads will massivly go down because browsers will be able to keep sessions alive. Data will be sent through a single connection instead of requesting CSS, JavaScript, pictures, … one by one.

    This is just to give you an idea what you could do on your server. Choose a good gateway/network, use modern hardware, have a look at the server configuration, (server) caching possibilities, …

    Some providers take care of these things, others do not (enough). But you could have a look for guarantees regarding dedicated server ressources for yourself. For example:

    – available RAM (system),
    – how many server neighbours on your IP (that might use required ressources),
    – php_value upload_max_filesize
    – php_value post_max_size
    – php_value max_execution_time
    – php_value max_input_time

    If there are hundreds of users using the same server ressources you can run into trouble quick and easy.

    Well – if you compressed your scripts already, cleaned up the database, used caching plugins, uninstalled non used plugins, decreased file sizes and picture sizes (may be used CSS sprites already), debugged and checked the project for broken links, I am running out of ideas. May be it`s easier to find a good host (preferably with an IP range from your region to be prepared for “SPDY auto optimizations”.). ๐Ÿ˜‰

    But – if your database is very old you might want to trim it as well. Is it UTF-8 encoded already? Does it use innodb (or mixed values)? Does it show any errors (e.g. a missing index)? You can see all that with phpMyAdmin. Possibly you also find tables in the database that have not been deleted from the plugin automatically when you tried to uninstall that plugin. Delete it now. May be it helps. Sometimes people have a lot of unnecessary MBs from old installations in the database. Deleting it can bring things back to speed – but you should try the normal way to uninstall the plugin first. If you make use of a redirection plugin – by the way – you should delete their histories from time to time. Some plugins blow up the database continuously.

  9. Lab41

    @fob – great write up! Thanks. Super appreciative!
    1) Do you know how to measure ram usage of various scripts and plugins on a shared environment? (3 separate hosts said they can’t provide this info)

    2) Using a linux server, how do you get around cpanel. (I’ve tried zpanel as well but for clients I want something more robust)

    3) I think that part of the issue could be a heavy theme and quite a few plugins. BUT I need all the features. But still shouldn’t be hitting these issues. According to TPC Memory Use (plugin) it shows that theme without plugins runs at 30mb.

  10. fob

    Hope it helps. ๐Ÿ˜‰

    1) and 3)
    It`s like Justin said. If you know that your system runs at 30MB (may be twice too much, I do not know your system) with no plugin you can activate one by one and find the difference.

    The difference should be the same on shared and dedicated environments. In the end you know the memory consumptions of all plugins. (I thought that I have checked issues like this with a plugin years ago that showed me memory consumptions of every single plugin. Thougt it was “WP System Health” but may be wrong. Current plugins seem to show overall values only but can be helpful, too.)

    2) I owned a Confixx Licence before and now prefer Parallels 12 ( http://download1.parallels.com/Plesk/PP12/12.0/release-notes/parallels-plesk-12.0-for-linux.html ). Unfortunatelly “Plesk” bought “Confixx” and stopped development of the competitors product. I did not feel very well with open source products as they seem not to be very comfortable for clients in the current stage. Software from Parallels is known as stable and secure – and seems to work very well: http://benmay.org/2013/10/06/super-fast-wordpress-hosting-using-plesk-11-5/ . ๐Ÿ˜‰

    Edit: If you have a lot of theme modifications you could try to combine them in javascripts and load important things (html, etc.) with a higher priority. You can even use Google Performance Tools ( https://developers.google.com/speed/pagespeed/optimization?hl=de ) and/or Firebug https://addons.mozilla.org/de/firefox/addon/firebug/ ) to find more issues.