3 ms·
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 incredi
by simonw 17y ago
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.
- weixiyen 17y agoDoes anyone have any idea how it would compare performance-wise to what's out there right now? vs Nginx for example.
- sh1mmer 17y agoRy has some Nginx / Node comparison in his JSConf slides http://nodejs.org/jsconf2010.pdf 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.
- andrewvc 17y agoEDIT: 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