独立 Tomcat 6.0.* + 20,000 个同时连接 [英] Standalone Tomcat 6.0.* + 20,000 simultaneous connections

查看:15
本文介绍了独立 Tomcat 6.0.* + 20,000 个同时连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何将 Tomcat 6.0 配置为可以同时处理 20,000 个连接的独立 Web 服务器(在 Windows XP 上)?请帮帮我.

Does anyone know how to configure Tomcat 6.0 as a standalone web server (on Windows XP) that can handle 20,000 simultaneous connections? Please help me.

推荐答案

如果你配置它使用 HTTP NIO 连接器并给它足够的内存,理论上它必须能够做到.

If you configure it to use the HTTP NIO connector and give it enough memory, it must in theory be able to do so.

使用普通的 HTTP 连接器时,性能会在 1K 左右的连接数左右开始下降,然后在 5K 左右的同时连接数上急剧下降,这仅仅是因为每个连接都隐含地使用自己的线程.HTTP NIO 连接器有足够的单线程扩展性,很多更好.

With the normal HTTP connector, the performance will start to slowdown around 1K connections and then drastically drop around 5K simultaneous connections, simply because each connection implicitly uses its own thread. The HTTP NIO connector has enough with a single thread which scales much, much better.

基本上你需要做的就是替换 HTTP 连接器HTTP/1.1 的默认 protocol 属性与 org.apache.coyote.http11.Http11NioProtocol:

Basically all you need to do is to replace the HTTP connector's default protocol attribute of HTTP/1.1 with org.apache.coyote.http11.Http11NioProtocol:

<Connector
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    port="80"
    redirectPort="8443"
    connectionTimeout="20000"
    compression="on" />

并给它足够的内存.对于 20K 连接,从 2GB 开始.您可以在 Tomcat 系统托盘工具中进行设置.

And give it enough memory. With 20K connnections, start with 2GB. You can set it in the Tomcat systray tool.

然而,这是一个边缘情况,也取决于所使用的硬件.如果 CPU 和磁盘 I/O 变得非常高,那么我仍然建议放置第二个 Tomcat 服务器和 集群 服务器.

This is however an edge case which is also dependent on the hardware used. If the CPU's and disk I/O gets really high, then I'd still recommend to place a 2nd Tomcat server and cluster the servers.

这篇关于独立 Tomcat 6.0.* + 20,000 个同时连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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