Threaded Thin is really really slow on Ruby 1.9.2

So you’ve been using Thin’s threaded mode, and it’s been rocking the socks off your shiny config.threadsafe!‘d Rails app. Then, like me, you caught wind that The Dark Ages were over, and decided to upgrade from Ruby 1.8.7 to 1.9.2. But oh no! "What’s all this?," you ask. “Why isn’t Thin responding anymore?”

Rest assured, dear reader, that it is. It’s just taking 30+ seconds; Nginix or Apache aren’t that patient. There’s a 2 year old lighthouse ticket on this issue, and even some related patches in EventMachine. But apparently to little avail.

So until this is all sorted out, as the lighthouse conversation suggests, you’ll have to tell Thin to not use epolling. Supposedly this will slow it down, but it should still be faster than it was in Ruby 1.8.7.

From the command line

thin start --threaded --no-epoll ...

In a config file

...
threaded: true
no-epoll: true
...

Now Thin will be restored to its former, threaded glory. Enjoy!

  1. John says:

    (i'm on os x, maybe that's why i don't have the --no-epoll option. i also don't have the "install" command)

  2. John says:

    Seems like thin no longer has the --no-epoll flag? Thought you might be interested in this: https://github.com/jjb/threaded-rails-example

  3. Hsiu says:

    I have found that the no-epoll setting in the YAML file doesn't seem to work. threaded does, but only when I include --no-epoll on the command line do I see the very major speed hit disappear.

  4. https://www.google.com/accounts/o8/id says:

    Rainbows and zbatery DO support concurrent multi-threading

    You have to use the ThreadPool strategy: http://rainbows.rubyforge.org/Rainbows/ThreadPool.html

    Use this for test it ;) https://github.com/jjb/threaded-rails-example

  5. Andrei says:

    Thanks for the article, but I have a question. How should the config file look like, and how should it be named?

    Thanks,
    Andrei

  6. Jordan Hollinger says:

    @Andrei See here - How to use Thin Effectively

Post a comment


(lesstile enabled - surround code blocks with ---)