是否有人有在 Amazon Tigase XMPP 服务器的经验">EC2,主要是我想知道任何可能让我困惑的不明显的事情。 (例如,显然在 EC2 上运行 Ejabberd 可能会因 Mnesia 导致问题。)
或者,如果您对在 Ubuntu 上安装和运行 Tigase 有任何一般建议。
额外信息:
我正在开发的系统使用 XMPP 只是在移动应用程序和服务器之间进行通信(近乎实时)。
用户数量最初会很少,但希望会增加。这就是系统需要可扩展的原因。想必对于只有几千个用户,您不需要 cc1.4xlarge EC2 实例? (否则运行起来会非常昂贵!)
我计划使用托管在 Amazon RDS 中的 MySQL 数据库作为 XMPP服务器数据库。
我还计划使用 SleekXMPP 创建一个用 Python 编写的外部 XMPP 组件。正是这个外部组件完成了服务器的所有“工作”,因为我正在制作的应用程序与即时消息传递有很大不同。对于这一部分,我还没有弄清楚如何将用 Python 编写的外部 XMPP 组件连接到 Tigase 服务器。 文档似乎表明组件是专门为 Tigase 编写的 - 而不是为通用 XMPP 服务器编写的,使用 XEP-0114:Jabber 组件协议,正如我所料。
有了这些额外的信息,如果您能想到我应该知道的其他任何信息,我将很高兴知道。
谢谢 :)
Does anyone have an experience running clustered Tigase XMPP servers on Amazon's EC2, primarily I wish to know about anything that might trip me up that is non-obvious. (For example apparently running Ejabberd on EC2 can cause issues due to Mnesia.)
Or if you have any general advice to installing and running Tigase on Ubuntu.
Extra information:
The system I’m developing uses XMPP just to communicate (in near real-time) between a mobile app and the server(s).
The number of users will initially be small, but hopefully will grow. This is why the system needs to be scalable. Presumably for a just a few thousand users you wouldn’t need a cc1.4xlarge EC2 instance? (Otherwise this is going to be very expensive to run!)
I plan on using a MySQL database hosted in Amazon RDS for the XMPP server database.
I also plan on creating an external XMPP component written in Python, using SleekXMPP. It will be this external component that does all the ‘work’ of the server, as the application I’m making is quite different from instant messaging. For this part I have not worked out how to connect an external XMPP component written in Python to a Tigase server. The documentation seems to suggest that components are written specifically for Tigase - and not for a general XMPP server, using XEP-0114: Jabber Component Protocol, as I expected.
With this extra information, if you can think of anything else I should know about I’d be glad to know.
Thank you :)
发布评论
评论(1)
我有很多经验。我认为存在很多不明显的问题。像运行 Tigase 这样的应用程序的唯一可靠实例是 cc1.4xlarge。其他人会导致 CPU 可用性问题,这只是一场抽奖,无论您是否足够幸运能够在不忙于其他人工作的服务器上运行您的服务。
此外,您还需要一个具有尽可能高 I/O 的实例,以确保它能够应对网络流量。高I/O尤其适用于数据库实例。
不确定这是否明显,但 EC2 上的主机名存在此问题,每次启动实例时,主机名都会更改,IP 地址也会更改。 Tigase 集群对主机名非常敏感。有一种方法可以强制/更改实例的主机名,因此这可能是解决该问题的方法。
当然,我指的是数百万在线用户的集群,以及每秒 100k XMPP 数据包或更多的高流量。一般来说,对于大型安装来说,拥有专用服务器更便宜、更高效。
一般来说,Tigase 在 Amazon EC2 上运行得很好,但您确实需要最新的 SVN 代码,因为它添加了很多优化,特别是在云上测试之后。如果您提供有关您的服务的更多详细信息,我可能会有更多建议。
更多评论:
如果谈到成本,专用服务器始终是持续运行服务的更便宜的选择。除非您计划每小时打开/关闭服务器,否则我建议您选择一些专门的服务。成本更低,性能更可预测。
但是,如果您确实想要/需要坚持使用 Amazon EC2,请让我给您一些具体数字,下面是实例列表以及集群能够可靠处理的在线用户数量:
更多评论:
也就是说,我认为安装最多 10k 在线用户应该没问题。然而,其他因素(例如名册大小)也非常重要,因为它们会影响流量和负载。此外,如果您有其他元素会产生大量流量,这也会给您的系统带来负载。
无论如何,如果不进行一些测试,就无法判断系统的真实行为或是否可以处理负载。
关于组件的最后一个问题:
当然,Tigase 确实支持 XEP-0114 和 XEP-0225 用于连接外部组件。所以对于用不同语言编写的组件来说这不应该是问题。另一方面,我建议使用 Tigase 的 API 来编写组件。它们可以部署为内部 Tigase 组件或外部组件,这对开发人员来说是透明的,您不必在开发时担心这一点。这是 API 和框架的一部分。
此外,您还可以使用 Tigase 框架的所有功能、脚本功能、监控、统计、更轻松的开发,因为您可以轻松地将代码部署为内部组件进行测试。
您实际上不必担心任何 XMPP 特定的东西,您只需填充 processPacket(...) 方法的主体即可。
Tigase 网站上应该有足够的在线文档来说明所有这些内容。
另外,我建议阅读有关 Python 对多线程的支持以及它在非常高的负载下的行为方式的信息。它曾经不是那么伟大。
I have lots of experience. I think there is a load of non-obvious problems. Like the only reliable instance to run application like Tigase is cc1.4xlarge. Others cause problems with CPU availability and this is just a lottery whether you are lucky enough to run your service on a server which is not busy with others people work.
Also you need an instance with the highest possible I/O to make sure it can cope with network traffic. The high I/O applies especially to database instance.
Not sure if this is obvious or not, but there is this problem with hostnames on EC2, every time you start instance the hostname changes and IP address changes. Tigase cluster is quite sensitive to hostnames. There is a way to force/change the hostname for the instance, so this might be a way around the problem.
Of course I am talking about a cluster for millions of online users and really high traffic 100k XMPP packets per second or more. Generally for large installation it is way cheaper and more efficient to have a dedicated servers.
Generally Tigase runs very well on Amazon EC2 but you really need the latest SVN code as it has lots of optimizations added especially after tests on the cloud. If you provide some more details about your service I may have some more suggestions.
More comments:
If it comes to costs, a dedicated server is always cheaper option for constantly running service. Unless you plan to switch servers on/off on hourly basis I would recommend going for some dedicated service. Costs are lower and performance is way more predictable.
However, if you really want/need to stick to Amazon EC2 let me give you some concrete numbers, below is a list of instances and how many online users the cluster was able to reliably handle:
A few more comments:
That said I think with installation of up to 10k online users you should be fine. However, other factors like roster size greatly matter as they affect traffic, and load. Also if you have other elements which generate a significant traffic this will put load on your system.
In any case, without some tests it is impossible to tell how really your system behaves or whether it can handle the load.
And the last question regarding component:
Of course Tigase does support XEP-0114 and XEP-0225 for connecting external components. So this should not be a problem with components written in different languages. On the other hand I recommend using Tigase's API for writing component. They can be deployed either as internal Tigase components or as external components and this is transparent for the developer, you do not have to worry about this at development time. This is part of the API and framework.
Also, you can use all the goods from Tigase framework, scripting capabilities, monitoring, statistics, much easier development as you can easily deploy your code as internal component for tests.
You really do not have to worry about any XMPP specific stuff, you just fill body of processPacket(...) method and that's it.
There should be enough online documentation for all of this on the Tigase website.
Also, I would suggest reading about Python support for multi-threading and how it behaves under a very high load. It used to be not so great.