Matt, there are all sorts of optimisations available. if you really
want top performance, then you could write a c++ module that does
static file serving and can be easily plugged into a node.js http
server. it would be able to spend most of it's time in c++ land
serving static files so there is no reason it could not be as fast as
nginx. also, nginx is only optimised once - at compile time. in v8,
the JIT compiler has the opportunity to optimise on the fly as the
load on the server changes. this is a big advantage over something
like nginx and it wouldn't surprise me at all to see a node.js
solution match or out perform nginx at static file serving in the near
future.

i've put a very basic benchmark up here:
https://gist.github.com/1831760

this just serves a buffer straight out of memory and doesn't do any
processing of the request headers, other than putting them into an
object instead of an array, but it's a useful baseline so we can see
how adding in the various aspects of static file serving affect the
performance.

on my server, i get 27k responses per second using ab. this pegs one
cpu and i made sure to run ab against localhost and with the server
and ab pinned to specific cpu's so they can share a cpu cache (this
makes a big difference to the results). memory usage is 9MB idle and
runs up to 16-18MB under load. nginx serving a 0k static file with
exactly the same headers can do 32k rps in the exact same environment,
so it's not a world away and there is lots of room for optimisation.

i'll start adding in the rest of the static file serving functionality
and will post results of tests to the gist.


On Feb 14, 9:25 pm, Matt <[email protected]> wrote:
> On Tue, Feb 14, 2012 at 3:22 PM, Tim Caswell <[email protected]> wrote:
> > Matt,
>
> > I'm not offended by the tone.  I understand the intent and tone are hard
> > to convey on the internet.  That's why I love going to tech conferences to
> > meet people face to face.  I hope to be at nodeconf this summer, maybe we
> > can discuss this there.
>
> Thanks - probably won't get there - new startup, etc etc. I think some
> Haraka guys might try and talk there though - we'll see.
>
> Just to clarify for those who thought the tone was off - "benchmarks or
> GTFO" is a turn of phrase often used in the tech community to actually get
> some real results into a conversation rather than people talking around the
> subject. I'm surprised people haven't heard it said before.
>
> > But I do disagree with your statement "it's just that people need to
> > understand that Node will never be the high performance static file server
> > that nginx is. And trying to get there seems pretty futile to me".
>
> Maybe the latter part was a bit strong (nothing is futile in coding - this
> shit is fun), but it's true that we'll never hit the performance of nginx,
> unless nginx is doing something really wrong (and let's assume I'm talking
> about Linux here - it may be significantly slower on Windows for all I
> know, but that's not a platform I will ever use).
>
> > I can see that you're just trying to do your civic duty and make sure
> > people know that serving static files isn't something node is good for.  I
> > personally think it can be good for that.
>
> It can be mediocre for that, yes - your needs are not high traffic, I would
> guess. Node can probably serve files faster than anyone but a top 1000 web
> site needs - I mean we're talking thousands of requests/sec here - enough
> to serve 100 million hits a day from a single box. But when people come
> with benchmarks saying "Node is slower than nginx!" they need to be told:
> Of course it is.
>
> I really don't mean to be a snot about this, and my tone reflected more of
> a bad personal time than anything to do with the list.
>
> Matt.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to