I have an application that uses Imagemagick's convert utility to resize images. The application has an API exposed which executes a convert command for each request. The application usually serves ~20 requests/s but can spike to upto 200/s. I want to limit the overall memory that Imagemagick's multiple convert processes take.
I have explored setting of resource limits for memory, map and disk in Imagemagick but all these settings seem to apply for per-convert execution. Haven't found any configuration to restrict overall/total usage of multiple simultaneous convert executions.
I have also explored setting config at OS level like ulimit. But these seem to be at process ID level. My need is to restrict total memory of all parallel convert processes.
So I have 2 questions,
- Does imagemagick have some configuration that will allow me to do it?
- If no then how can I achieve this on a Kubernetes pod running on Centos.
Do note that the convert process is executed for each API request received and terminates after processing the image. So each API request executes a new convert command.