我正在使用命令[1]将ImageMagick配置为用于PSD缩略图生成。它非常适合小尺寸的PSD,但是当处理2GB的PSD时,服务器的CPU和内存使用率将在几分钟内保持增加到100%,直到该进程被服务器杀死为止。
/etc/ImageMagick/policy.xml [2]上的配置无法控制CPU和内存的利用率。发生这种情况时,还要附加ImageMagick日志[3]。
服务器:CentOS 6.9、8核CPU,32G内存,500G磁盘
[1]转换一页。psd-flatten -thumbnail 1280x1280 thumbnail.jpeg
[2]
<policymap>
<policy domain="resource" name="temporary-path" value="/data01/imagemagick-tmp"/>
<policy domain="resource" name="memory" value="2GiB"/>
<policy domain="resource" name="map" value="4GiB"/>
<policy domain="resource" name="disk" value="50GiB"/>
<policy domain="resource" name="thread" value="1"/>
<policy domain="resource" name="throttle" value="5"/>
</policymap>
[3]
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Cache convert[1944]: cache.c/ClonePixelCacheRepository/842/Cache
Memory => Memory</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Resource convert[1944]: resource.c/RelinquishMagickResource/1069/Resource
Memory: 70224B/1.33725GiB/2GiB</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Cache convert[1944]: cache.c/OpenPixelCache/3778/Cache
open One-page.psd[0] (Heap Memory, 418x14x4 93632B)</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDLayer/1493/Coder
reading data for channel 1</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDLayer/1493/Coder
reading data for channel 2</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDLayer/1493/Coder
reading data for channel 3</event>
<event>2019-03-20T18:25:37+08:00 3:45.830 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>
<event>2019-03-20T18:25:37+08:00 3:45.840 14.550u 7.0.8 Coder convert[1944]: psd.c/ApplyPSDLayerOpacity/393/Coder
applying layer opacity 22873</event>
<event>2019-03-20T18:25:37+08:00 3:45.840 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDImage/2374/Coder
reading the precombined layer</event>
<event>2019-03-20T18:25:37+08:00 3:45.840 14.550u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>
<event>2019-03-20T18:25:39+08:00 3:47.980 14.660u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>
<event>2019-03-20T18:25:41+08:00 3:50.100 14.770u 7.0.8 Coder convert[1944]: psd.c/ReadPSDChannelRLE/1158/Coder
layer data is RLE compressed</event>