May 16, 2015 by Daniel P. Clark

Switching From Unicorn to Puma on Heroku is Easy!

I’ve had my project running on Heroku with Unicorn for some time now.  Not that long ago Heroku put out a notice advising people to switch over to Puma as Unicorn doesn’t do well with low latency connections.  And you know that with the internet you’re always going to have people with slow connections accessing your service.  Also upon looking into it further Puma it looks like it performs better than all the other server control environments.  Puma’s key advantage being it does things with threads really well.

First I’ll show what I had for my Unicorn server setup.

Unicorn

The configuration file in config/unicorn.rb

The line in Procfile

And the Gemfile

From hear it was as easy as switching the Profile and Gemfile and adding a Puma config file.

Puma

The configuration file config/puma.rb

The only thing I had to change from the default was the environment variable used for the Redis server.

Changed the Profile to

And the Gemfile to

After that it’s the normal push to the Heroku server with git and everything works!

Summary

It’s easy, it’s better, so you might as well just go ahead and do it.  Feel free to look at Heroku’s howto if you’d like.  Deploying Rails Applications with the Puma Web Server  I’ve pretty much covered it here.

Please feel free to comment, share, subscribe to my RSS Feed, and follow me on twitter @6ftdan!

God Bless!
-Daniel P. Clark

Image by Tambako The Jaguar via the Creative Commons Attribution-NoDerivs 2.0 Generic License.

#change#easy#heroku#puma#rails#ruby on rails#switch#unicorn