High CPU usage when I got some traffic in my site


I recently created this thread Load images from CDN, finally I fixed it doing a replace of the link that Liipimagine bundle uses to /media/cache/products URL.

But now I got a real problem that is affecting to the performance of my site. Each time that the system does a GET request to an image, It’s using a lot of CPU, like 5% per request average, I got an S3 instance in AWS and sometimes the statistics shows 300% of CPU usage, when I got like 50-60 users in the site watching products at the same time.

How I can reduce this CPU usage on each GET request to an image?

That probably means that LiipImagine bundle isn’t caching the images, or is not able to get the cached images and does the processing for every request.
It may be a side effect of the changes you did to make the CDN work, or at least you thought so.

1 Like

Hi vvasioli,

Before making these changes I was getting in the logs the following:

Now, after adding the change of the CDN, we see that the network usage has been reduced but this still happenning.

I can’t post two images because I’m new in the forum, but as you can see here, this is after the CDN change:

This screenshot is just taken right now and we got low traffic at this time, it’s early in the morning. In this screenshot I marked only the pictures, the “/ajax/get_variant_color_image” it’s a custom thing, so it’s not Sylius or Liip thing in this case.

@RightN I see that there’s high CPU usage on requests to /files/products, what’s going on there?
My suggestion would be to run this through a profiler and see what code consumes so much CPU.