adsense728x90


ImageMagick policy.xml으로 resource 제한하기 CVision

ImageMagick이 html, svg등은 convert하지 않게 만들기

ImageMagick이 자기 맘대로 resource막 다 써버리면 곤란하므로 제한하기


area는 용량이 아니라 크기였네. 이 것보다 크면, memory가 아닌 disk에 cache하나보다.
MAGICK_AREA_LIMIT
Set the maximum width * height of an image that can reside in the pixel cache memory.
Images that exceed the area limit are cached to disk (see MAGICK_DISK_LIMIT) and optionally memory-mapped.

area, map 차이를 잘 모르겠다. disk에 저장은 하면서, memory mapping을 하는 건가보다. 단, map limit이 넘지 않는 선에서.
MAGICK_MAP_LIMIT
Set maximum amount of memory map in bytes to allocate for the pixel cache.
When this limit is exceeded, the image pixels are cached to disk (see MAGICK_DISK_LIMIT).

memory 용량 제한을 하더라도, disk에서 처리를 하네.
MAGICK_MEMORY_LIMIT
Set maximum amount of memory in bytes to allocate for the pixel cache from the heap.
When this limit is exceeded, the image pixels are cached to memory-mapped disk (see MAGICK_MAP_LIMIT).

memory 단위는 MiB, GiB를 쓰는 게 더 좋겠다.

disk limit이 최종 용량 limit이 되겠다.
MAGICK_DISK_LIMIT
Set maximum amount of disk space in bytes permitted for use by the pixel cache.
When this limit is exceeded, the pixel cache is not be created and an error message is returned.



2048x2048 image이면, load 에만 16MB는 쓰겠다.
>>> 2048 * 2048 * 4 / 1024 / 1024
16

policy.xml이 -limit 으로 command에서 제한하는 것보다 더 hard한 limit이다.
너무 심하게 제한하면 안되겠다.



CPU should be 100% otherwise its idle and not working. However, to reduce CPU usage, set the throttle resource policy in policy.xml or set the MAGICK_THROTTLE environment variable. See http://www.imagemagick.org/script/resou ... nvironment.


덧글

댓글 입력 영역