In order to avoid the time spent on the creation of the sockets. My node server need some "long connection"(TCP Socket) to keep communicating with the server written in C which runs in the background, and all the 'http request' could share the TCP sockets in the pool. I wonder if there is a kind of socket pool implementation in nodejs? (something like the database connection pool)
Any help will be appreciated !
generic pool is a good one. https://github.com/coopernurse/node-pool But as for http, there's built-in pooling mechanism .
Take a look at the official documentation for http.Agent; that's what (behind the scenes for most node developers) handles allocation of available sockets.