I am running ImageMagick under RedHat Enterprise, executed by a java process and am running into a odd performance issue.
I wrote a java test that reads an image, then spawns a thread with the image content. That thread does an identify, and then a -resize 111x111 on the image. All identify and convert commands are executed through carefully constructed exec() calls using only the stdin (to stream the image to "convert -") and stdout (to stream the results back from convert to the java thread). There is no file IO on the java side other than the initial read of the image (once).
This works great under light loads, but as soon as the thread count goes up, the load increases almost exponentially and throughput goes way down....for example:
1 thread running 200 times : Average call time : 65ms, Total completion time: 13076ms (not too bad)
2 threads running 200 times : Average call time : 326ms, Total completion time: 32681ms (much slower!)
4 threads running 200 times : Average call time: 806ms, Total completion time: 40374ms
8 threads running 200 times :Average call time: 1952ms, Total completion time: 49108ms
So from the numbers above, it looks like processing requests serially gives us the best performance.....We did not expect this. It would seem that each convert process is possibly contending for some (common?) resource and slowing down every other convert process. The system we are running on has 32GB and has 8 cores....so I don't think it's CPU or memory.....but I'm not 100% sure overall.
Thanks for any help / ideas. (we cannot use JAI/Java2D and JMagick is too unstable). Let me know if any other info might be helpful.
Alan.
Below are some details if they are helpful.
- ImageMagick-6.5.4-6 (and we tried 6.4.1 as well)
- Java version 1.6.0_14-b08
- Red Hat Enterprise Linux Server release 5.3 (Tikanga)
- The photo we're converting is JPEG 640x480 640x480+0+0 8-bit DirectClass 61kb
- The convert command being called from java is "convert -quiet - -resize 111x111 -"
- We compiled ImageMagick with : ./configure --enable-shared --enable-static --disable-ltdl-install --disable-hdri --with-dps --with-bzlib --with-jpeg --with-png --with-tiff --with-zlib --with-modules --with-xml --with-x --without-perl --without-fpx --with-gslib --without-jbig --without-jp2 --without-lcms --without-wmf --without-gvc --without-rsvg