Mongrel vs. Unicorn: A Surprising Benchmark Test Urban Impact

Mongrel vs. Unicorn: A Surprising Benchmark Test Urban Impact

Most designers who’ve been developing with Rails for longer than 3-4 years will recall the Mongrel internet Server. During the early days of Rails development, Mongrel was generally considered the favored approach to option for Rails deployments, if for no other explanation compared to the proven fact that mod_ruby ended up being painfully http://datingmentor.org/nl/be2-overzicht sluggish. Skipping years that are ahead several, we’ve got a much wider array of choices for deploying Rails based web sites. Such choices consist of slim, traveler, additionally the ever popular Unicorn. With one of these servers, Rails designers are actually ruined with a easier implementation procedure. Anybody who is knowledgeable about the word “stuck mongrel”, where a internet worker hangs and needs to be manually restarted by the operating-system, knows of this discomfort.

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

The website had been utilizing Mongrel as the Ruby handler and we’d noticed an unsatisfactory number of 502 errors. These mistakes took place during durations of high stress where in fact the Mongrel employees had been overloaded and may perhaps perhaps perhaps not maintain using the need of needs. We first attempted re re re solving the situation by enhancing the amount of employees from 5 to 8. Anyone who’s done this before will probably observe that this might be a dual edged blade that may or may well not work. Enhancing the wide range of employees will develop the amount of handlers in your pool, however these employees will eat more RAM and can later slow straight down the system.

After a few times of observing performance, we noted that the rise in employees had a web negative effect, so that it had been back again to the board that is drawing. Just like legacy systems that are most, where in fact the notion of updating an essential component of a classic system is approximately because welcoming as a supper invite from Jeffrey Dahmer, we wasn’t delighted concerning the notion of ripping out of the old Mongrel webserver. But, having done a few improvements from Mongrel to traveler in past times, I’ve heard of performance improvements that may be skilled by changing Mongrel.

And so I put down to see just what form of performance gain i possibly could attain switching from Mongrel to Unicorn. We decided to go with 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 acquire a wine in line with the label).

My theory had been that a change to Unicorn should end up in a lesser response that is average and less 502 Bad Gateway mistakes. The things I found kept me personally scraping my mind and re-running performance tests over repeatedly until I happened to be certain I wasn’t crazy.

To evaluate my theory, we composed small a test plan Apache that is using JMeter accessed probably the most usually struck pages in my own internet application. The vast majority of these pages are look over hefty and cached (although lower than i would really like). Then, I went two 30,000 test tests contrary to the web web web site, comparing 5 mongrels after which Unicorn utilizing a UNIX socket.

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

EVERYTHING?? The stark difference between standard deviation positively perplexed me. It baffled me personally sufficient that We went the studies 5 more times, but each and every time We experienced similar outcomes. What’s therefore astonishing is the fact that Mongrel, a host understood for stuck employees, performed more consistently than its contemporary countertop component. exactly just exactly What troubled me personally nevertheless had been that I happened to be struggling to replicate the pesky 502 mistakes experienced when you look at the manufacturing environment. This informs me 1 of 2 things: either my test just isn’t representative of true to life traffic, or my staging host just isn’t affected by the memory that is same imposed with a cycle-sharing hosting provider like Slicehost.

There is absolutely no golden nugget of truth in this website post apart from genuine shock that a mature bit of technology nevertheless seems to last therefore well. It is not surprising why slim, another popular internet host, utilizes Mongrel’s parsing engine. We arrived of the experience with a better respect for my old, old buddy Mongrel.