Puma is a lightweight Ruby web server that was built for concurrency. It is a great alternative to Unicorn and works well on Heroku. Like Unicorn, Puma allows us to get more performance out of our dynos by responding to multiple requests simultaneously. It does this while maintaining a smaller memory footprint than Unicorn and has shown very impressive benchmarks when load tested.
The primary difference between Puma and Unicorn is that Puma will run multiple threads within a single process. This is an important distinction, because while processes have their own unique memory space, threads do not. This means our application's code must be thread safe.
The danger of code that is not thread safe is that separate web requests could be reading and writing from the same memory. This can cause errors or, worse, display data that was intended for another user.