preload_app true helped our application, so take a picture if you see timeout problems during deployment / reload. The comments saying that it didn’t help made me think that it wasn’t worth trying, and then realized that this was really the fix we needed.
Our situation was a slow boot Rails application using preboot . On some deployments and restarts, we would get many timeouts before the site was reviewed using our uptime monitoring.
We realized that with preload_app false Unicorn will first bind its port and then load the application. As soon as it binds the port, Heroku starts sending traffic. But then this slow application loads, so the traffic gets timeouts.
This is easy to verify by running Unicorn in dev, trying to access the site immediately after starting Unicorn and checking if you have a "no server on the port" error (desirable) or a very slow request (undesirable).
When we set preload_app true instead, it will take longer until Unicorn binds the port, but as soon as it does and Heroku sends the traffic, it is ready to respond.
Henrik N
source share