Support » Plugin: TinyPNG - JPEG, PNG & WebP image compression » TinyPNG uses too much CPU

  • Resolved felixprojekt


    I am using TinyPNG on many sites for a long time and I absolutely love it.

    Uploads are not processing automatically on the background in my case which does not bother me, and once in a while I just hit the bulk optimisation button.
    The script then goes through the unoptimised images, takes 5 and sends them to the API. Now that creates 5 processes on my web server, each lasts around 18 seconds and each takes about 80 MB of RAM. Now that’s 400 MB of RAM, even I have virtual SSD hosting with 1GB of RAM, with additional traffic on other domains, whole virtual machine resources can easily get exhausted and all domains starts to return 503. Once I stop bulk optimisation, sites come back online.
    I know that this could be solved by upgrading my HW, but I feel that this could be troubling to some people on lower HW configurations. I would be happy if the plugin allowed me to set maximum number of parallel connections as a trade-off to slower bulk optimisation but less overload on the hosting.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TinyPNG


    Hello @felixprojekt

    Thank you for writing us!

    >Uploads are not processing automatically on the background
    Is this the case even when you have the “Compress new images in the background (Recommended)” option selected? Just wanted to check if this was something you turned off or if it’s simply not working for you.

    Could you tell us a bit more on how you measured this? For example, it would be nice to know what OS you are running and what you use to run WordPress.

    With that information we could potentially setup a similar environment and use that for future improvements. I can understand the need for this so I will add it to our future improvements but I can not promise you when or if this will be implemented right now.

    However, as a workaround for now, I think you should just be able to set “parallelCompressions = 1;” instead of “parallelCompressions = 5;” in /src/js/bulk-optimization.js

    I noticed that I had to refresh the bulk optimization page an additional time to see the correct amount of images but otherwise it seems to work. Can you give it a try as well perhaps?

    Thread Starter felixprojekt


    >Uploads are not processing automatically on the background
    Even when I have “Compress new images in the background (Recommended)” selected. I haven’t found yet any pattern in that, however it does not bother me so much.

    The solution which you proposed works great and solves the problem, thank you so much! 🙂

    I am running my sites on 1 core, 1 GB RAM, PHP 7.3 Apache virtual SSD hosting. I think the problem is that if I send too many parallel requests, the server just can’t take that.

    Would be nice to let’s say detect 503 errors in responses (forgot to mention that, but TinyPNG itself falls to “Error” response in approx one in 7 compressions when running on 5 parallel compressions) and if yes, send fewer parallel requests. But this little hack of changing it in JS works fine for me now 🙂


    Plugin Author TinyPNG



    Glad we could help you out!

    We will write this down for improvements and see what we can do about this in the future. For now it’s good to know that you are able to work with what you have 🙂

    If anything else comes up meanwhile, please let us know!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘TinyPNG uses too much CPU’ is closed to new replies.