Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

AFAIK, the theory says multiply factor of 1 per CPU core to find out your optimal load average. So, server with 8 CPU cores optimal load average would be 8, 16 cores = 16 and so on. However, when using Imagemagick's mogrify I can see huge load average numbers:

top - 14:00:44 up 9 days, 20:12,  6 users,  load average: 130.37, 87.53, 56.94
Tasks: 588 total,  11 running, 577 sleeping,   0 stopped,   0 zombie
Cpu(s): 99.8%us,  0.2%sy,  0.0%ni,  0.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  49555072k total, 33129928k used, 16425144k free,  3813092k buffers
Swap: 23438824k total,    47276k used, 23391548k free, 26145156k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                    
29490 user1      20   0  121m  33m 2728 R  240  0.1   9:10.52 mogrify                                                                    
29337 user1      20   0  121m  33m 2728 R  234  0.1  12:01.94 mogrify                                                                    
29882 user1      20   0  121m  33m 2728 R  231  0.1   3:57.54 mogrify                                                                    
29232 user1      20   0  121m  33m 2728 R  223  0.1  11:34.54 mogrify                                                                    
29514 user1      20   0  122m  33m 2728 R  223  0.1   9:22.84 mogrify                                                                    
29689 user1      20   0  121m  33m 2728 R  219  0.1   7:28.18 mogrify                                                                    
29204 user1      20   0  121m  33m 2728 R  206  0.1  12:21.33 mogrify

As it is clear from top - no issues with the server. This behavior occurs only when call mogrify.

Why does it happen? How I can fix it or at least tune down a bit?

Thanks!

Edit: Usually they run that long. The server is responsive as usual. I am processing 618 images on average size 2.5 MB. The load is spread between few servers, which top outputs look very identical. I have read this thread which I am yet to test. Seems to me that mogrify (or Imagemagick) "overestimate" the CPUs. Hence the 200+% CPU usage per job.

share|improve this question
1  
These processes seem to be running for a very long time. Is this normal? –  jftuga Sep 16 '11 at 18:18
    
hm, didn't even notice that. 12 minutes is pretty long for automated image manipulation - are they really big images? –  voretaq7 Sep 16 '11 at 18:24
    
Please see the Edit above. Thanks! –  grs Sep 16 '11 at 19:06
    
Is ImageMagick multithreaded? top -H may help. –  Mark Wagner Sep 16 '11 at 19:26
    
Yes, it is multithreaded. I think the default is 8 threads per CPU core. –  grs Sep 16 '11 at 19:54

2 Answers 2

You are doing graphics processing. This is inherently CPU intensive.

The solution is to stop doing graphics processing, or at least do less of it - update whatever is calling mogrify so it can't run as many parallel tasks. If that isn't an option split the load (add another server and send some of the work there).


Note that if your load average is 130 and your system is still responsive and doing everything you need it to do in a timely fashion you don't have a problem, you have a "problem" (It doesn't look good, at a glance any sysadmin will tell you it's probably something bad and you should look at solutions like what I described above, but if it's not hurting anything and it doesn't get substantially worse as you scale up you may be able to ignore it as "normal for this environment").

share|improve this answer
up vote 0 down vote accepted

I found what the solution is. I ran tests against 2 versions of ImageMagick - 6.5.1 and 6.5.7. The old version comes with Ubuntu Karmic 9.10, the newer one with Ubuntu Lucid 10.04. Both 64-bit versions. I noticed the 6.5.7 version is faster than 6.5.1 and also does not load the server that much. It produced normal single digit load as one could expect. For both versions mogrify was multithreaded.

So, now I am satisfied. If I find some spare time will check what the exact difference is.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.