【问题标题】:How to check the scalability of my application如何检查我的应用程序的可扩展性
【发布时间】:2010-12-01 14:45:23
【问题描述】:

我开发了一个应用程序,可以创建大量 PDF 并提供这些文件。 (其正常的 Servlet 缓冲服务)。

如何确保我的应用程序能够高效地处理多个请求?是否有任何工具可用于测试负载/可扩展性/效率以及我的代码在当前服务器配置下处理多少并行请求?

【问题讨论】:

    标签: java performance tomcat scalability serving


    【解决方案1】:

    你可以使用像Tsung这样的负载测试器

    【讨论】:

      【解决方案2】:

      您应该考虑使用负载测试工具,例如 grinderjmeter。 grinder 支持脚本,而 jmeter 可以让你把 junit 变成负载测试客户端。我个人喜欢 jmeter,因为 junit 支持以及它的精细 gui 控制和报告。 jmeter 开箱即用地支持 http 和 soap。此外,您可以编写自己的插件以满足您的自定义需求。

      【讨论】:

        【解决方案3】:

        我也会推荐JMeter。您还可以记录浏览器的页面请求以创建 JMeter 测试 (HTTP Proxy Server)。

        【讨论】:

          【解决方案4】:

          您还应该使用监控工具来查看应用程序在负载下的行为。

          最新的 Sun JDK 中的 jvisualvm 是一个好的开始。

          【讨论】:

            【解决方案5】:

            您可以做的最简单的事情是 Apache 基准测试,如果您正在运行基于 Unix 的系统或随 Windows 的 Apache Webserver 2.x 一起提供,则它可能已经安装。

            使用示例;

            $ ab -n 1000 -c 20 http://www.google.com/
            

            给我这个输出;

            This is ApacheBench, Version 2.3 <$Revision: 655654 $>
            Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
            Licensed to The Apache Software Foundation, http://www.apache.org/
            
            Benchmarking www.google.com (be patient)
            Completed 100 requests
            Completed 200 requests
            Completed 300 requests
            Completed 400 requests
            Completed 500 requests
            Completed 600 requests
            Completed 700 requests
            Completed 800 requests
            Completed 900 requests
            Completed 1000 requests
            Finished 1000 requests
            
            
            Server Software:        gws
            Server Hostname:        www.google.com
            Server Port:            80
            
            Document Path:          /
            Document Length:        218 bytes
            
            Concurrency Level:      20
            Time taken for tests:   1.826 seconds
            Complete requests:      1000
            Failed requests:        0
            Write errors:           0
            Non-2xx responses:      1000
            Total transferred:      807000 bytes
            HTML transferred:       218000 bytes
            Requests per second:    547.55 [#/sec] (mean)
            Time per request:       36.527 [ms] (mean)
            Time per request:       1.826 [ms] (mean, across all concurrent requests)
            Transfer rate:          431.51 [Kbytes/sec] received
            
            Connection Times (ms)
                          min  mean[+/-sd] median   max
            Connect:        9   12  14.7     10     337
            Processing:    11   24  26.8     17     306
            Waiting:       11   22  21.1     16     297
            Total:         21   36  30.5     28     350
            
            Percentage of the requests served within a certain time (ms)
              50%     28
              66%     36
              75%     39
              80%     41
              90%     45
              95%     54
              98%     93
              99%    253
             100%    350 (longest request)
            

            【讨论】:

              【解决方案6】:

              Apachebench 是一个单线程工具。这意味着它将无法使 SMP 服务器饱和(多线程或多进程)。

              您应该考虑使用 AB 语法的 weighttp(唯一的区别是 -t 4 表示使用 4 个工作线程而不是 4 秒测试)。

              【讨论】:

                猜你喜欢
                • 1970-01-01
                • 2011-05-29
                • 1970-01-01
                • 2020-11-19
                • 2014-09-13
                • 1970-01-01
                • 2015-05-25
                • 2011-03-28
                • 2014-12-28
                相关资源
                最近更新 更多