timeout issues on upgrade of node.js from 0.2.6 to 0.4.7?
I recently did an upgrade of an aging app to 0.4.7 from 0.2.6. The upgrade went pretty smoothly and most of the problems seemed to be related to libraries. I'm using express to server up rest api calls.
When the app starts up, a lot of prefetching happens. There are some very slow calls that get kicked off. On node 0.2.6 these calls would return anywhere from 15-30 seconds. After the upgrade the calls return after a minute (!) well past the timeout limit we have set elsewhere, so the app breaks.
Have there been any cha开发者_如何转开发nges in node.js that would cause this? Perhaps something about maximum simultaneous connections? What about the latest versions of request and express?
Node 0.4 introduces throttling. Request honors the http.Agent.maxSockets default, which is 5. When I forced this up to 100, the pages stopped timing out again. I figured this out by reading the Request docmentation:
Because node 0.4.0 has an internal pooling mechanism the preferred way of sharing a connection is using agents which request simplifies with it's new pool API.
and with the options object:
pool
- A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets.pool.maxSockets
- Integer containing the maximum amount of sockets in the pool.
精彩评论