496
395
+ 1
295

What is Unicorn?

Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels. Slow clients should only be served by placing a reverse proxy capable of fully buffering both the the request and response in between Unicorn and slow clients.
Unicorn is a tool in the Web Servers category of a tech stack.
Unicorn is an open source tool with 1.4K GitHub stars and 255 GitHub forks. Here’s a link to Unicorn's open source repository on GitHub

Who uses Unicorn?

Companies
204 companies reportedly use Unicorn in their tech stacks, including Shopify, Instacart, and GitHub.

Developers
277 developers on StackShare have stated that they use Unicorn.
Pros of Unicorn
81
Fast
59
Performance
36
Web server
30
Very light
30
Open Source
27
Rack http server
18
Load balancing
14
Great process management
Decisions about Unicorn

Here are some stack decisions, common use cases and reviews by companies and developers who chose Unicorn in their tech stack.

Mark Ndungu
Software Developer at Nouveta · | 4 upvotes · 27.2K views
Needs advice
on
PumaPuma
and
UnicornUnicorn

I have an integration service that pulls data from third party systems saves it and returns it to the user of the service. We can pull large data sets with the service and response JSON can go up to 5MB with gzip compression. I currently use Rails 6 and Ruby 2.7.2 and Puma web server. Slow clients tend to prevent other users from accessing the system. Am considering a switch to Unicorn.

See more
Simon Bettison
Managing Director at Bettison.org Limited · | 8 upvotes · 748.8K views
Shared insights
at

In 2012 we made the very difficult decision to entirely re-engineer our existing monolithic LAMP application from the ground up in order to address some growing concerns about it's long term viability as a platform.

Full application re-write is almost always never the answer, because of the risks involved. However the situation warranted drastic action as it was clear that the existing product was going to face severe scaling issues. We felt it better address these sooner rather than later and also take the opportunity to improve the international architecture and also to refactor the database in. order that it better matched the changes in core functionality.

PostgreSQL was chosen for its reputation as being solid ACID compliant database backend, it was available as an offering AWS RDS service which reduced the management overhead of us having to configure it ourselves. In order to reduce read load on the primary database we implemented an Elasticsearch layer for fast and scalable search operations. Synchronisation of these indexes was to be achieved through the use of Sidekiq's Redis based background workers on Amazon ElastiCache. Again the AWS solution here looked to be an easy way to keep our involvement in managing this part of the platform at a minimum. Allowing us to focus on our core business.

Rails ls was chosen for its ability to quickly get core functionality up and running, its MVC architecture and also its focus on Test Driven Development using RSpec and Selenium with Travis CI providing continual integration. We also liked Ruby for its terse, clean and elegant syntax. Though YMMV on that one!

Unicorn was chosen for its continual deployment and reputation as a reliable application server, nginx for its reputation as a fast and stable reverse-proxy. We also took advantage of the Amazon CloudFront CDN here to further improve performance by caching static assets globally.

We tried to strike a balance between having control over management and configuration of our core application with the convenience of being able to leverage AWS hosted services for ancillary functions (Amazon SES , Amazon SQS Amazon Route 53 all hosted securely inside Amazon VPC of course!).

Whilst there is some compromise here with potential vendor lock in, the tasks being performed by these ancillary services are no particularly specialised which should mitigate this risk. Furthermore we have already containerised the stack in our development using Docker environment, and looking to how best to bring this into production - potentially using Amazon EC2 Container Service

See more

Blog Posts

GitHubMySQLSlack+44
109
50654

Unicorn Alternatives & Comparisons

What are some alternatives to Unicorn?
Puma
Unlike other Ruby Webservers, Puma was built for speed and parallelism. Puma is a small library that provides a very fast and concurrent HTTP 1.1 server for Ruby web applications.
Unicorns
Live stream your iPhone or iPad screen. Produced by Lookback.
NGINX
nginx [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. According to Netcraft nginx served or proxied 30.46% of the top million busiest sites in Jan 2018.
Apache HTTP Server
The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant web server. Originally designed as a replacement for the NCSA HTTP Server, it has grown to be the most popular web server on the Internet.
Apache Tomcat
Apache Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations.
See all alternatives

Unicorn's Followers
395 developers follow Unicorn to keep up with related blogs and decisions.