作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
简短的问题:我的 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/
如何限制 Realm 返回的对象数量? .findAll 返回匹配查询的所有行,而 .findFirst 只返回第一行。但是像前 1000 这样的东西呢? .findAll 可能会返回太多的行,以至于
SELECT * FROM table WHERE city LIKE example ORDER by RAND() Limit 10 我正在尝试从表中返回一些随机条目,但它在相当多的页面上被点击
我是一名优秀的程序员,十分优秀!