CPU spikes when users are uploading images XF1.1


Well-known member
I've just run into an issue on 1.1 and I wondered if anyone else has seen this and what they may have done to resolve this

I was visiting the forum (and there were only about 3 other users on it at the time), one user was uploading images...

and then I saw a 505:

Resource Limit Is Reached
The website is temporarily unable to service your request as it exceeded resource limit. Please try again later.

The host was great (Clook...they use xenforo), they also gave me more information:

It actually looks like the PHP limits were hit while uploading a Flash attachment from <ip address> at about 9:30.
(this was the user that was uploading images)

(It's a shared host, I've contacted them and they have now increased the post_max_size from the default of 8M to 16M)

It sounds like the image conversion can cause processor spikes,is there anything that can be done for that now?
The increase in post_max_size might have fixed this issue for me for now, but I think others might also run into this

Jake Bunce

XenForo moderator
Staff member
This might not be fixable. Shared servers have limited resources. Generally you need to upgrade to a better server if you are having resource problems on a shared server.

If it's a problem with your image processor then you can try switching to a different processor if one is available:

Admin CP -> Home -> Options -> Attachments -> Default Image Processor


Well-known member
Could it be possible that the spikes occurred while trying to covert/compress particular types of images (for instance, large images... and a the CPU limit was hit)

... this sounds to me like a very easy way for people to bring down XF (particular those on shared servers). I have another account using the same host (with 2 sites on the same account, one VB and one myBB), I've been running it over 4 years and not had this problem

If XF is more processor intensive, that's fine.. but this is a CPU spike (it happened with a particular event), just limiting the size of the upload should reduce the chance of this happen (it's obviously more processor intensive to create smaller versions and compress images if they are large)

The file sizes that were successfully uploaded were all less than 50kB, so that's worrying (I don't think it would be reasonable prevent images less than 50KB)
These are the images that were uploaded when the spiked happend:

I'm not sure if it spiked while trying to upload a particularly large one, but as you can see, none of those that were successfully uploaded were particularly large.

I'm going to try to reproduce this by monitoring the processor with proc-exp using these particular images (but I only have a windows box to test on)
This sounds like it could be a bug ...

Jake Bunce

XenForo moderator
Staff member
It's all speculation at this point.

Your host says you exceeded a PHP limit. Did they say which limit you exceeded? Resizing large images can be memory intensive. If the process exceeds the memory_limit in PHP then you will get an appropriate error in which case you can increase the limit.

I'm going to try to reproduce this by monitoring the processor with proc-exp using these particular images (but I only have a windows box to test on)
That's a good idea. If you can reproduce the error then we can narrow down the cause and hopefully get a meaningful error message.