node.js - nodejs (nodejs.org/) experience / comments -
has experience nodejs? how performance? memory management?
i'm looking technology allows me create real-time web app tracking system , chat.
if considered , decided don't use it, did use?
memory
node.js' strengths come ability keep a lot of connections open , idle. instance apache need connection limit (sometimes it's low 20 concurrent connections, depending on server environment) because allocates 2 mb of memory each connection, node.js doesn't need that. apache doesn't keeping connections open because of problem, , keeping connections open becomes hassle.
a node app programmed single thread (though in background uses threads various blocking operations, not on per-connection basis). if you've programmed in erlang may know how liberating not having care other agents (or connections) doing, while still being able share data between (virtual) instances without effort.
in theory node can handle many connections max number of file descriptors/sockets allowed on system. in windows (using cygwin) 65536, , on unix bet more possible, though unlimited in theory (with server end on port 80, 65536 connections can handled each destination). in apache cause memory allocation problem long before hitting 2000 users.
in reality these numbers, , affected bunch of other things, such how data can app handle passing through given subset (or all) of connections. more realistic estimate can handle 20-25.000 users average activity without significant lag. pure single-server setup know can handle many concurrent users irc server programmed in c, though there few web servers (like nginx) deal it.
performance
node uses google's v8 javascript engine, meaning it's fast , getting faster every week.
an advantage of node uses asynchronous i/o, when 1 user has wait file read disk or database call, node puts in background (remember said uses threads in background) , let's wait, while in main thread moves on next task. makes sure always keeps moving. if given user may have slight delay, others aren't held it.
socket.io
this library use communication. can find out more on http://socket.io
it comes chat example easy, can't feeling it's awesome.
oh, , remember try node , make decision based on that. it's not great everything, it's choice lot of things.
Comments
Post a Comment