我如何可以扩展socket.io? [英] How can I scale socket.io?

查看:106
本文介绍了我如何可以扩展socket.io?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比方说,一台服务器获取10000个并发连接(通过socket.io)。这是一个很大,如果它不能处理任何更多的,我需要旋转起来另一台服务器。

Let's say a server gets 10,000 concurrent connections (via socket.io). That's a lot, and if it can't handle any more, I need to spin up another server.

我怎样才能在两个服务器同步连同他们的socket.io?

How can I sync the two servers together with their socket.io?

推荐答案

您可以尝试使用例如集群模块和分发负载到多内核(如果你有一个多核心CPU)。如果这还不够,你可以尝试使用反向代理分发在多个服务器上,并请求< A HREF =htt​​p://redis.io/相对=nofollow> Redis的作为中央会话数据(如果有可能为您的方案)。

You can try to use for example cluster module and distribute the load to multiple cores (in case you have a multi-core CPU). In case this is not enough you can try to use reverse proxy for distributing requests across multiple servers and redis as a central session data store (if it's possible for your scenario).

这篇关于我如何可以扩展socket.io?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆