Optimizing Heroku

I spent some time recently playing with a trivial Rails 3 app using girl_friday and learned a few interesting things:

Michael's post on using Unicorn with Heroku is a fantastic idea and great way to improve the efficiency of your Heroku application's web dynos.

Heroku imposes a limit of 15 threads per Ruby process (there is an open question about this, it might just be a bug in the Heroku Cedar stack, which is still beta). If you are using thin, you get 1 process and 15 threads per dyno. If you are using Unicorn, you get 3 processes* and 45 threads. UPDATE: I don't believe Heroku has a thread limit, just a memory limit.

girl_friday defaults to 5 threads per queue. With the thread limit on Heroku, you'll want to carefully ration the size of each queue. girl_friday's Rack status app can tell you at runtime which queues are busy and which are quiet for tuning purposes.