Decreased performance on sustained load for PNG images.
Posted: 2018-07-01T22:20:41-07:00
Hi there,
I'm trying to build an HTTP based image processing service in Golang which will manipulate images on the fly based on query parameters in the URL of an image which is stored in an S3 bucket. ex: image.jpg?w=100&h=100
I'm using Imagick(https://github.com/gographics/imagick) which provides Go bindings to ImageMagick's MagickWand C API.
I load tested the service with a Golang load testing library with 200 requests/second for 120 seconds duration, the average response time is between 1.8-2.7s for JPG images. But when I tested this on PNG images, the response time starts increasing linearly and I start to face timeout errors in the load testing library. I tried to debug and found that reading the original image from disk and writing the processed image back to the disk is taking time and it is increasing with subsequent requests. I'm not sure why is this happening only with PNG images and not JPG images.
The only processes I'm applying right now are crop, resize, grayscale and compress.
PS: The disk is an SSD and I could've done the processing in memory but when such large requests are to be handled, memory is used up very quickly, so using the disk gave much better results here for sustained loads.
Version: ImageMagick 7.0.5-4 Q16 x86_64 2018-06-20
TIA
I'm trying to build an HTTP based image processing service in Golang which will manipulate images on the fly based on query parameters in the URL of an image which is stored in an S3 bucket. ex: image.jpg?w=100&h=100
I'm using Imagick(https://github.com/gographics/imagick) which provides Go bindings to ImageMagick's MagickWand C API.
I load tested the service with a Golang load testing library with 200 requests/second for 120 seconds duration, the average response time is between 1.8-2.7s for JPG images. But when I tested this on PNG images, the response time starts increasing linearly and I start to face timeout errors in the load testing library. I tried to debug and found that reading the original image from disk and writing the processed image back to the disk is taking time and it is increasing with subsequent requests. I'm not sure why is this happening only with PNG images and not JPG images.
The only processes I'm applying right now are crop, resize, grayscale and compress.
PS: The disk is an SSD and I could've done the processing in memory but when such large requests are to be handled, memory is used up very quickly, so using the disk gave much better results here for sustained loads.
Version: ImageMagick 7.0.5-4 Q16 x86_64 2018-06-20
TIA