-1

We are experiencing quite a high CPU load on our web server right now

(I'm just doing some research, I am not actually the website's administrator)

One of the most significant changes has been a new search results page with larger thumbnail images (25 per page by default). Instead of creating a new, larger thumbnail size, the developers have (for now) actually just used the full sized images at a smaller height and width – apparently because creating a whole new thumbnail size was a fairly big project

I am suspecting that this is the cause for our CPU spike, but I'm not sure - I'd like some information to share with them about it

Could someone confirm and/or explain that constantly delivering significantly larger files could cause an increased load on the CPU, and why?

For reference we have ~2,000,000 images on the website and the size of the thumbnails went up from perhaps 7kb to maybe around 30-40kb on average – individual search results pages roughly doubled in byte size overall

For traffic, we usually have about 200 concurrent users or around 150,000 pageviews per day

Update: It's funny that I should have asked this question today, because a project to create new appropriately sized thumbnails has begun this morning.

Drewdavid
  • 115
  • 4
  • Operating System? Web Server? Logs? Profiling information? –  Jul 08 '14 at 16:35
  • Hi :) Linux | Apache | Don't have | Don't know what you need – Drewdavid Jul 08 '14 at 16:47
  • Curious why the down votes? – Drewdavid Jul 08 '14 at 16:48
  • See [How Can I Ask Better Questions?](http://meta.serverfault.com/questions/3608/how-can-i-ask-better-questions-on-server-fault) for general guidance. –  Jul 08 '14 at 16:53
  • http://meta.stackexchange.com/q/66377/189912 – Michael Hampton Jul 08 '14 at 16:54
  • 2
    @Drewdavid BTW, not creating thumbnails of the actual size creates some other problems: the load time for the visitor is longer, especially when mobile, plus the images will look worse, because the scaling algorithm in browsers is a fast, but ugly one. – Halfgaar Jul 08 '14 at 16:54
  • Something like ImageMagick could automate the creation of thumbnails. Scaling big images down is often silly and seems like a bad choice. Also ++ to the NGinx suggestion below. – mfinni Jul 08 '14 at 16:55

1 Answers1

1

We would need more information for an informed answer, as kce asked, but I'm going to assume it's a PHP+Apache site.

Are you sure you're counting CPU usage, and not load? The load is the amount of processes that are active. That can very well increase by having Apache workers keep busy sending images. If that's the case, the load increases, but the CPU usage doesn't really. A monitoring tool like Munin will show this nicely in graphs.

A good way to address this issue is install a reverse proxy, like Nginx, configured to serve the images. Not only is Nginx very good at static file serving, but it also keeps you Apache workers free to do real work.

Halfgaar
  • 7,921
  • 5
  • 42
  • 81
  • Thanks, I edited my question to be a bit more specific. Sounds like "load" is the better word then, I didn't realize they meant different things :) – Drewdavid Jul 08 '14 at 16:51