Limiting threads does not work

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
CodingFabian
Posts: 1
Joined: 2014-05-20T04:38:07-07:00
Authentication code: 6789

Limiting threads does not work

Post by CodingFabian »

Hello, we are using the following version of IM

Code: Select all

root@node01:~#  /usr/bin/convert -version
Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-13 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype jng jpeg lcms ltdl pangocairo png rsvg tiff wmf x xml zlib
we observed the CPU on our system to spike for some conversions (its kind of an automatic conversion service, so all kinds of input formats come in)

output from top:

Code: Select all

17909 tomcat    20   0  381m  93m 2200 R 943.2  0.1   4:15.34 /usr/bin/convert -limit thread 1 -density 200 -auto-orient /tmp/docsrv/ocr_5049072737348653187 -auto-level -sigmoidal-contrast 5x10% -colorspace gray -depth 8 PNG:/tmp/docsrv/ocr_2196984853346712117.png
As you can see we invoke it with -limit thread 1, but the CPU% used goes to 943%. This is a 24 core system, so IM is using about 9 cores.

We also tried to use the environment variable, but the result was the same.
Can you give any pointers for debugging? We would like to have 1 or 2 threads. right now we are considering to recompile without OpenMP.
sted
Posts: 2
Joined: 2014-06-02T07:09:42-07:00
Authentication code: 6789

Re: Limiting threads does not work

Post by sted »

I have exactly the same issue and I get crazy about this.

Webserver with Centos 6.5 final, and plesk 11, convert started from bash script (it's full of MAGICK enviroment variables :)
env command is showing MAGICK_THREAD_LIMIT=8 (imported from etc/enviroment)

"
uid=$5
export MAGICK_THREAD_LIMIT=8
for img in ${path}*.png
convert ...
"

Code: Select all

Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-20 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC Modules OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jng jpeg lcms ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
8 cores and magick only uses 4 of them :(

system ("convert -list Resource")

File Area Memory Map Disk Thread Throttle Time
--------------------------------------------------------------------------------
768 1GB 2GiB 4GiB unlimited 8 0 unlimited


Cpu0 : 1.0%us, 1.3%sy, 0.0%ni, 97.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu1 : 59.8%us, 10.3%sy, 0.0%ni, 29.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu2 : 1.0%us, 0.7%sy, 0.0%ni, 98.3%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu3 : 50.0%us, 2.6%sy, 0.0%ni, 47.4%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu4 : 1.0%us, 0.3%sy, 0.0%ni, 98.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu5 : 23.3%us, 1.0%sy, 0.0%ni, 75.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu6 : 0.7%us, 0.3%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Cpu7 : 32.7%us, 9.7%sy, 0.0%ni, 57.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8183616k total, 1503160k used, 6680456k free, 214636k buffers
Swap: 4194288k total, 0k used, 4194288k free, 515948k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
30847 vva 20 0 364m 225m 2780 R 50.1 2.8 0:01.51 convert
Post Reply