Support » Fixing WordPress » Media Library is eating all my RAM & CPU

  • I was hosted with Dreamhost, however, I was running into constant 404s and 503s in the WordPress admin. Switching to PHP7 helped a lot but the whole site was still running slow and I was getting regular emails from Dreamhost saying one of my sites was using all the resources. Dreamhost was pretty evasive when I asked what the shared hosting server specs were but I gleaned that the shared hosting I had (with about 10 small sites on it) only had 256mb RAM shared over all of them.

    So time to switch hosts to something more local (I’m in New Zealand). New hosting gives me 256MB per cPanel account and the website in question ( is hosted on one. It also has access to one CPU core. (and PHP7)

    I used Duplicator to migrate to the new host. However the 404s and 503s were even worse. Removing Jetpack fixed those. However, the site is still running like a dog and the Media Library is unusable (503s many times especially with upload). In cPanel I can see that even just trying to load the Library (in list view) is causing the RAM and CPU to max out. Maxed out RAM = 503 Service Unavailable. I then have to wait a few minutes for the RAM to drop back down (usually sits at around 80/256MB.

    I have installed WP Smush (image optimisation), WP Rocket (caching and database optimisation/cleaning) and Cloudflare as well as following numerous optimisation tutorials to optimise the hell out of the site. But while the rest of the site has improved somewhat, the Media Library is still hideous (with and without WP Smush). I don’t have a huge number of media items (only 83).

    I have run P3 (after switching temporarily to PHP5.6) and it comes out as plugins being about 39% of the load which I personally don’t see as unreasonable. The two biggest contributors to load was WordPress core followed slightly by the theme (DIVI 3).

    This is incredibly frustrating as I can’t currently upload any images without getting a 503 (maxing out the RAM) and editing images to downsize them or crop, etc. is like watching paint dry.

    Advice please! I’m about ready to rip my hair out 🙁 TIA!

    • This topic was modified 2 years, 3 months ago by  .
Viewing 1 replies (of 1 total)
  • Karan NA Gupta



    So, I had a similar issue with a shared hosting server. The RAM kept maxing out. I do two thing which helped:

    1. Ensured that image sizes were not greater than 2000×2000 px. Lower the better. So don’t have images beyond 2000 pixels in width or height. They don’t work well with shared hosting. The image compressing plugins only come into play after the image has been uploaded, and there’s a lot of processing required to optimize these images. It’s best that you upload compressed images unless of course you need very high res images on the site.

    2. Tweak the PHP Memory limit:
    Find out where your php.ini is located for your hosting server. In my case I created one in the web root, and added the following settings: (the memory_limit setting is the important one).

    memory_limit = 256M
    upload_max_filesize = 200M

    If you don’t have access to php.ini you can try using wp-config or the .htaccess file.
    Here’s are links that show how you can increase the allowed PHP memory limit:

    Hope this helps.


Viewing 1 replies (of 1 total)
  • The topic ‘Media Library is eating all my RAM & CPU’ is closed to new replies.