51Testing软件测试论坛

标题: 关于apache自带的ab做并发测试的问题。 [打印本页]

作者: 测试积点老人    时间: 2019-7-17 09:57
标题: 关于apache自带的ab做并发测试的问题。
各位高手,大家好,
   我现在这边有个棘手的问题需要解决,需要大家慷慨解囊。
   问题是这样的,我使用ab来做并发测试,看具体的并发数和相应时间。
   当我使用ab  -n 10000  -c 2000 http://192.168.1.123:8080/test/test.html.
   系统报错;
  1. This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 [        DISCUZ_CODE_10        ]gt; apache-2.0
  2.    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
  3.    Copyright 1997-2005 The Apache Software Foundation, http://www.apache.org/

  4.    Benchmarking 192.168.1.123 (be patient)
  5.    apr_pollset_create failed: Invalid argument (22)
复制代码
经过测试系统-c并发数请求超过1024就会报以上的错误。

   上网找过类似问题,说是配置一下操作系统的注册表,调整MaxUserPort十进制为32768,TcpTimedWaitDelay十进制为240
   重启系统,经过测试还是报同样的错误。

   类似的问题说apache 的httpd.conf,启用httpd-mpm.conf ,并配置httpd-mpm.conf 如下:
  1. #
  2. # Server-Pool Management (MPM specific)
  3. #

  4. #
  5. # PidFile: The file in which the server should record its process
  6. # identification number when it starts.
  7. #
  8. # Note that this is the default PidFile for most MPMs.
  9. #
  10. <IfModule !mpm_netware_module>
  11.     PidFile "logs/httpd.pid"
  12. </IfModule>

  13. #
  14. # The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
  15. #
  16. <IfModule !mpm_winnt_module>
  17. <IfModule !mpm_netware_module>
  18. LockFile "logs/accept.lock"
  19. </IfModule>
  20. </IfModule>

  21. #
  22. # Only one of the below sections will be relevant on your
  23. # installed httpd.  Use "apachectl -l" to find out the
  24. # active mpm.
  25. #

  26. # prefork MPM
  27. # StartServers: number of server processes to start
  28. # MinSpareServers: minimum number of server processes which are kept spare
  29. # MaxSpareServers: maximum number of server processes which are kept spare
  30. # MaxClients: maximum number of server processes allowed to start
  31. # MaxRequestsPerChild: maximum number of requests a server process serves
  32. <IfModule mpm_prefork_module>
  33.     StartServers          5
  34.     MinSpareServers       5
  35.     MaxSpareServers      10
  36.     ServerLimit        5500
  37.     MaxClients         5000
  38.     MaxRequestsPerChild 10000
  39. </IfModule>

  40. # worker MPM
  41. # StartServers: initial number of server processes to start
  42. # MaxClients: maximum number of simultaneous client connections
  43. # MinSpareThreads: minimum number of worker threads which are kept spare
  44. # MaxSpareThreads: maximum number of worker threads which are kept spare
  45. # ThreadsPerChild: constant number of worker threads in each server process
  46. # MaxRequestsPerChild: maximum number of requests a server process serves
  47. <IfModule mpm_worker_module>
  48.     StartServers          3
  49.     ServerLimit         5500
  50.     MaxClients          5000
  51.     MinSpareThreads      50
  52.     MaxSpareThreads      200
  53.     ThreadLimit          200
  54.     ThreadsPerChild      100
  55.     MaxRequestsPerChild  10000
  56. </IfModule>

  57. # BeOS MPM
  58. # StartThreads: how many threads do we initially spawn?
  59. # MaxClients:   max number of threads we can have (1 thread == 1 client)
  60. # MaxRequestsPerThread: maximum number of requests each thread will process
  61. <IfModule mpm_beos_module>
  62.     StartThreads            10
  63.     MaxClients             5000
  64.     MaxRequestsPerThread 10000
  65. </IfModule>

  66. # NetWare MPM
  67. # ThreadStackSize: Stack size allocated for each worker thread
  68. # StartThreads: Number of worker threads launched at server startup
  69. # MinSpareThreads: Minimum number of idle threads, to handle request spikes
  70. # MaxSpareThreads: Maximum number of idle threads
  71. # MaxThreads: Maximum number of worker threads alive at the same time
  72. # MaxRequestsPerChild: Maximum  number of requests a thread serves. It is
  73. #                      recommended that the default value of 0 be set for this
  74. #                      directive on NetWare.  This will allow the thread to
  75. #                      continue to service requests indefinitely.                          
  76. <IfModule mpm_netware_module>
  77.     ThreadStackSize      65536
  78.     StartThreads           250
  79.     MinSpareThreads         25
  80.     MaxSpareThreads        250
  81.     MaxThreads            2000
  82.     MaxRequestsPerChild      0
  83.     MaxMemFree             100
  84. </IfModule>

  85. # OS/2 MPM
  86. # StartServers: Number of server processes to maintain
  87. # MinSpareThreads: Minimum number of idle threads per process,
  88. #                  to handle request spikes
  89. # MaxSpareThreads: Maximum number of idle threads per process
  90. # MaxRequestsPerChild: Maximum number of connections per server process
  91. <IfModule mpm_mpmt_os2_module>
  92.     StartServers           2
  93.     MinSpareThreads        5
  94.     MaxSpareThreads       10
  95.     MaxRequestsPerChild    0
  96. </IfModule>

  97. # WinNT MPM
  98. # ThreadsPerChild: constant number of worker threads in the server process
  99. # MaxRequestsPerChild: maximum  number of requests a server process serves
  100. <IfModule mpm_winnt_module>
  101.     ThreadsPerChild      2000
  102.     MaxRequestsPerChild  10000
  103. </IfModule>
复制代码
配置完,重启服务,经过测试,还是报一样的错误。

   试配置一下在tomcat的server.xml 中,把maxThreads改为2000,具体配置如下:
  1. <Connector port="8080" maxHttpHeaderSize="8192"
  2.                maxThreads="2000" minSpareThreads="25" maxSpareThreads="75"
  3.                enableLookups="false" redirectPort="8443" acceptCount="100"
  4.                connectionTimeout="20000" disableUploadTimeout="true"  URIEncoding="utf-8"/>
复制代码
还是报一样的错误。
我测试的客户端电脑的配置如下:
   CPU T2130 1.86GHz 1.06Ghz ,内存2.49GB  
   
   测试系统部署tomcat服务器的配置分别如下:
   cpu E3500 2.70GHz 2.70GHz 1.96GB

   CPU T2130 1.86GHz 1.06Ghz ,内存2.49GB  
     

   请高手指点迷津,我实在是测不出来了,呵呵!

作者: 海海豚    时间: 2019-7-19 09:18
https://blog.csdn.net/janfly79/article/details/54093900  参考下这个
作者: qqq911    时间: 2019-7-19 11:04
ulimit -a
作者: abcsell    时间: 2019-7-19 11:28
关注
作者: jingzizx    时间: 2019-7-19 13:00
了解学习




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2