java - tomcat的性能极限是多少?

标签 java performance tomcat load-testing

简短的问题:我的 tomcat 服务器的最大速度为 850 MB/秒。这符合逻辑吗?

我正在尝试对我的 tomcat 安装进行基准测试。该服务器是一个后端存储服务器,我希望它的速度达到 ~2.5 GBytes/S per second (30 gBits) 。这不是互联网服务器。它是一个云计算节点,有几个光纤卡。我有兴趣尽可能接近理论极限。

当使用真正的 S/W 进行基准测试时,我的表现低于标准。我用“虚拟”小服务程序(如下)测试了 tomcat。我达到了 850 MBytes/s 的最大值。但是我的 CPU 只有 30% 忙。这符合逻辑吗?

我正在使用 apache ab 进行测试:

ab -c 100 -n 10000  localhost:8080/tcbench/tcbench

我的设置是带有 32GB 内存的 E31260L XEON、Ubuntu 12.04 和带有 JDK 7(默认配置文件)的 Oracale tomcat7。

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 
public class tcbench extends HttpServlet {
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("application/text;charset=UTF-8");
        PrintWriter out = response.getWriter();
        try {
            out.print(testBuffer);
        } finally {            
            out.close();
        }
    }

    static char[] testBuffer=new char[128*1024];

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        processRequest(request, response);
    }

    @Override
    public String getServletInfo() {
        return "Short description";
    }
}

最佳答案

如果您不受 CPU 限制……这通常意味着有其他因素阻碍了您。

您正在使用访问记录器或其他日志记录吗?

关于java - tomcat的性能极限是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19686244/

相关文章:

ajax - 谷歌自动完成 - 极快的速度,没有延迟

apache - 我可以有两个单独的 Web 服务器/应用程序服务器访问同一个数据库,mysql

java - 使用给定的可变参数替换模板中的 {0}、{1} .. {n}

java - 使用 proxool 时,是否需要显式关闭每个 getConnection()?

Java 正则表达式 空格或括号开头

php - 是否可以在 PHP 中保留内存 (RAM) 中的变量?

jquery-animate - jquery 或动画 png/gif 哪个更适合网页上的图像动画?

java - 无法使用 spring boot 渲染 thymeleaf

spring - 为什么我得到 "HTTP Status 404 - Servlet <servlet name> is not available"

mysql - DataSource maxActive在tomcat mysql中没有变化