Unicorn (web server)

{{Not to be confused with|Unicorn}}

{{Infobox software

| name = Unicorn

| logo =

| screenshot =

| caption =

| author = Eric Wong

| developer = [https://bogomips.org/unicorn/CONTRIBUTORS.html Unicorn developers]

| released = {{Start date and age|2009|03|11}}

| latest release version = {{wikidata|property|preferred|references|edit|P348|P548=Q2804309}} | latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|P348|P548=Q2804309|P577}}|df=yes}}

| programming language = Ruby

| operating system = Cross-platform

| language = English

| genre = Web server

| license = GPLv2+ or Ruby 1.8

| website = {{Official URL}}

| repo = [https://yhbt.net/unicorn/ 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”.{{cite conference |url=http://earchive.tpu.ru/bitstream/11683/20842/1/conference_tpu-2014-C01-V2-141.pdf |title=Ruby Programming Language. Ruby on Rails framework |last1=Bylina |first1=H.N. |date=2014 |publisher=IOP Publishing |location=Tomsk |conference=XX International conference for students and young scientists «MODERN TECHNIQUE AND TECHNOLOGIES» }}{{cite book|title=The Ruby Way: Solutions and Techniques in Ruby Programming|last1=Fulton|first1=Hal|last2=Arko|first2=André|date=11 February 2015|publisher=Addison-Wesley Professional|isbn=978-0321714633|page=566}}

Twitter started to test Unicorn in 2010.{{Cite web|url=https://blog.twitter.com/engineering/en_us/a/2010/unicorn-power.html|date=30 March 2010|title=Unicorn Power}}

This server is shipped with Discourse. Their system administrator Sam Saffron noted Unicorn was reliable, as it reaps unresponsive workers.{{Cite web|url=https://meta.discourse.org/t/why-did-you-move-to-runit-unicorn/25313|title=Why did you move to runit + Unicorn|date=February 2015}}

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

As of 2018, projects tend to favour Puma.{{Cite web |title=Category: Web Servers |url=https://www.ruby-toolbox.com/categories/web_servers |access-date=2022-06-29 |website=The Ruby Toolbox |language=en}} The Heroku hosting provider recommends since 2015 to migrate from Unicorn to Puma.{{Cite web|url=https://devcenter.heroku.com/changelog-items/594|date=23 January 2015|title=Puma is Now the Recommended Ruby Webserver}} 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.{{Cite news|url=https://deliveroo.engineering/2016/12/21/unicorn-vs-puma-rails-server-benchmarks.html|title=Unicorn vs Puma: Rails server benchmarks|first1=Tommaso|last1=Pavese|newspaper=Deliveroo.engineering |date=21 December 2016}} GitLab switched to Puma from Unicorn in 2020.{{Cite news|title=How we migrated application servers from Unicorn to Puma|url=https://about.gitlab.com/blog/2020/07/08/migrating-to-puma-on-gitlab/|access-date=2022-01-24|website=GitLab|language=en}}

References