Heroku will log an R10 - Boot Timeout error when a web process takes longer than 60 seconds to bind to its assigned port. This error is often caused by a process being unable to reach an external resource, such as a database or because you have a lot of gems in your
Gemfile which take a long time to load.
1 2 3
There's currently no way to increase this boot timeout, but we can beat it with a proxy implemented by our new heroku-forward gem.
The concepts for
heroku-forward come from this article by Nicolas Overloop. The basic idea is to have a proxy bind to the port immediately and then buffer requests until the backend came up. The proxy implementation is Ilya Grigorik's em-proxy. Communication between the proxy and the backend happens over a unix domain socket (a file), which needed a bit of work (see #31), inspired by an excellent article, Fighting the Unicorns: Becoming a Thin Wizard on Heroku by JGW Maxwell. The
heroku-forward gem connects all the dots.
Check out the gem's README for how to set it up.
Here's the log output from an application that uses this gem. Notice that Heroku reports the state of
web.1 up after just 4 seconds, while the application takes 67 seconds to boot.
1 2 3 4 5 6 7 8 9 10 11
You can read more about how we use Heroku at http://success.heroku.com/artsy.