Heroku上的Node.js和Express with socket.io-H12和H13错误

瑞安·道顿(Ryan Daulton)

当前正在Standard-1X使用Node,Express和Socket.io构建一个运行Heroku dyno的项目。该应用程序的前提非常简单:人们从客户端搜索商品(像Dicts一样存储在引擎盖下):

    ['Item':'Coffee', 
    'Id':0247508725,
    'Location': 'Baker Street']

并选择它们,然后将项目键值推送到节点服务器并存储在列表中。然后,其余客户端“实时”检索该列表。客户端都是本机构建的Swift iOS应用

我第一次与大约60个用户一起运行,所有用户都同时搜索和添加项目。Heroku仪表板的结果令人震惊:

Heroku资讯主页

I thought I had been thorough in testing, I had never seen so many H12 & H13 errors. Part of me thinks it might be inefficient code on my server side, or simply the lack of proper Node implementation to handle so many requests so I'm not constantly waiting on I/O because of the whole single threaded-ness deal.

Here is an example of the function server side that runs to add an item on that list:

clientSocket.on("additionToList", function(Location,Item,Id){
  client.query("INSERT q_venue_list (item_name, item_id, at_location) VALUES ($1, $2, $3)",[Item,Id,Location], function(err, result) {
if(err) {
  return console.error('error running insert', err);
}
io.sockets.in(Location).emit('updateList');
  });
});

When the clients sockets in room Locationreceive the 'updateList' command, they pull the new list. Storage and retrieval all work fine, but for some reason with all these people, everything got bogged down and was extremely lagged. I hardly know what I'm doing but I'm just trying to understand where I might be going wrong. I can't cluster because I only get access to one core, so would be next best option be to explore async? Could it be horrible device signal, coupled with waiting on I/O that causes all the timeouts?

I'm just looking to understand this, any help is appreciated. Let me know if I can provide more information.

Ryan Daulton

对于遇到这种奇怪问题的任何人,我最终都弄清楚了问题所在。我没有释放套接字层并没有断开socket.disconnect上的)的连接这导致后端上的该套接字等待直到超时(55秒)。在等待的整个过程中,它一直困扰着事件循环的其余部分。因此,其他传入请求将等待,然后它们也将超时。applicationDidEnterBackgroundapplicationWillResignActive

tl; dr:努力打开和关闭插槽。用户退出应用程序时,请不要忘记关闭它们。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Heroku上的Node.js Socket.io抛出H13

来自分类Dev

Heroku上的Node.js Socket.io抛出H13

来自分类Dev

socket.io和Express JS的用法

来自分类Dev

Node.js和Socket.io-动态socket.on()

来自分类Dev

Node.js-在同一端口上使用Socket.io和Express

来自分类Dev

Express> 4.0版本的Socket.io和Node.js

来自分类Dev

将Socket.io与Node.js,Express和Jade结合使用

来自分类Dev

如何使用Express和Socket.IO设置Node.JS?

来自分类Dev

Node.js使用Socket.io和Http从Express读取发布数据

来自分类Dev

使用 Node.js、Socket.IO 和 Express 提供静态 JavaScript 文件

来自分类Dev

运行我的 node.js 程序时 Heroku 上的 H12 错误

来自分类Dev

具有Express和socket.io的节点js-无法找到socket.io.js

来自分类Dev

Socket.io和express.js,如何使其工作?

来自分类Dev

Express.js,bin / www设置和Socket.io

来自分类Dev

Socket.io和express.js,如何使其工作?

来自分类Dev

socket.io express和angularJS错误

来自分类Dev

Node.js,socket.io和mongojs-使用socket.io登录表单

来自分类Dev

Node.js和Socket.io创建空间

来自分类Dev

在Socket IO和Node JS中轮询MySQL DB

来自分类Dev

使用node.js和socket.io的私人聊天

来自分类Dev

使用Node.js,Express和socket.io在OpenShift上进行Access-Control-Allow-Origin

来自分类Dev

尝试在Heroku上部署Node.js / Express / Socket.io应用程序时出现应用程序错误

来自分类Dev

Socket.io和Express设置

来自分类Dev

Socket.io和Express 4

来自分类Dev

Socket.io和Express设置

来自分类Dev

NodeJS,Express和多事的Socket.io

来自分类Dev

如何在Node.js上安装socket.io和mysql

来自分类Dev

如何设置RedisStore-Node,Express,Socket.io,Heroku

来自分类Dev

如何设置RedisStore-Node,Express,Socket.io,Heroku

Related 相关文章

热门标签

归档