测试积点老人 发表于 2019-7-17 09:57:04

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

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

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

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

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

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

#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile "logs/accept.lock"
</IfModule>
</IfModule>

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

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    ServerLimit      5500
    MaxClients         5000
    MaxRequestsPerChild 10000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          3
    ServerLimit         5500
    MaxClients          5000
    MinSpareThreads      50
    MaxSpareThreads      200
    ThreadLimit          200
    ThreadsPerChild      100
    MaxRequestsPerChild10000
</IfModule>

# BeOS MPM
# StartThreads: how many threads do we initially spawn?
# MaxClients:   max number of threads we can have (1 thread == 1 client)
# MaxRequestsPerThread: maximum number of requests each thread will process
<IfModule mpm_beos_module>
    StartThreads            10
    MaxClients             5000
    MaxRequestsPerThread 10000
</IfModule>

# NetWare MPM
# ThreadStackSize: Stack size allocated for each worker thread
# StartThreads: Number of worker threads launched at server startup
# MinSpareThreads: Minimum number of idle threads, to handle request spikes
# MaxSpareThreads: Maximum number of idle threads
# MaxThreads: Maximum number of worker threads alive at the same time
# MaxRequestsPerChild: Maximumnumber of requests a thread serves. It is
#                      recommended that the default value of 0 be set for this
#                      directive on NetWare.This will allow the thread to
#                      continue to service requests indefinitely.                        
<IfModule mpm_netware_module>
    ThreadStackSize      65536
    StartThreads         250
    MinSpareThreads         25
    MaxSpareThreads      250
    MaxThreads            2000
    MaxRequestsPerChild      0
    MaxMemFree             100
</IfModule>

# OS/2 MPM
# StartServers: Number of server processes to maintain
# MinSpareThreads: Minimum number of idle threads per process,
#                  to handle request spikes
# MaxSpareThreads: Maximum number of idle threads per process
# MaxRequestsPerChild: Maximum number of connections per server process
<IfModule mpm_mpmt_os2_module>
    StartServers         2
    MinSpareThreads      5
    MaxSpareThreads       10
    MaxRequestsPerChild    0
</IfModule>

# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximumnumber of requests a server process serves
<IfModule mpm_winnt_module>
    ThreadsPerChild      2000
    MaxRequestsPerChild10000
</IfModule>配置完,重启服务,经过测试,还是报一样的错误。

   试配置一下在tomcat的server.xml 中,把maxThreads改为2000,具体配置如下:
<Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="2000" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               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:26

https://blog.csdn.net/janfly79/article/details/54093900参考下这个

qqq911 发表于 2019-7-19 11:04:34

ulimit -a

abcsell 发表于 2019-7-19 11:28:26

关注

jingzizx 发表于 2019-7-19 13:00:30

:(了解学习
页: [1]
查看完整版本: 关于apache自带的ab做并发测试的问题。