Skip to content

Using multiple workers in production

Michel Blanc edited this page Aug 11, 2012 · 1 revision

If you use thin, you can ask it to start multiple workers on different ports. For instance, with this config file, you'll spin up three thin instances on ports 5000, 5001, 5002 :

    pid: tmp/pids/thin.pid
    log: log/thin.log
    timeout: 30
    max_conns: 1024
    port: 5000
    max_persistent_conns: 512
    environment: live
    servers: 3
    address: 0.0.0.0
    daemonize: true

(note : you can do the same directly at the command line; checkout thin help)

Then, start'em up with :

RACK_ENV=live thin -C thinconfig.yml start

To use these instances, you need to set-up a reverse proxy. The best tools for this are really haproxy and nginx

Clone this wiki locally