02.10.07
Goodbye RMagick. Hello ImageScience.
by Ben Myles
I’ve always known RMagick was a memory hog, but never realised just how bad it is. I’m not sure if the problem’s RMagick or ImageMagick, but either way, it’s a problem. Here’s the story.
Recently, I setup some generous memory limits on our servers to catch any out of control applications from gobbling up the servers memory and bringing everything down. I thought 200MB per Rails process was quite generous, and for the most part it has been.
Today I found out that one of our client’s was having some trouble uploading images in their application. I quickly found the culprit:
Magick::ImageMagickError (Out of Memory! `'):Huh? These weren’t big images the client was uploading. Just tiny, less than 100KB PNG ’s. But something must have went terribly wrong to hit that memory limit. To find out just how bad it was I removed the memory limit and watched the Rails process in top. Within a few seconds it was over 400MB and growing. Needless to say, I quickly killed it.
Since we’re already using attachment_fu I solved the problem without changing a single line of code. I headed over to the ImageScience website, followed the instructions to install and restarted the application. Uploading now works perfectly, and memory usage barely moves.
Unfortunately (or maybe fortunately), ImageScience is pretty slim on what it can do. It generates thumbnails. What we need now is something with the power of RMagick+ImageMagick that’s quick, light on memory and relatively bug-free. Any ideas?
Comments
There are no comments.
Leave a Comment