Home >Backend Development >PHP Tutorial >How to solve the problem that imagick causes the CPU to surge to 100% when running in multiple threads

How to solve the problem that imagick causes the CPU to surge to 100% when running in multiple threads

WBOY
WBOYOriginal
2016-07-29 09:08:451169browse

If you install imagic to the /usr/local/imagemagick directory

First use the /usr/local/imagemagick/bin/convert -version command to check whether the output content has multi-threading enabled. The value of Features: is null or DPC It indicates that it is single-threaded. If the value of Features: is openMP, it indicates that it is multi-threaded. There is a bug in the multi-threaded mode of imagick, which will cause the multi-core CPU usage to instantly surge to 100%. So be sure to use its single-threaded mode. The process mode will work.

解決 imagick 在 多线程运行时导致CPU暴增到100%的方法

The above is the result displayed when I configure it correctly. If it is not configured correctly, the result below will be displayed

Version: ImageMagick 6.8.9-10 Q16 x86_64 2015-12-28 http://www.imagemagick.org

Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC

Features: openMP

The first result is single-threaded mode, and the second result is multi-threaded mode. Because the multi-threaded mode of imagick has a bug, so if you first installed imagick in multi-threaded mode, you must yum remove imagemagick. Just uninstall it and reinstall it.

Just add the red font part below when installing

./configure --prefix=/usr/local/imagemagick --disable-openmp

The above introduces the method to solve the problem of imagick causing the CPU to surge to 100% when running in multi-threads, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn