Unicorn (web server) explained

Unicorn
Author:Eric Wong
Developer:Unicorn developers
Latest Release Version:
Programming Language:Ruby
Operating System:Cross-platform
Language:English
Genre:Web server
License:GPLv2+ or Ruby 1.8
Repo:yhbt.net/unicorn/

Unicorn is a Rack HTTP server to serve Ruby web applications on UNIX environment. It is optimised to be used with nginx. It is based on now deprecated Mongrel 1.1.5 from 2008.

Architecture

Unicorn uses a master/worker architecture, where a master process forks worker processes and controls them. The application runs in a single thread.

Reception and use

Unicorn was considered as “one of the most popular servers for Rails”.[1] [2]

Twitter started to test Unicorn in 2010.[3]

This server is shipped with Discourse. Their system administrator Sam Saffron noted Unicorn was reliable, as it reaps unresponsive workers.[4]

Unicorn inspired other projects like Gunicorn, a fork to run Python applications.

As of 2018, projects tend to favour Puma.[5] The Heroku hosting provider recommends since 2015 to migrate from Unicorn to Puma.[6] Deliveroo published a benchmark comparing the two servers and concluded “Puma performs better than Unicorn in all tests that were either heavily IO-bound or that interleaved IO and CPU work”, but that Unicorn was still slightly better performing in pure CPU situations.[7] GitLab switched to Puma from Unicorn in 2020.[8]

References

  1. Ruby Programming Language. Ruby on Rails framework . Bylina . H.N. . 2014 . IOP Publishing . Tomsk . XX International conference for students and young scientists «MODERN TECHNIQUE AND TECHNOLOGIES» .
  2. Book: The Ruby Way: Solutions and Techniques in Ruby Programming. Fulton. Hal. Arko. André. 11 February 2015. Addison-Wesley Professional. 978-0321714633. 566.
  3. Web site: Unicorn Power. 30 March 2010.
  4. Web site: Why did you move to runit + Unicorn. February 2015.
  5. Web site: Category: Web Servers . 2022-06-29 . The Ruby Toolbox . en.
  6. Web site: Puma is Now the Recommended Ruby Webserver. 23 January 2015.
  7. News: Unicorn vs Puma: Rails server benchmarks. Tommaso. Pavese. Deliveroo.engineering . 21 December 2016.
  8. News: How we migrated application servers from Unicorn to Puma. 2022-01-24. GitLab. en.