战略实施可扩展的聊天服务器 [英] Strategy to implement a scalable chat server

查看:153
本文介绍了战略实施可扩展的聊天服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待实现某种聊天服务器。我希望它形成规模。这似乎是一个很大的问题,所以我想我期望的答案是方向指针,排序的探索。

I am looking to implement some sort of chat server. And I want it to scale. This seems like a big question, so I guess I expect the answers to be direction pointers, sort of exploratory.

最终用户客户端Web或手机客户端。我觉得某种WebSocket的实现,如Socket.IO的是很好的。

The end-user clients are web or phone client. I think some sort of websocket implementation, such as Socket.IO is nice.

在服务器端我希望用Node.js的我想要的架构具有可扩展性,使用户的数量不限(当然,在合理范围内,预计不会大打的机会,如果是这样,有聪明,有经验的人来进行这项工作的机会是合理的而不是目前只是我的编码),每个聊天室的用户的数量有望不限,或者一些固定的大的多。这意味着我需要用写在节点几台服务器横向扩展。

On the server side I wish to use Node.js. I want the architecture to be scalable so that the number of users are not limited (well, within reason, the chance of big hit is not expected, and if it is, the chance of having smarter, experienced people to work on it is reasonable instead of currently just me coding) The number of users per chatroom is hopefully not limited, or maybe some fixed large number. And that means I need to scale horizontally using several servers written in Node.

假设一些负载平衡器(希望今后不再单一故障点,但我不知道我会做到这一点,或者只是移动到AWS)被分派到聊天从高端客户SocketIO连接服务器。不同用户连接到不同的服务器可以是在同一个房间,所以需要将消息发送到其他服务器。

Suppose some load balancer (and hopefully in the future not a single point of failure, but I don't know how I would achieve that, or maybe just move to AWS) are dispatching SocketIO connections from the end clients to the chat servers. Different users connection to different servers may be in the same room, so the messages need to be send to other servers.

我将如何实施可行性的这样的事情?希望不会太复杂。

How would I feasibly implement something like this? Hopefully not too complex.

问题:
(1)如果所有服务器需要处理的用户可以通过任一服务器进行登录的所有消息,这是否规模有多大?
(2)我是否需要某种形式的消息队列的服务器之间他们说话?是的RabbitMQ发布 - 订阅可用于此?或者,如果zeromq,我将如何扩展与酒吧子?该Zeromq指南具有缩放与REQ / REP类型的应用多台服务器的解释。但不是酒吧子。
(3)或我应该开始与XMPP?

Questions: (1) If all servers need to handle all messages as users can be logged on via any of the servers, does this scale? (2) Do I need some sort of message queue for the servers to talk among them? Is Pub-sub from Rabbitmq usable for this? Or if zeromq, how would I scale with pub sub? The Zeromq guide is has explanations for scaling to more than one server with REQ/REP type of applications. But not Pub Sub. (3) Or should I start with XMPP?

我希望能使其工作尽可能轻松。

I am hoping to make it work as easy as possible.

推荐答案

有是在Socket.io网站相当不错的解释。看看

There's a rather good explanation at the Socket.io site. Have a look at

  • http://socket.io/docs/using-multiple-nodes/

这表明使用Nginx的作为HTTP负载平衡器,Node.js的集群(带粘性会话)和Redis的作为消息后端。

It suggests using Nginx as HTTP load balancer, Node.js clustering (with sticky sessions) and Redis as the message backend.

我觉得你的目标应该是可以实现与几乎没有编码参与,只能使用给定的模块和配置机制。

I think your goals should be achievable with little to none coding involved, only using the given modules and configuration mechanisms.

这篇关于战略实施可扩展的聊天服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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