php-xcache编译安装,及ab压力测试

[[email protected] local]# tar -xf xcache-3.2.0.tar.bz2

[[email protected] xcache-3.2.0]# man -M /usr/local/php/php/man phpize 查看帮助文档

[[email protected] xcache-3.2.0]# /usr/local/php/bin/phpize

[[email protected] xcache-3.2.0]# man -M /usr/local/php/php/man php-config查看帮助文档

[[email protected] xcache-3.2.0]# ./configure --enable-xcache    --with-php-config=/usr/local/php/bin/php-config

[[email protected] xcache-3.2.0]# make

[[email protected] xcache-3.2.0]# make install

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-zts-20131226/

[[email protected] xcache-3.2.0]#

[[email protected] php-5.6.24]# mkdir /etc/php.d

[[email protected] xcache-3.2.0]# cp xcache.ini /etc/php.d/  为xcache拷贝一个配置文件

[[email protected] xcache-3.2.0]# vim /etc/php.d/xcache.ini

[xcache-common] 定义zend扩展

将安装xcache后的Installing shared extensions路径写在 zend_extension里

extension = /usr/local/php/lib/php/extensions/no-debug-zts-20131226/xcache.so

[xcache.admin] 定义xcache的管理

[xcache]

xcache.shm_scheme =           "mmap"  实用哪种方式来共享内存   mmap:内存映射

xcache.size  =                 60M    缓存空间大小

xcache.count =                 1 设置CPU个数

xcache.ttl   =                 0 过期时间

xcache.gc_interval =           0 垃圾回收器多长时间工作一次

xcache.var_size  =            4M       xcache的变量缓存空间大小

xcache.var_count =             1       缓存多少个

xcache.var_slots =            8K

xcache.cacher =               On

xcache.stat   =               On  缓存功能是否启用

xcache.optimizer =           Off  xcache自身的优化器是否启动

要让 xcache重新生效,需要重启apache服务

------------------------------------------

解决:php扩展报错:Cannot find config.m4.

cd /usr/local/php-5.3.28/ext/

./ext_skel --extname=sdomain

cd sdomain/

mv config.m4  /usr/local/php/bin/

-------------------------

启动php虚拟主机:

[[email protected] local]# vim /etc/httpd/httpd.conf

#DocumentRoot "/usr/local/apache/htdocs" 禁用

#Virtual hosts

Include /etc/httpd/extra/httpd-vhosts.conf 启用虚拟主机

[[email protected] local]# vim /etc/httpd/extra/httpd-vhosts.conf  配置虚拟主机配置文件

# Required modules: mod_log_config 此提示需要启动mod_log_config

[[email protected] local]# vim /etc/httpd/httpd.conf 默认已经启用

[[email protected] local]# mkdir /www/{a.org,b.net} -pv

mkdir: created directory `/www‘

mkdir: created directory `/www/a.org‘

mkdir: created directory `/www/b.net‘

[[email protected] local]# mkdir /var/log/httpd/

[[email protected] local]# vim /etc/httpd/extra/httpd-vhosts.conf

<VirtualHost *:80>

DocumentRoot "/www/a.org"

<Directory "/www/a.org">

Options none

AllowOverride none

Require all granted 允许所有人访问

</Directory>

ServerName www.a.org

ErrorLog "/var/log/httpd/a.org-erro_log"

CustomLog "/var/log/httpd/a.org-access_log" combined

</VirtualHost>

<VirtualHost *:80>

DocumentRoot "/www/b.net"

<Directory "/www/b.net">

Options none

AllowOverride none

Require all granted

</Directory>

ServerName w

ServerName www.b.net

ErrorLog "/var/log/httpd/b.net-erro_log"

CustomLog "/var/log/httpd/b.net-access_log" combined

</VirtualHost>

重启apache服务

ab压力测试:

[[email protected] bin]# echo "<h1>www.a.org<h1>" > /www/a.org/index.html

[[email protected] bin]# echo "<h1>www.b.net<h1>" > /www/b.net/index.html

[[email protected] apache]# ./bin/ab  httpd压力测试工具

ab  -c 指定并发量,一次请求多少个

-n 指定一共要请求多少个

[[email protected] apache]# ./bin/ab -c 100 -n 1000 http://www.a.org/index.html

Server Software:        Apache/2.4.23

Server Hostname:        www.a.org

Server Port:            80

Document Path:          /index.html

Document Length:        18 bytes

Concurrency Level:      1000  并发量

Time taken for tests:   27.089 seconds   所花费的时间

Complete requests:      48089  成功得到请求个数

Failed requests:        0  多少个失败

Total transferred:      13128570 bytes   服务器响应的整体数据大小

HTML transferred:       865620 bytes

Requests per second:    1775.20 [#/sec] (mean) 每秒钟完成的请求数

Time per request:       563.316 [ms] (mean)  每从并发请求平均花费的时间

Time per request:       0.563 [ms] (mean, across all concurrent requests) 单个平均时间

Transfer rate:          473.28 [Kbytes/sec] received 传输速率,每秒钟传输多少个字节。通过ab测试算出所需要的带宽

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       19  239 379.2    133    7574

Processing:    21  305 864.8    138   14983

Waiting:        2  259 843.4    106   14863

Total:         97  544 1005.6    246   15051

min 最短多少毫秒

mean平均多少毫秒

max 最长多少毫秒

Percentage of the requests served within a certain time (ms)

[[email protected] etc]# cp /etc/services /www/a.org/text.html  复制一个大点的主页版给httpd进行测试

[[email protected] bin]# ./ab -c 100 -n 10000 http://www.a.org/text.html

Server Software:        Apache/2.4.23

Server Hostname:        www.a.org

Server Port:            80

Document Path:          /text.html

Document Length:        641020 bytes

Concurrency Level:      100

Time taken for tests:   21.618 seconds

Complete requests:      10000

Failed requests:        0

Total transferred:      6412820000 bytes

HTML transferred:       6410200000 bytes

Requests per second:    462.58 [#/sec] (mean)

Time per request:       216.180 [ms] (mean)

Time per request:       2.162 [ms] (mean, across all concurrent requests)

Transfer rate:          289690.60 [Kbytes/sec] received   282M*8=2263M  所以需要大约2500M的带宽

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:        1   38  25.7     33     216

Processing:    60  178  60.6    154     429

Waiting:        0   34  26.5     30     213

Total:         66  216  73.3    176     486

Percentage of the requests served within a certain time (ms)

50%    176

66%    217

75%    302

80%    316

90%    330

95%    343

98%    386

99%    435

100%    486 (longest request)

[[email protected] a.org]# dd if=/dev/zero  of=/www/a.org/text2.html  count=20  bs=1M

[[email protected] a.org]# /usr/local/apache/bin/ab -r -c 100  -n 1000 http://www.a.org/text2.html

Server Software:        Apache/2.4.23

Server Hostname:        www.a.org

Server Port:            80

Document Path:          /text2.html

Document Length:        2097152 bytes

Concurrency Level:      100

Time taken for tests:   9.764 seconds

Complete requests:      1000

Failed requests:        0

Total transferred:      2097416000 bytes

HTML transferred:       2097152000 bytes

Requests per second:    102.42 [#/sec] (mean)

Time per request:       976.402 [ms] (mean)

Time per request:       9.764 [ms] (mean, across all concurrent requests)

Transfer rate:          209776.01 [Kbytes/sec] received   209775.01/1024 *8=所需带宽

Connection Times (ms)

min  mean[+/-sd] median   max

Connect:       14   84  38.8     84     215

Processing:   743  891  65.8    888    1090

Waiting:        1   64  40.4     62     216

Total:        871  975  55.1    972    1112

Percentage of the requests served within a certain time (ms)

50%    972

66%    976

75%    982

80%   1003

90%   1107

95%   1110

98%   1110

99%   1111

100%   1112 (longest request)

[[email protected] b.net]# unzip phpMyAdmin-3.5.1-all-languages.zip

[[email protected] b.net]# mv phpMyAdmin-3.5.1-all-languages/  pma

[[email protected] pma]# cp config.sample.inc.php  config.inc.php 复制一个配置文件

[[email protected] pma]# openssl rand -base64  20 生成随机数

eyQFSUT16JqsijjSCZdDfkpYLf4=

[[email protected] pma]# vim config.inc.php

/*

* This is needed for cookie based authentication to encrypt password in

* cookie

*/

$cfg[‘blowfish_secret‘] = ‘eyQFSUT16JqsijjSCZdDfkpYLf4=‘; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

http://www.b.net/pma/

[[email protected] pma]# mysqladmin -uroot password ‘root‘; 为数据库设置密码

[[email protected] pma]# /usr/local/apache/bin/ab -c 500 -n 5000 http://www.b.net/pma/index.php

启用ssl功能

[[email protected] pma]# vim /etc/httpd/httpd.conf

LoadModule ssl_module modules/mod_ssl.so 启用此模块

Include /etc/httpd/extra/httpd-ssl.conf 启用

[[email protected] pma]# vim /etc/httpd/extra/httpd-ssl.conf

<VirtualHost _default_:443>

#   General setup for the virtual host

DocumentRoot "/www/a.org"

ServerName www.a.org

ServerAdmin [email protected]

ErrorLog "/usr/local/apache/logs/error_log"

TransferLog "/usr/local/apache/logs/access_log"

SSLCertificateFile "/etc/httpd/server.crt"  证书文件位置

#SSLCertificateFile "/etc/httpd/server-dsa.crt"

#SSLCertificateFile "/etc/httpd/server-ecc.crt"

#   Server Private Key:

#   If the key is not combined with the certificate, use this

#   directive to point at the key file.  Keep in mind that if

#   you‘ve both a RSA and a DSA private key you can configure

#   both in parallel (to also allow the use of DSA ciphers, etc.)

#   ECC keys, when in use, can also be configured in parallel

SSLCertificateKeyFile "/etc/httpd/server.key" 私钥文件位置

#SSLCertificateKeyFile "/etc/httpd/server-dsa.key"

#SSLCertificateKeyFile "/etc/httpd/server-ecc.key"

需要搭建一个ca服务器

时间: 2024-08-27 09:09:23

php-xcache编译安装,及ab压力测试的相关文章

超级web服务器yum 安装apache+源码编译tomcat+awstat+phpmadin+mysql+php+AB压力测试

实验环境: 两台机器:Centos6.4 机器一: 192.168.56.10  安装httpd  php   等整合 机器二: 192.168.56.11 安装 mysql ======================================================================================== (iptables -t nat -I PREROUTING -d 外IP -p tcp -m tcp --dport 端口 -j DNAT --

安装Xcache缓存加速php及ab压力测试结果

XCache 是一个又快又稳定的 PHP opcode 缓存器. 经过良好的测试并在大流量/高负载的生产机器上稳定运行. 经过(在 linux 上)测试并支持所有现行 PHP 分支的最新发布版本, 如 PHP_5_1 PHP_5_2 PHP_5_3 PHP_5_4. 并完美支持线程安全/Windows. 与同类 opcode 缓存器相比更胜一筹, 比如能够快速跟进 PHP 版本. 我的php为5.6.6版本,所以需要安装xcache3.2.0    官网下载:http://xcache.ligh

ab压力测试及Xcache

使用ab进行对页面压力测试 ab是apache自带的一个很好用的压力测试工具,当安装完apache的时候,就可以在bin下面找到ab 我们可以模拟100个并发用户,对一个页面发送1000个请求 #ab -c 100 -n 1000 http://192.168.0.2/phpmyadmin 请求总数1000次,每次并发100 ##首先是apache的版本信息  This is ApacheBench, Version 2.3 <$Revision: 1554214 $> Copyright 1

Apache 深度优化 ab压力测试

网站性能压力了测试是服务器网站性能调优过程中必不可少的一环,只有让服务器处在高压的情况下,才能真正体现出软件.硬件等各种设置不当所暴露出的问题. 性能测试工具目前最常见的有以下几种:ab.http_load.webbench.siege.ab是Apache自带的压力测试工具,非常实用,可以模拟多线程并发请求,测试服务器负载压力.它不仅可以对Apache服务器进行网站访问压力测试,而且可以对其他类型服务器进行压力测试.ab对发出负载的计算机要求很低,既不会占用很多CPU,也不会占用太多内存,但却会

Apache网页深入优化之ab压力测试、工作模式与目录属性优化

ab压力测试工具 Apache自带压力测试工具ab,简单易用,且可以模拟各种条件对Web服务器发起测试请求.ab工具可以直接在Web服务器本地发起测试请求,这对于需要了解服务器的处理性能至关重要,因为它不包括数据的网络传输时间以及用户PC本地的计算时间,从而可以通过观测各种时间指标判断Web服务器的性能,以便进行参数的优化调整. 在进行性能调整优化过程中,可用ab压力测是工具进行优化效果的测试:1.优化前先使用ab进行压力测试2.优化后,重启服务,再使用ab进行压力测试3.对比两次测试的结果,看

Apache服务ab压力测试

将ab压力测试之前,先讲解一下相关概念: 吞吐率(Requests per second) 服务器并发处理能力的量化描述,单位是reqs/s,指的是某个并发用户数下单位时间内处理的请求数.某个并发用户数下单位时间内能处理的最大请求数,称之为最大吞吐率. 计算公式: 总请求数 / 处理完成这些请求数所花费的时间,即Request per second = Complete requests / Time taken for tests 并发连接数(The number of concurrent

AB压力测试(Windows)

1.Apache服务器安装 链接: http://jingyan.baidu.com/article/29697b912f6539ab20de3cf8.html 2.AB压力测试帮助 http://wangshuaibo.iteye.com/blog/935454 3.帮助文档 ① Apache报ServerRoot must be a valid directory 解决方法:http://jingyan.baidu.com/article/915fc41491c68751384b2040.h

4分钟apache自带ab压力测试工具使用: 2015.10.4

2015.10.44分钟apache自带ab压力测试工具使用:win8.1 wampserver2.5 -Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b 可以参考一下部分讲解有图,我就是打开cmd窗口,进入apache的安装目录(ab一般是apache自带测试工具,所以然后就可以执行需要测试的命令就好了),我的在F:\wamp\bin\apach\apache2.4.9\bin目录下:两种执行方式,1.进入上面说的目录后执行以下命令,如 .\ab -n5000 -

apache优化之防盗链,日志拆分,ab压力测试

Apache调优之apache防盗链.日志拆分和ab压力测试 1.apache防盗链 盗链,全称是盗取链接,假如我们的网站有很多好看的图片,别人可以查看我们网站图片的链接,然后应用在他的网站上,这样的话,去访问他的网站,实际上消耗的是我们的流量(因为实际链接在我们这里),这样我们就不得不去配置防盗链,使得别人不能复制我们图片的链接 要实现防盗链,我们就必须先理解盗链的实现原理,提到防盗链的实现原理就不得不从HTTP协议说起,在HTTP协议中,有一个表头字段叫referer,采用URL的格式来表示