Skip to content

Most basic Union server takes 200ms to respond, compared to 2ms for Express? #40

Closed
ryancole opened this Issue Nov 1, 2012 · 3 comments

3 participants

@ryancole
ryancole commented Nov 1, 2012

I created the following simple Union server, and it takes 200ms to respond with the "not found" error message.

var union = require('union');

var server = module.exports = union.createServer({

    buffer: false

});

The comparable server with Express, and even more so the bare http server, only takes 1-3ms to respond with the same message. Express is just what I used as a comparison because I knew how to quickly write a similar test.

I'm running this server on a development machine on my LAN. The machine has an i7 processor, and SSD drive, so it's most definitely not something there. It's not a Raspberry Pi with an SD card or anything.

Any ideas why this might be so slow? I can't imagine the 200ms is justified somehow. I have other web apps that do template rendering and database queries in less than that amount of time. That's why I decided to go ahead and make this ticket. Thanks.

@indexzero
a decoupled application framework member

@ryancole Thanks for bringing this to our attention. We'll investigate

@pksunkara

@ryancole I cant seem to get the same results as you.

I have 8x2GB i7 processor with 3.4 GiHz.

Tested with ab -n 10000 -c 100 [url]

Connect

Both 200 and 404 responses take about 0.1 ms (on average)

Union

Both 200 and 404 responses take about 0.25 ms (on average)

@pksunkara pksunkara closed this Dec 7, 2012
@pksunkara
var path = require('path'),
    union = require('union');

var server = union.createServer({
  buffer: false,
  // before: [
  //   function (req, res) {
  //     res.end('Hello!');
  //   }
  // ]
}).listen(9090);

console.log('Union listening on 9090!');
var http = require('http')
  , connect = require('connect');

var app = connect()
  // .use(function (req, res) {
  //   res.end('Hello!');
  // })
  .listen(8080);

console.log("Connect listening on 8080!");

404 Benchmarks are gisted here: https://gist.github.com/4267498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.