51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 1725|回复: 4
打印 上一主题 下一主题

关于apache自带的ab做并发测试的问题。

[复制链接]
  • TA的每日心情
    无聊
    2 小时前
  • 签到天数: 403 天

    连续签到: 1 天

    [LV.9]测试副司令

    跳转到指定楼层
    1#
    发表于 2019-7-17 09:57:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    1测试积点
    各位高手,大家好,
       我现在这边有个棘手的问题需要解决,需要大家慷慨解囊。
       问题是这样的,我使用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  
         

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

    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    3 小时前
  • 签到天数: 1667 天

    连续签到: 5 天

    [LV.Master]测试大本营

    2#
    发表于 2019-7-19 09:18:26 | 只看该作者
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    2 小时前
  • 签到天数: 1386 天

    连续签到: 5 天

    [LV.10]测试总司令

    3#
    发表于 2019-7-19 11:04:34 | 只看该作者
    ulimit -a
    回复

    使用道具 举报

  • TA的每日心情
    开心
    2021-12-27 08:30
  • 签到天数: 471 天

    连续签到: 1 天

    [LV.9]测试副司令

    4#
    发表于 2019-7-19 11:28:26 | 只看该作者
    关注
    回复

    使用道具 举报

  • TA的每日心情
    奋斗
    4 小时前
  • 签到天数: 2660 天

    连续签到: 5 天

    [LV.Master]测试大本营

    5#
    发表于 2019-7-19 13:00:30 | 只看该作者
    了解学习
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-4-26 12:12 , Processed in 0.074153 second(s), 21 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表