Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is EventMachine so much slower than Node?
    text
    copied!<p>In my specific case, at least. Not trying to make general statements here.</p> <p>I've got this web crawler that I wrote in Node.js. I'd love to use Ruby instead, so I re-wrote it in EventMachine. Since the original was in CoffeeScript, it was actually surprisingly easy, and the code is very much the same, except that in EventMachine I can actually trap and recover from exceptions (since I'm using fibers).</p> <p>The problem is that tests that run in under 20 seconds on the Node.js code take up to and over 5 minutes on EventMachine. When I watch the connection count it almost looks like they are not even running in parallel (they queue up into the hundreds, then very slowly work their way down), though logging shows that the code points <em>are</em> hit in parallel.</p> <p>I realize that without code you can't really know what exactly is going on, but I was just wondering if there is some kind of underlying difference and I should give up, or if they really should be able to run about as fast (a small slowdown is fine) and I should keep trying to figure out what the issue is.</p> <p>I did the following, but it didn't really seem to have any effect:</p> <pre><code>puts "Running with ulimit: " + EM.set_descriptor_table_size(60000).to_s EM.set_effective_user('nobody') EM.kqueue </code></pre> <p>Oh, and I'm <em>very</em> sure that I don't have any blocking calls in EventMachine. I've combed through every line about 10 times looking for anything that could be blocking. All my network calls are EM::HttpRequest.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload