使用apache benchmark(ab) 测试报错汇总

摘要:
=APR_SUCCESS){err_recv++;如果{bad++;close_connection;如果{charbuf[120];fprintf;}返回;}否则{//apr_err;bad++;close_connection;return;//此处}}修改后编译。注意添加配置执行权限。我复制编译的ab可执行文件以避免重新安装apache。创建要执行的目录。

1、socket: Too many open files (24)

解决方法:

[root@zabbix ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 14802
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 14802
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
调整可以打开的文件数
[root@zabbix ~]# ulimit -n 65535

2、http错误日志报错

server reached MaxClients setting,consider raising the Max Clients setting”

设置如下:

/etc/httpd/conf/httpd.conf

## Server-Pool Size Regulation (MPM specific)

## 

# 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

# ServerLimit: maximum value for MaxClients for the lifetime of the server

# MaxClients: maximum number of server processes allowed to start

# MaxRequestsPerChild: maximum number of requests a server process serves

<IfModule prefork.c>

StartServers       10

MinSpareServers    10

MaxSpareServers   75

ServerLimit      2000

MaxClients       2000

MaxRequestsPerChild  4000

</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 worker.c>

StartServers         4

MaxClients         2000

MinSpareThreads     25

MaxSpareThreads     75 

ThreadsPerChild     25

MaxRequestsPerChild  0

</IfModule>

 3、: apr_socket_recv: Connection reset by peer (104) 

改服务端apachemaxclients参数,调大最大打开文件数,都不解决问题,最后才发现是因为ab的源码对ab的并发有限制,修改源码重新编译apache:

Apache源码下载地址:http://httpd.apache.org/download 

我下的是 2.2 

修改源码support目录下的ab.c文件,大概在1369,修改为:

 /* catch legitimate fatal apr_socket_recv errors */
        else if (status != APR_SUCCESS) {
            err_recv++;
            if (recverrok) {
                bad++;
                close_connection(c);
                if (verbosity >= 1) {
                    char buf[120];
                    fprintf(stderr,"%s: %s (%d)
", "apr_socket_recv", apr_strerror(status, buf, sizeof buf), status);
                }
                return;
            } else {
               // apr_err("apr_socket_recv", status);
               bad++;
               close_connection(c);
               return;      // 到这里 
            }
        }

修改后编译,注意添加 config 执行权限。

我是把编译后的ab可执行文件拷贝过来,避免重装apache。建一个目录执行即可。

4、其他参考

apache的源码安装详细过程全纪录http://www.jb51.net/article/59474.htm

apr_socket_recv: Connection reset by peer 错误(安装参考,并没有解决问题)http://blog.csdn.net/kimsung/article/details/9422991

Ab测试说明博文 http://blog.csdn.net/gzh0222/article/details/7172341

网站服务器压力Web性能测试:Apache Bench,Webbench,http_load安装使用 http://www.freehao123.com/apache-bench-webbench/

Apache下载地址: http://apache.fayea.com/

卸载centos默认的apache:  http://blog.sina.com.cn/s/blog_701300bc0100nzea.html

免责声明:文章转载自《使用apache benchmark(ab) 测试报错汇总》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Cinder LVM Oversubscription in thin provisioningzigbee芯片cc2430资料下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Linux 下使用acme.sh生成Let's Encrypt泛域名免费证书

一、需求场景 自从数年前苹果开始强制要求所有IOS所有应用必须全部使用 https,以及google、baidu、bing 这三大搜索引擎开始大规模支持 https,https 已经成为现在保障网站完全的最基础需求,大量的供应商开始出现,并提供证书服务,但是对于一些非盈利性质的网站或博客站长,或公司测试环境也想使用https认证时,并不想在这上面投入太多的...

JAVA随机数生成Int、Long、Float、Double

随机数Int的生成 生成无边界的Int @Test public void testRandom_generatingIntegerUnbounded() throws Exception { int intUnbounded = new Random().nextInt(); System.out.println(intUnbounded)...

apache 开机自启动脚本设置

默认我们源码编译安装apache,是不能使用service这个命令来启动的,通常我们启动的命令是: [root@localhost httpd-2.2.16]# /usr/local/apache2/bin/apachectl start /usr/local/apache2/bin/中的apachectl其实就是一个启动脚本,我们把他copy到/etc/...

maven和gradle的全局阿里云镜像代理

Maven:~/.m2/settings.xml <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-...

Apache Commons 工具类介绍及简单使用

转自:http://www.cnblogs.com/younggun/p/3247261.html Apache Commons包含了很多开源的工具,用于解决平时编程经常会遇到的问题,减少重复劳动。下面是我这几年做开发过程中自己用过的工具类做简单介绍。 组件 功能介绍 BeanUtils 提供了对于JavaBean进行各种操作,克隆对象,属性等等....

Spring boot + Gradle + Eclipse打war包发布总结

首先感谢两位博主的分享 http://lib.csdn.net/article/git/55444?knId=767 https://my.oschina.net/alexnine/blog/540651 buildscript { ext { springBootVersion = '1.5.2.RELEASE' }...