1

With the following enabled:

  app.use(express.session({
    store: sessionStore,
    secret: 'secret',
    key: 'express.sid'}));

Whilst testing my Node.js application the throughput of requests is 650 Requests per second.

When I don't use express.session, the throughput of requests is 2200 Requests per second.

Testing with apache bench with the following parameters:
-k -c 256 -n 50000 http://localhost:3000/.

I'm testing against the following:

app.get('/', function(req, res)
{
  res.redirect('/login');  
});

Question: Is this a normal drop in performance, or is there something which I should be looking at fixing?

Jack
  • 15,614
  • 19
  • 67
  • 92

1 Answers1

0

I'd say, it is "normal". I don't have any benchmarks myself to compare to yours, but since you are creating session ID from crypto, as well as looking up in your storage (which I hope is memcache or redis or some key/value store), such a drop seems natural. Without session, you are doing absolutely nothing and not waiting for any IO either..

japrescott
  • 4,736
  • 3
  • 25
  • 37
  • Thanks, I didn't know what was going on behind the scenes in that much detail. – Jack Feb 11 '12 at 23:41
  • maybe someone else has more insight. Also -> you may want to increase the concurrent connections in the benchmark to see how node.js can handle ALOT of concurrent connections. – japrescott Feb 11 '12 at 23:44
  • It's just Windows 7 which is really slow! http://stackoverflow.com/questions/9243221/does-node-js-perform-badly-on-windows-surely-it-cant-be-slower-than-apache-for Btw i'm working in Linux now the same application is capable of dealing with 3500 req / sec. I'm now also implementing clustering and a quick bench showed 18000 req / sec. I'm having problems with Socket.io though :(! http://stackoverflow.com/questions/9245044/socket-io-websocket-authorization-failing-when-clustering-node-application – Jack Feb 11 '12 at 23:50