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

发布于 2024-09-14 00:48:01 字数 797 浏览 8 评论 0原文

我想更深入地了解部署到单个 Tomcat 实例的单服务器 Java Web 应用程序可以处理的工作负载规模。特别是,假设我正在开发一个 Wiki 应用程序,该应用程序具有与 Wikipedia 类似的使用模式。如果我将服务器部署在具有以下配置的计算机上,在出现内存不足或出现压力过大的迹象之前,我的服务器可以可靠地处理多少个并发请求:

  • 4 核高端 Intel Xeon CPU
  • 8GB RAM
  • 2 个 RAID-1 硬盘(无 SSD、无基于 PCIe 的固态存储)
  • RedHat 或 Centos Linux(64 位)
  • Java 6(64 位)
  • MySQL 5.1 / InnoDB

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

  • SpringMVC 用于前端
  • Hibernate/JPA 用于持久性
  • Spring 用于 DI 和安全性等。

如果您还没有使用过确切的配置,但有评估经验类似架构的可扩展性,我也很有兴趣听到这一点。

提前致谢。

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

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-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

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 for the front-end
  • Hibernate/JPA for persistence
  • Spring for DI and Security, etc.

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.

Thanks in advance.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

无声情话 2024-09-21 00:48:01

您将需要使用一组工具:

  1. 可以使用负载测试工具 - JMeter。
  2. 监控工具 - 该工具将用于监控各种数量的资源负载。有付费的也有免费的。 Jprofiler、visualvm
  3. 收集和报告工具。 (未使用任何工具)

通过以上工具您可以找到最佳值。我会通过以下方式处理它。

  1. 将了解被访问的页面的比率应该是多少。什么是后台进程及其频率。
  2. 相应地配置我的 JMeter(对于比率),并监视所应用负载的性能(服务页面的时间...可以在 JMeter 中完成),使用监视器工具监视其他资源。还要检查错误率的计数。 (注意:您需要决定什么错误率是不可接受的。)
  3. 继续逐步增加负载并继续写入各种感兴趣的数字,直到服务器完全失败。

您可以根据许多标准、低错误率、最长服务时间等来决定最佳值。
JMeter 支持多种施加负载的方法。

You will need to use group of tools :

  1. Loadtesting Tool - JMeter can be used.
  2. Monitoring Tool - This tool will be used to monitor various numbers of resources load. There are Lot paid as well as free ones. Jprofiler,visualvm,etc
  3. Collection and reporting tool. (Not used any tool)

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

  1. will get to know what should be ratio of pages being accessed. What are background processes and their frequency.
  2. Configure my JMeter accordingly (for ratios) , and monitor performance for load applied ( time to serve page ...can be done in JMeter), monitor other resources using Monitor tool. Also check count of error ratio. (NOTE: you need to decide upon what error ratio is not acceptable.)
  3. Keep increasing Load step by step and keep writting various numbers of interest till server fails completely.

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.

淡淡離愁欲言轉身 2024-09-21 00:48:01

说实话,这几乎是不可能说的。可能有大约 3 种方法(我的想法可以构建这样一个系统),每种方法都有相当不同的性能特征。最好的选择是构建和测试。

首先尝试了解您将拥有的估计数量以及需要满足的延迟限制。

提出一个基本架构并通过系统实现端到端的薄片(理想情况下是最常见的用例)。使用负载测试工具,例如 (GrinderApache JMeter) 注入负载并开始测量性能。如果性能可以接受 - 保守一点,您的简单实现可能会包含更少的功能并且比完整系统更快 - 继续构建系统并进行测试以确保不会引入主要的性能瓶颈。如果没有想出不同的设计。

如果您的代码合理,瓶颈可能是数据库以及每秒 100 多个数据库操作的区域。如果这还不够,那么您可能需要考虑缓存。

To be honest, it's almost impossible to say. There's probably about 3 ways (of the top of my head to build such a system) and each would have fairly different performance characteristics. You best bet is to build and test.

Firstly try to get some idea of what the estimated volumes you'll have and the latency constraints that you'll need to meet.

Come up with a basic architecture and implement a thin slice end to end through the system (ideally the most common use case). Use a load testing tool like (Grinder or Apache JMeter) to inject load and start measuring the performance. If the performance is acceptable - be conservative your simple implementation will likely include less functionality and be faster than the full system - continue building the system and testing to make sure you don't introduce a major performance bottleneck. If not come up with a different design.

If your code is reasonable the bottleneck will likely be the database and somewhere in the region 100s of db ops per second. If that is insufficient then you may need to think about caching.

诗笺 2024-09-21 00:48:01

一定要看看 Spring Insight 用于性能监控和分析。

Definitely take a look at Spring Insight for performance monitoring and analysis.

维持三分热 2024-09-21 00:48:01

英文维基百科有14GB数据。 8GB 内存缓存的命中/未命中率非常高,我认为硬盘读取完全在其容量范围内。因此,该应用程序很可能受网络限制。

英文维基百科每秒的页面浏览量约为 3000 次。通过仔细调整,tomcat 可能可以处理负载,并且网络有足够的吞吐量来处理流量。

那么整个维基百科网站可以托管在一台中等机器上吗?可能不会。只是一个想法。

-

http://stats.wikimedia.org/EN/TablesWikipediaEN.htm

http://stats.wikimedia.org/EN/TablesPageViewsMonthly.htm

English Wikipedia has 14GB data. A 8GB mem cache would have very high hit/miss ratio, and I think harddisk read would be well within its capacity. Therefore, the app is most likely network bound.

English Wikipedia has about 3000 page views per second. It is possible that tomcat can handle the load by careful tuning, and the network has enough throughput to server the traffic.

So the entire wikipedia site can be hosted on one moderate machine? Probably not. Just an idea.

-

http://stats.wikimedia.org/EN/TablesWikipediaEN.htm

http://stats.wikimedia.org/EN/TablesPageViewsMonthly.htm

萌梦深 2024-09-21 00:48:01

Tomcat 不允许分布在多台机器上。如果您确实关心可扩展性,则必须考虑当您的应用程序无法满足单台计算机的需求时该怎么办。

Tomcat doesn't allow for spreading over multiple machines. If you really are concerned about scalability, you must consider what to do when your application outgrows a single machine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文