如何在tomcat上处理2000多个请求/秒? [英] how to handle 2000+ requests/sec on tomcat?

查看:231
本文介绍了如何在tomcat上处理2000多个请求/秒?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java开发一个SMS应用程序。我的客户通过短信发送查询,这些查询将通过短信网关以http请求的形式转发到我的服务器。现在,我的应用程序处理请求,并通过SMS Gateway再次向客户端发回响应。最多只能发送300个字符作为响应。我期待非常高的流量(2000个请求/秒)。我想与一些虚拟主机公司(考虑到mochahost)托管我的应用程序。在托管(RAM,CPU等)之间我应该考虑哪些因素以及主要瓶颈是什么?如果调整得当,专用的tomcat服务器可以处理如此高的流量吗?你有什么建议?

I am developing an SMS application in Java. My clients send queries via SMS which will be forwarded to my server in the form of http requests through SMS Gateway. Now my app processes the requests and sends back responses to clients again through SMS Gateway. Maximum only 300 characters are sent as response. I'm expecting very high traffic (2000 requests/sec). I wanted to host my application with some webhosting company (considering mochahost). What factors should I consider before hosting (interms of RAM, CPU, etc) and also what shall be the major bottlenecks? Can dedicated tomcat server handle such high traffic if tuned properly? What are your suggestions?

没有数据库交互(我只使用Java堆内存)。我用JMeter进行了测试(100个请求/秒)。我的堆内存使用量是35MB,平均响应时间是532ms。而且我没有使用任何会话变量。

There is no database interaction (I'm only using Java heap memory). I ran a test with JMeter(100 requests/sec). My heap memory usage was 35MB and average response time was 532ms.And also i'm not using any session variables.

推荐答案

这是很难回答你的问题而不知道你在servlet中做了什么。但简短的回答是它与tomcat没有任何关系。

It's difficult to answer your question without knowing what you're doing in your servlet. But the short answer is that it really doesn't have anything to do with tomcat.

我们目前在我们的Tomcat服务器上使用戴尔R410s(双四核,32G内存) 。对于与后端的membase集群通信的REST服务,我们可以在单个服务器上轻松处理~15k req /秒(这是使用Jersey JAX-RS实现)。我们目前有4个这样的F5负载均衡器。这些请求中的每一个平均在大约10ms内得到服务。

We current use Dell R410s (dual quad core, 32G ram) for our Tomcat servers. For a REST service that talks to a membase cluster on the back end we can easily process ~ 15k req/second on a single server (this is using the Jersey JAX-RS implementation). We currently have 4 of these behind an F5 load balancer. Each of these requests is serviced in about 10ms on average.

真正归结为并发性; servlet需要多长时间才能完成对请求所需的操作。你有一个线程用于每个并发请求,所以如果你尝试2000 req / sec并且一个请求需要500ms来处理......你将需要一些硬件。问题不是tomcat,而是servlet的可用资源之一。

What it really comes down to is the concurrency; How long does it take your servlet to do what it needs to do with a request. You've got a thread going for every concurrent request, so if you're trying to 2000 req/sec and a single request takes 500ms to process ... you're going to need a bit of hardware. The issue isn't tomcat, but one of available resources for your servlet.

这篇关于如何在tomcat上处理2000多个请求/秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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