压力测试以及编译安装httpd2.4
压力测试以及编译安装httpd2.4
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
[root@yinzhengjie ~]# ab -c -n http://www.yinzhengjie.org.cn/index.html ----->注意, -c 模拟的并发数,-n 模拟的总请求数, 一般并发数应该小于等于请求数。
This is ApacheBench, Version 2.3 <$Revision: $>
Copyright Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.yinzhengjie.org.cn (be patient)
Completed requests ----->告诉我们测试以及完成了5000个请求,下面一次是执行进度。
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests ------->这就说明任务完成了。 Server Software: Apache/2.2. ----->服务器程序及版本;
Server Hostname: www.yinzhengjie.org.cn ----->服务器的主机名;
Server Port: ------>访问服务器的端口; Document Path: /index.html ------->请求资源的路径;
Document Length: bytes ------->请求资源的大小; Concurrency Level: -------->并发级别为100个;
Time taken for tests: 9.013 seconds --------->测试所经历的市场;
Complete requests: --------->完成的请求个数;
Failed requests: --------->失败的请求个数;
Write errors: ---------->发送的失败个数;
Total transferred: bytes ---------->一共传输的355M,默认单位为字节;
HTML transferred: bytes ---------->所传输的HTML大小为341M,上面的值包括请求首部等,因此上面的值会大于该值,该项只只包含文档实体本身;
Requests per second: 5547.74 [#/sec] (mean) ----------->每秒钟完成的请求数;
Time per request: 18.025 [ms] (mean) ----------->表示总的并发数需要的时间;
Time per request: 0.180 [ms] (mean, across all concurrent requests) ------>表示单个请求所需的时间。总的并发数是100,就用总的时间除以100就会得到这个数字;
Transfer rate: 40390.33 [Kbytes/sec] received -------->每秒钟传输的字节数; Connection Times (ms) ----->处理时间,单位是毫秒。
min mean[+/-sd] median max
Connect: 4.1 ---->连接时间
Processing: 4.1 ----->处理进程(请求)总的时间
Waiting: 3.6 ----->处理请求的等待的时间
Total: 4.4 ------>整体花费的时间 Percentage of the requests served within a certain time (ms)
% ------>表示完成50%的请求需要的时间是16ms,就是做一个评估。
%
%
%
%
%
%
%
% (longest request) ------>表示完成100%的请求需要的时间为68ms;
You have new mail in /var/spool/mail/root
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# ulimit -n [root@yinzhengjie ~]#
[root@yinzhengjie ~]# ulimit -n ----->临时修改文件的打开数为65535
[root@yinzhengjie ~]# ulimit -n [root@yinzhengjie ~]#
[root@yinzhengjie ~]# ulimit -u [root@yinzhengjie ~]#
[root@yinzhengjie ~]# ulimit -u ------->临时修改进程打开的数为30000
[root@yinzhengjie ~]# ulimit -u [root@yinzhengjie ~]#
[root@yinzhengjie ~]# tail - /etc/security/limits.conf ------>修改配置文件可以永久修改但是但是不能立即生效。需要重启操作系统才好使,和关闭selinux机制很像。
#Add by yinzhengjie
apache hard nofile
apache hard nproc
[root@yinzhengjie ~]#
[root@yinzhengjie httpd]# service httpd stop
Stopping httpd: [ OK ]
[root@yinzhengjie httpd]# chkconfig httpd off
[root@yinzhengjie ~]# lsof -i :
[root@yinzhengjie ~]# netstat -untalp | grep
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# uname -r
2.6.-.el6.x86_64
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# uname -m
x86_64
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# rpm -qi pcre
Name : pcre Relocations: (not relocatable)
Version : 7.8 Vendor: CentOS
Release : .el6 Build Date: Fri Sep :: AM PDT
Install Date: Fri Oct :: PM PDT Build Host: c6b8.bsys.dev.centos.org
Group : System Environment/Libraries Source RPM: pcre-7.8-.el6.src.rpm
Size : License: BSD
Signature : RSA/SHA1, Fri Sep :: AM PDT, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem <http://bugs.centos.org>
URL : http://www.pcre.org/
Summary : Perl-compatible regular expression library
Description :
Perl-compatible regular expression library. ------>Perl兼容的正则表达式库,Apache和Nginx都依赖于CGI,而CGI又通常是以Perl为基准的。
PCRE has its own native API, but a set of "wrapper" functions that are based on
the POSIX API are also supplied in the library libpcreposix. Note that this
just provides a POSIX calling interface to PCRE: the regular expressions
themselves still follow Perl syntax and semantics. The header file
for the POSIX-style functions is called pcreposix.h.
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# yum -y install pcre-devel
[root@yinzhengjie httpd]# pwd
/yinzhengjie/httpd
[root@yinzhengjie httpd]# ll
total
-rw-r--r--. root root Oct : apr-1.6..tar.bz2
-rw-r--r--. root root Oct : apr-util-1.6..tar.bz2
-rw-r--r--. root root Oct : httpd-2.4..tar.bz2
[root@yinzhengjie httpd]# tar xf apr-1.6..tar.bz2
[root@yinzhengjie httpd]# cd apr-1.6.
[root@yinzhengjie apr-1.6.]# ./configure --prefix=/yinzhengjie/apr ---->编译时需要指定安装路径,你可以自定义。
[root@yinzhengjie apr-1.6.]# make -j && make install ----->开始安装
[root@yinzhengjie apr-1.6.]# ls /yinzhengjie/apr/ -----检查是否安装成功
bin build- include lib
[root@yinzhengjie apr-1.6.]#
[root@yinzhengjie apr-util-1.6.]# yum -y install expat-devel ----这个包是安装apr-util时所依赖的。
[root@yinzhengjie apr-1.6.]# cd ..
[root@yinzhengjie httpd]# tar xf apr-util-1.6..tar.bz2
[root@yinzhengjie httpd]# cd apr-util-1.6.
[root@yinzhengjie apr-util-1.6.]# ./configure --prefix=/yinzhengjie/apr-util --with-apr=/yinzhengjie/apr/ ------>因为apr-util是apr的工具,因此我们需要告诉它apr的安装路径
[root@yinzhengjie apr-util-1.6.]# make -j && make install
[root@yinzhengjie ~]# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz --->如果你的OpenSSL太老了可能会导致没法配置httpd的步骤,我们可以直接安装一下新版本的OpenSSL即可,然后在安装的时候指定安装的路径
[root@yinzhengjie ~]# tar xf openssl-1.0.2l.tar.gz
[root@yinzhengjie ~]# cd openssl-1.0.2l
[root@yinzhengjie ~]# ./config --prefix=/usr/local/openssl ----配置OpenSSL的安装路径
[root@yinzhengjie ~]# make -j ---->编译OpenSSL(最多允许4个编译命令同时执行)
[root@yinzhengjie ~]# make install ---->开始安装
[root@yinzhengjie ~]# mkdir /yinzhengjie/etc
[root@yinzhengjie ~]# cd /yinzhengjie/httpd/
[root@yinzhengjie httpd]# tar xf httpd-2.4..tar.bz2
[root@yinzhengjie httpd]# cd httpd-2.4.
[root@yinzhengjie httpd-2.4.]# ./configure --prefix=/yinzhengjie/apache --sysconfdir=/yinzhengjie/etc/http24 --enable-so --enable-ssl=/usr/local/openssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/yinzhengjie/apr --with-apr-util=/yinzhengjie/apr-util/ --enable-modules=most --enable-mpms-shared=all --with-event
[root@yinzhengjie httpd-2.4.]# make -j && make install
[root@yinzhengjie httpd-2.4.]# cd
[root@yinzhengjie ~]# cd /yinzhengjie/apache/ ---->检查是否安装成功。
[root@yinzhengjie apache]# ll
total
drwxr-xr-x. root root Oct : bin ---->可以使用的工具,基本上都是可执行脚本
drwxr-xr-x. root root Oct : build ----->编译时的一些工具;
drwxr-xr-x. root root Oct : cgi-bin ------>存放CGI执行脚本的目录;
drwxr-xr-x. root root Oct : error ------->存放错误页面的目录;
drwxr-xr-x. root root Oct : htdocs ------>存放网页的目录;
drwxr-xr-x. root root Oct : icons ------->存放一些二进制文件的目录;
drwxr-xr-x. root root Oct : include ------->存放头部文件的目录;
drwxr-xr-x. root root Oct : logs -------->存放日志的目录;
drwxr-xr-x. root root Oct : man -------->存放帮助文档目录;
drwxr-xr-x. root root Oct : manual -------->存放手册的目录;
drwxr-xr-x. root root Oct : modules -------->存放模块的目录;
You have new mail in /var/spool/mail/root
[root@yinzhengjie apache]#
.导出头文件(有人易于它二次开发需要导出,或是后期编译PHP可能也会用到)
[root@yinzhengjie ~]# ln -sv /yinzhengjie/apache/include /usr/include/httpd
`/usr/include/httpd' -> `/yinzhengjie/apache/include'
[root@yinzhengjie ~]#
.导出库文件(由于没有库,我们这里了解一下该命令即可)
[root@yinzhengjie ~]# vim /etc/ld.so.conf.d/http.conf
[root@yinzhengjie ~]# ldconfig -p ------>查看当前系统已经缓存的库文件列表
.导出man手册
[root@yinzhengjie ~]# more /etc/man.config | grep yinzhengjie ----->可以在man路径里面帮助文档路径
MANPATH /yinzhengjie/apache/man
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# man -M /yinzhengjie/apache/man httpd ----->指定目录获取man帮助信息
.添加程序的path环境
[root@yinzhengjie ~]# more /etc/profile.d/httpd.sh
export PATH=/yinzhengjie/apache/bin:$PATH
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# . /etc/profile.d/httpd.sh ----->重新加载一下该配置文件
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# httpd -V ---->查看Apache当前的版本
Server version: Apache/2.4. (Unix)
Server built: Oct ::
Server's Module Magic Number: 20120211:68
Server loaded: APR 1.6., APR-UTIL 1.6.
Compiled using: APR 1.6., APR-UTIL 1.6.
Architecture: -bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=
-D HTTPD_ROOT="/yinzhengjie/apache"
-D SUEXEC_BIN="/yinzhengjie/apache/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/yinzhengjie/etc/http24/mime.types"
-D SERVER_CONFIG_FILE="/yinzhengjie/etc/http24/httpd.conf"
[root@yinzhengjie ~]#
.启动新版的Apache。
[root@yinzhengjie ~]# apachectl start
[root@yinzhengjie ~]# lsof -i :
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd root 4u IPv6 0t0 TCP *:http (LISTEN)
httpd daemon 4u IPv6 0t0 TCP *:http (LISTEN)
httpd daemon 4u IPv6 0t0 TCP *:http (LISTEN)
httpd daemon 4u IPv6 0t0 TCP *:http (LISTEN)
You have new mail in /var/spool/mail/root
[root@yinzhengjie ~]#
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# curl http://www.yinzhengjie.org.cn ---->验证服务是否启动成功。
<html><body><h1>It works!</h1></body></html>
[root@yinzhengjie ~]# .查看配置文件的目录;
[root@yinzhengjie ~]# cd /yinzhengjie/etc/http24/
[root@yinzhengjie http24]# ll
total
drwxr-xr-x. root root Oct : extra ------>是httpd.conf主配置的补充文件目录;
-rw-r--r--. root root Oct : httpd.conf
-rw-r--r--. root root Oct : magic
-rw-r--r--. root root Oct : mime.types
drwxr-xr-x. root root Oct : original
[root@yinzhengjie http24]#
[root@yinzhengjie http24]# cp httpd.conf{,bak} ----->备份配置文件
[root@yinzhengjie http24]# grep mpm_event_module httpd.conf
LoadModule mpm_event_module modules/mod_mpm_event.so
[root@yinzhengjie http24]#
[root@yinzhengjie ~]# ll /yinzhengjie/etc/http24/extra/
total
-rw-r--r--. root root Oct : httpd-autoindex.conf
-rw-r--r--. root root Oct : httpd-dav.conf
-rw-r--r--. root root Oct : httpd-default.conf
-rw-r--r--. root root Oct : httpd-info.conf
-rw-r--r--. root root Oct : httpd-languages.conf
-rw-r--r--. root root Oct : httpd-manual.conf ------>配置手册是否启动;
-rw-r--r--. root root Oct : httpd-mpm.conf ------>配置httpd的工作模式文件;
-rw-r--r--. root root Oct : httpd-multilang-errordoc.conf
-rw-r--r--. root root Oct : httpd-ssl.conf ------->配置https的文件;
-rw-r--r--. root root Oct : httpd-userdir.conf
-rw-r--r--. root root Oct : httpd-vhosts.conf -------->配置虚拟主机的文件;
-rw-r--r--. root root Oct : proxy-html.conf
[root@yinzhengjie ~]# .自定义启动脚本
其实也不用自定义,直接把之前较低版本的脚本拿来改一下路径即可。
[root@yinzhengjie ~]# cd /etc/init.d/
[root@yinzhengjie init.d]# cp httpd httpd24
[root@yinzhengjie init.d]# more httpd24 | grep httpd=
httpd=/yinzhengjie/apache/bin/httpd ----->指定httpd服务存放处
[root@yinzhengjie init.d]# more httpd24 | grep apachectl=
apachectl=/yinzhengjie/apache/bin/apachectl ----->指定该命令的位置
[root@yinzhengjie init.d]#
[root@yinzhengjie init.d]# more httpd24 | grep pidfile= | grep -v LANG
pidfile=${PIDFILE-/yinzhengjie/apache/logs/httpd.pid} ------>指定进程存放pid的文件
[root@yinzhengjie init.d]#
[root@yinzhengjie ~]# chkconfig --add httpd24
[root@yinzhengjie ~]# chkconfig httpd24 on ------>让其开启开机自启即可;
[root@yinzhengjie ~]# chkconfig httpd24 --list
httpd24 :off :off :on :on :on :on :off
[root@yinzhengjie ~]#
[root@yinzhengjie ~]# service httpd24 restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@yinzhengjie ~]#
压力测试以及编译安装httpd2.4的更多相关文章
- CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27
CentOS 6.8编译安装httpd2.2.31+MySQL5.6.31+PHP5.3.27 说明: 操作系统:CentOS 6.8 32位 准备篇: 一.系统约定 软件源代码包存放位 ...
- Linux压力测试软件Stress安装及使用指南2
stress工具使用指南和结果分析 Linux压力测试软件Stress安装及使用指南 一.Stress是什么 stress是一个linux下的压力测试工具,专门为那些想要测试自己的系统,完全高 ...
- CentOS7编译安装httpd-2.4.41 php7.3
CentOS7编译安装httpd-2.4.41 php7.3 安装参考环境: CentOS Linux release 7.5.1804 (Core) 一.安装依赖包 httpd安装的依赖包 # yu ...
- CentOS7编译安装httpd-2.4.41
安装参考环境: CentOS Linux release 7.5.1804 (Core) 一.安装依赖包 httpd安装的依赖包 # yum -y install pcre-devel # yum - ...
- 网站压力测试工具webbench 安装与使用
webbench最多可以模拟3万个并发连接去测试网站的负载能力,个人感觉要比Apache自带的ab压力测试工具好用,安装使用也特别方便,并且非常小. 主要是 -t 参数用着比较爽,下面参考了张宴的文章 ...
- Linux压力测试软件Stress安装及使用指南
一.Stress是什么 stress是一个linux下的压力测试工具,专门为那些想要测试自己的系统,完全高负荷和监督这些设备运行的用户. 二.安装 将stress的安装包上传并解压到linux服务 ...
- 在centos6中编译安装httpd-2.4/搭建LAMP
首先确保centos6安装平台安装一下环境: #yum groupinstall "Development Tools" "Server Platform Develo ...
- [笔记] centos6.6编译安装httpd2.4.10
系统安装包是CentOS-6.6-x86_64-minimal.iso 查看一下uname信息 [root@localhost ~]# uname -a Linux localhost.localdo ...
- 编译安装-httpd-2.2.15.tar.gz
编译安装(又称源代码安装) 找到httpd-2.2.15.tar.gz安装包并拖到桌面root文件夹里 解包阶段 tar zxf httpd-2.2.15.tar.gz -C /usr/src 配置阶 ...
随机推荐
- how2j 的shiro教程初探
教程案例里的mysql连接器只支持mysql,不支持mariadb,如果用的不是mysql,创建连接时会报错.
- LOJ#6354. 「CodePlus 2018 4 月赛」最短路[最短路优化建图]
题意 一个 \(n\) 个点的完全图,两点之间的边权为 \((i\ xor\ j)*C\) ,同时有 \(m\) 条额外单向路径,问从 \(S\) 到 \(T\) 的最短路. \(n\leq 10^5 ...
- binlog2sql使用总结
binlog2sql是大众点评开源的一款用于解析binlog的工具,在测试环境试用了下,还不错. 其具有以下功能 1. 提取SQL 2. 生成回滚SQL 关于该工具的使用方法可参考github操作文档 ...
- stl源码剖析 详细学习笔记 RB_tree (2)
//---------------------------15/03/22---------------------------- //一直好奇KeyOfValue是什么,查了下就是一个和仿函数差不多 ...
- eclipse中怎么找项目部署的路径和找编译后的class路径
1.快捷键 ctrl+shift+R,会默认显示你的源文件.java的路径,如果没有.class的话,点击右上角的三角,选中 Show Derived Resource; 2.打开出现下图 3.按下 ...
- Seay源代码审计系统的配置和安装
2014年7月31日 Seay源代码审计系统2.1 时隔刚好一年之久,源代码审计系统再次更新,这次主要优化审计体验,优化了漏洞规则,算是小幅更新,原来使用者打开程序会提示自动更新. 1.优化原有规则, ...
- 安装logstash及logstash的初步使用-处理DNS日志
安装logstash 需要高版本的java 使用1.4版本的java会有报错 # Can't start up: not enough memory 查询java信息 rpm -qa | grep j ...
- [咸恩静][Real Love]
歌词来源:http://music.163.com/#/song?id=484056972 作曲 : Andrew 崔/Brian Cho/220 [作曲 : Andrew 崔/Brian Cho/2 ...
- 12.19daily_scrum
本阶段已经过去一半,在周末短暂的休息后,我们将继续完成后续的任务,今日工作情况如下: 小组成员 今日任务 工作时间 李睿琦 网络数据传输应用设计 2 左少辉 主界面功能测试 3 程刚 界面优化学习 4 ...
- navicat连接mysql报10061错
可能原因:mysql服务未启动 解决办法:进入到计算机管理,找到服务,然后找到mysql服务,并启动该服务