Mongrel vs. Unicorn: A Surprising Benchmark Test Urban Impact

Mongrel vs. Unicorn: A Surprising Benchmark Test Urban Impact

Many designers who’ve been developing with Rails for longer than 3-4 years will keep in mind the Mongrel internet Server. Within the very early days of Rails development, Mongrel had been generally speaking considered the favored approach to option for Rails deployments, if for no other explanation compared to the proven fact that mod_ruby had been painfully sluggish. Skipping ahead a long period later on, we’ve got a much wider variety of alternatives for deploying Rails based internet sites. Such choices consist of slim, traveler, plus the ever popular Unicorn. By using these servers, Rails designers are now actually ruined by having a much simpler implementation procedure. Anybody who is knowledgeable about the definition of “stuck mongrel”, where a internet worker hangs and requirements become manually restarted because of the os, does know this discomfort.

This week I experienced the chance to assist a client upgrade one of the legacy systems up to a brand new webserver.

The website had been making use of Mongrel as the Ruby handler and we’d noticed an unsatisfactory number of 502 errors. These mistakes happened during durations of high anxiety where in fact the Mongrel employees had been overloaded and might perhaps not maintain with all the need of demands. We first attempted re solving the issue by enhancing the quantity of employees from 5 to 8. Anyone who’s done this before will probably notice that this is certainly a dual edged blade that may or may well not work. Enhancing the amount of workers will develop how many handlers in your pool, however these employees will eat more RAM and can later slow the system down.

After a few times of observing performance, we noted that the rise in employees had a web negative effect, therefore it ended up being returning to the drawing board. Just like legacy systems that are most, in which the notion of updating an extremely important component of a vintage system is approximately since welcoming as a supper invite from Jeffrey Dahmer, we wasn’t delighted in regards to the notion of ripping out of the old Mongrel webserver. Nonetheless, having done upgrades that are several Mongrel to traveler into the past, I’ve heard of performance improvements which can be skilled by changing Mongrel.

And so I put down to see just what type of performance gain i possibly could attain switching from Mongrel to Unicorn. We opted for Unicorn due to its rate benefits (forking, UNIX sockets), the good feedback it has gotten through the Rails community, and because I like Unicorns (yes, I’ve been known to buy a wine on the basis of the label).

My theory had been that a change to Unicorn should lead to a reduced normal response times and less 502 Bad Gateway mistakes. The things I discovered kept me personally scraping my mind and re-running performance tests over and over repeatedly until I became certain we wasn’t crazy.

To check my theory, we published tiny a test plan making use of Apache JMeter that accessed probably the most usually struck pages in my own internet application. The majority of these pages are look over hefty and cached (although lower than i’d like). Then, I went two 30,000 test tests up against the web web web site, comparing 5 mongrels then Unicorn utilizing a UNIX socket.

Here’s just exactly exactly what i discovered evaluating 50 users that are simultaneous a total of 30k examples per run:

WHAT?? The stark distinction in standard deviation positively perplexed me. It baffled me personally sufficient that We went the studies 5 more times, but every time We experienced comparable outcomes. What exactly is therefore astonishing is Mongrel, a host understood for stuck employees, done more consistently than its contemporary countertop component. Just just What troubled me personally nevertheless ended up being that I became not able to replicate the pesky 502 mistakes experienced into the manufacturing» alt=»malaysiancupid Log in»> environment. This informs me 1 of 2 things: either my test isn’t representative of real world traffic, or my staging host is certainly not affected by the memory that is same imposed with a cycle-sharing hosting provider like Slicehost.

There is absolutely no nugget that is golden of in this website post other than genuine shock that a mature little bit of technology nevertheless generally seems to last therefore well. It is no wonder why Thin, another web that is popular, utilizes Mongrel’s parsing engine. We arrived on the scene of the knowledge about a greater respect for my old, old buddy Mongrel.

No Comments
Post a comment

WhatsApp chat