It is optimized for serving *many* files to many clients, including slow clients. File streams are optimized for a case where you're serving lots of files to lots of clients.
If you want to server *one* file: load it in to memory and serve it in a single write, that'll be faster than Apache. Optimizing the chunk size to do more throughput for a single connection would be foolish, it would lead to more memory usage at high concurrency. -Mikeal On May 20, 2012, at May 20, 20121:42 PM, Ben Noordhuis wrote: > On Sun, May 20, 2012 at 5:55 PM, rejetto <[email protected]> wrote: >> dear all, >> i'm testing the speed a node http server can get on a single stream. >> >> For my tests i made a dead simple piece of software serving a big >> file http://pastebin.com/GU3XEf3k >> configure the first line to point to the big file. >> On the client side i'm using this command: >> wget -O nul http://localhost/ >> the "nul" is valid for windows, while should be changed to /dev/null on >> linux. >> >> On my laptop i'm getting roughly 150MB/s on a single stream. >> Apache sports a 250MB/s with same conditions. >> I'm not sure if and how this value will affect real performances, but being >> my project a file server used also in LAN, it could. >> >> Is there anything i can do to optimize this? >> I'll be glad also to be pointed to documents, because i didn't find a good >> one. >> >> Thank you very much > > Node is not optimized for serving static files. That will change but > for now, you're better off using httpd or nginx to serve your static > resources. > > -- > 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 -- 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
