4 ms·
EDIT: After looking at this http://nodejs.org/jsconf2010.pdf http://nodejs.org/jsconf2010.pdf from sh1mmer's post, it looks like I need to be using a Buffer obj
by andrewvc 17y ago
EDIT: After looking at this http://nodejs.org/jsconf2010.pdf http://nodejs.org/jsconf2010.pdf from sh1mmer's post, it looks like I need to be using a Buffer object to serve data over 64kb due to v8's garbage collector making a performance mess when using strings.
EDIT2: After looking at the code again, file reads come in as strings, so I don't actually see that Buffers would help, at least until the node file API starts passing around buffers instead of strings.
I can't speak to performance wrt to proxying, but I benchmarked its performance serving files recently[1].
Now, I didn't benchmark nginx, but as you can see, its pretty slow at that task, averaging ~10 MiB/s on fairly decent hardware, across a single gigabit switch.
One problem node has, is that it sucks dealing with strings containing non UTF-8 data:
From the node docs:
Node supports 3 string encodings. UTF-8 ('utf8'), ASCII ('ascii'), and Binary ('binary'). 'ascii' and 'binary' only look at the first 8 bits of the 16bit JavaScript string characters.
1. http://blog.andrewvc.com/nodejs-can-really-scale http://blog.andrewvc.com/nodejs-can-really-scale