News for hackers. Stuff that matters.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by simonw on Wednesday April 28, 2010 @07:56AM (#1301304)
If anyone's looking for a project, a reusable HTTP proxying library for Node.js with easy hooks for adding pre- and post- checks and transforms would be incredibly useful. Being able to implement API rate limiting and authentication as a Node.js reverse proxy that wraps around an existing web application would be even easier with a well-tested, fully featured proxy library.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by weixiyen on Wednesday April 28, 2010 @05:46PM (#1302866)
Does anyone have any idea how it would compare performance-wise to what's out there right now? vs Nginx for example.
Re:A HTTP Proxy Server in 20 Lines of node.js Code by andrewvc on Wednesday April 28, 2010 @06:50PM (#1303005)
EDIT: After looking at this 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

Re:A HTTP Proxy Server in 20 Lines of node.js Code by sh1mmer on Wednesday April 28, 2010 @06:49PM (#1303000)
Ry has some Nginx / Node comparison in his JSConf slides http://nodejs.org/jsconf2010.pdf

Summary: Node isn't quite as fast as NginX but it's close, and it's programable, and he's still tuning it.