用于运行Java Web应用程序的单个服务器的可伸缩性

问题描述:

我希望获得有关部署到单个Tomcat实例的单服务器Java Web应用程序可以处理的工作负载规模的更多信息。特别是,让我假装我正在开发一个类似*的使用模式的Wiki应用程序。如果我将服务器部署在具有以下配置的计算机上,我的服务器可以在内存不足之前可以同时处理多少请求,或者显示压力过大的迹象:

I want to gain more insight regarding the scale of workload a single-server Java Web application deployed to a single Tomcat instance can handle. In particular, let's pretend that I am developing a Wiki application that has a similar usage pattern like Wikipedia. How many simultaneous requests can my server handle reliably before going out of memory or show signs of excess stress if I deploy it on a machine with the following configuration:


  • 4核高端Intel Xeon CPU

  • 8GB RAM

  • RAID-1中的2个HDD(无SSD,无基于PCIe)固态存储)

  • RedHat或Centos Linux(64位)

  • Java 6(64位)

  • MySQL 5.1 / InnoDB

  • 4-Core high-end Intel Xeon CPU
  • 8GB RAM
  • 2 HDDs in RAID-1 (No SSDs, no PCIe based Solid State storages)
  • RedHat or Centos Linux (64-bit)
  • Java 6 (64-bit)
  • MySQL 5.1 / InnoDB

此外,我们假设MySQL数据库与Tomcat安装在同一台机器上,并且所有Wiki都安装在数据存储在DB中。此外,让我们假装Java应用程序构建在以下堆栈之上:

Also let's assume that the MySQL DB is installed on the same machine as Tomcat and that all the Wiki data are stored inside the DB. Furthermore, let's pretend that the Java application is built on top of the following stack:


  • 前端的SpringMVC

  • 持久化的Hibernate / JPA

  • DI和安全等的弹簧

如果你没有使用确切的配置,但有评估类似架构的可扩展性的经验,我也会非常有兴趣听到这个。

If you haven't used the exact configuration but have experience in evaluating the scalability of a similar architecture, I would be very interested in hearing about that as well.

提前致谢。

编辑:我想我没有正确地表达我的问题。我用最多的选票标记答案作为最佳答案,我将在社区维基区域重写我的问题。简而言之,我只想了解您在 Java 应用程序能够在一台物理服务器上处理的工作负载规模的经验,以及有关应用程序本身的类型和体系结构的一些描述。

EDIT: I think I have not articulated my question properly. I mark the answer with the most up votes as the best answer and I'll rewrite my question in the community wiki area. In short, I just wanted to learn about your experiences on the scale of workload your Java application has been able to handle on one physical server as well as some description regarding the type and architecture of the application itself.

您需要使用工具组:


  1. 负载测试工具 - 可以使用JMeter。

  2. 监控工具 - 此工具将用于监控各种数量的资源负载。有批量付费和免费付款。 Jprofiler, visualvm

  3. 收集和报告工具。 (未使用任何工具)

使用上述工具,您可以找到最佳值。我会按照以下方式接近它。

With above tools you can find optimal value. I would approach it in following way.


  1. 将了解应该访问的页面的比例。什么是后台进程及其频率。

  2. 相应地配置我的JMeter(对于比率),并监控应用负载的性能(服务页面的时间......可以在JMeter中完成),使用Monitor工具监控其他资源。还要检查错误率的计数。 (注意:您需要确定哪些错误率是不可接受的。)

  3. 继续增加负载一步一步并保持写入各种感兴趣的数据直到服务器完全失败。

您可以根据许多标准,低错误率,最长服务时间等来确定最佳值。
JMeter支持多种应用加载方式。

You can decide upon optimal value based on many criterias, Low error rate, Max serving time etc. JMeter supports lot of ways to apply load.