node.js 从 0.2.6 升级到 0.4.7 时出现超时问题?
我最近将一个老化的应用程序从 0.2.6 升级到 0.4.7。升级过程非常顺利,大部分问题似乎都与库有关。我正在使用express 来服务rest api 调用。
当应用程序启动时,会发生大量预取。有一些非常慢的调用被启动。在节点 0.2.6 上,这些调用将在 15-30 秒内返回。升级后,调用在一分钟后返回(!),远远超过了我们在其他地方设置的超时限制,因此应用程序崩溃了。
node.js 中是否有任何更改会导致此问题?也许关于最大同时连接数? request 和express 的最新版本怎么样?
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 changes in node.js that would cause this? Perhaps something about maximum simultaneous connections? What about the latest versions of request and express?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Node 0.4 引入了限制。 Request 采用 http.Agent.maxSockets 默认值,即 5。当我将其强制设置为 100 时,页面再次停止超时。我通过阅读请求文档弄清楚了这一点:
并使用选项对象:
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:
and with the options object: