聊天应用程序的 apache 调优建议

发布于 2024-09-01 01:30:28 字数 277 浏览 9 评论 0原文

我有一个聊天应用程序(xmpp / muc),将由 apache 提供服务(我们稍后可能会更改为 nginx,但现在这并不容易做到)。如果用户在 2 个房间中,他将与服务器有 2 到 4 个活动连接(长轮询连接),因此,如果每个房间有 200 个用户并且有 5 个房间,则应该设置 ServerLimit、MaxClients到?例如,以下是默认值:

ServerLimit 256

MaxClients 256

MaxRequestsPerChild 4000

谢谢,

I have a chat application (xmpp / muc) that is going to be served by apache (we might change to nginx later but right now it's not easily done). If a user is in 2 rooms, he'll have between 2 and 4 active connections to the server (long-polling connections), so if we have 200 users per room and we have 5 rooms, what should the ServerLimit, MaxClients be set to? For example, these are the default values:

ServerLimit 256

MaxClients 256

MaxRequestsPerChild 4000

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

做个少女永远怀春 2024-09-08 01:30:28

如果您使用 BOSH 之类的东西来建立 Web->XMPP 连接,每个用户应该只有一个到 XMPP 服务器的连接。每个 MUC 房间活动都将以用户的 JID 作为目标发送到 XMPP 服务器,这将导致服务器将其发送到适当的 BOSH 连接。存在感也一样。

负载平衡 Apache 设置所需的信息与负载平衡任何长轮询连接所需的信息相同 - XMPP 不会添加任何奇异的内容。 XMPP BOSH 连接是与 Web 服务器的长轮询连接,然后将其发送到与 XMPP 服务器的持久连接 - 导致每个用户连接打开 2 个套接字。

Each user should only have a single connection to the XMPP server if your using something like BOSH to make the Web->XMPP connection. Each MUC room activity will be sent to the XMPP server with the user's JID as the target and that will cause the server to send that to the appropriate BOSH connection. Same for presence.

The information you need to load balance the Apache setup is the same as load balancing any long-polling connection - XMPP doesn't add anything exotic to the mix. An XMPP BOSH connection is a long-polling connection to your web server which is then sent to a persistent connection to the XMPP server - causing 2 sockets to be opened per user connect.

烧了回忆取暖 2024-09-08 01:30:28

我猜这是一个预分叉的 Apache...

如果您有 1000 个并发聊天连接,那么您至少需要 1000 个网络服务器(大概您也会提供静态内容,并且您说每个存在都会产生结果)在 2 个连接中 - 所以你可以将 1000 加倍) - 256 的 ServerLimit/MaxClients 不会削减它,你可能需要大约 2200 来支持这一点(但没有硬指标,很难给出确切的数字)。

这是一个大得离谱的数额。为了支持这一点,我需要寻找 3 个盒子,每个盒子在网络服务器启动之前都有大约 2Gb 的可用内存。

MaxRequestsPerChild 并不真正相关,除了您想要一些流程周转的事实之外,特别是在您使用长轮询的情况下。

这就是 COMET 不是一个好主意的原因之一。使用 AJAX 轮询会更加高效。假设这不是你可以改变的东西,你可能想看看使用线程 Apache Web 服务器,它的内存效率更高,

C。

I'm guessing this a pre-fork Apache....

If you've got 1000 concurrent chat connections, then you need at least 1000 webservers (presumably you'll be serving up static content too, and you say that each presence results in 2 connections - so you can double the 1000) - a ServerLimit/MaxClients of 256 is not going to cut it, you probably need around 2200 to support this (but without hard metrics its hard to give an exact figure).

This is a ridiculously large amount. To support this I'd be looking for 3 boxes, each with about 2Gb free memory before the webserver is started.

MaxRequestsPerChild is not really relevant other than the fact you want some turnover of processes, particularly if you are using long polling.

This is one of the reasons why COMET is not a good idea. Using AJAX polling would be much more efficient. Assuming this is not something you can change, you might want to have a look at using a threaded Apache webserver which is marginally more memory efficient,

C.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文