I’m trying to understand threads in Rails with Puma. I found two articles about that:
In Puma documentation: By default, a single, separate thread (created by the Reactor class) reads and buffers requests from the socket
In the Heroku deployment guide: You can only utilize threads in Puma if your entire code-base is thread safe. Otherwise, you can still use Puma, but must only scale-out through worker processes.
As I understand from the first point, it means each request will be handled by a single thread, so my Rails app doesn’t need to be thread-safe. But the Heroku document says differently!
I’m quite confused. Can you please help me clarify this? Thanks a lot for your help!