How to scale a slack bot to 1000's of teams

荒凉一梦 提交于 2019-12-03 03:33:57

With slack sockets, you have lots of things to scale:

  • Number of sockets. This is easy because even cheap servers can handle thousands of sockets, like more than 50k. But each socket represents a couple other types of load, listed next.
  • Amount of memory used per team, which depends on your own server implementation. If you are trying to keep a large amount of message history in memory, you will hit your server's limit faster than if your message processing code is somewhat stateless.
  • Amount of I/O, which might make you want to offload any image serving to a separate load balancer.

The other thing to consider is fault-tolerance. Let's say you did sticky load balancing and one of your servers is handling 50 teams. That server is the only one handling those 50 teams so if it goes down then all 50 bots go offline. Alternatively, you can open up multiple sockets per team on separate servers and use a message handling queue so that each message is only responded to once.

So the architecture I would propose is a thin, redundant load balancer for RTM sockets as a first layer, and a reliable message queue underneath that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!