***********安裝xcache,為php加速*******************
創(chuàng)新互聯(lián)建站是一家集網(wǎng)站建設(shè),陵水黎族企業(yè)網(wǎng)站建設(shè),陵水黎族品牌網(wǎng)站建設(shè),網(wǎng)站定制,陵水黎族網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,陵水黎族網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。unzip -o PHPMyAdmin-4.0.5-all-languages.zip
mv PHPMyAdmin-4.0.5-all-languages /usr/local/apache/htdocs/pma
1,壓力測(cè)試:
ulimit -n 3000
ab -c 100 -n 2000 http://10.10.37.138/pma/index.php 十個(gè)并發(fā),發(fā)兩千個(gè)請(qǐng)求
[root@localhost local]# ulimit -n 3000
[root@localhost local]# ab -c 100 -n 2000 http://10.10.37.138/pma/index.php
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 10.10.37.138 (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
Completed 800 requests
Completed 1000 requests
Completed 1200 requests
Completed 1400 requests
Completed 1600 requests
Completed 1800 requests
Completed 2000 requests
Finished 2000 requests
Server Software: Apache/2.4.9 服務(wù)器軟件版本
Server Hostname: 10.10.37.138 請(qǐng)求的服務(wù)器地址
Server Port: 80 服務(wù)器端口
Document Path: /pma/index.php
Document Length: 7794 bytes URL的大小
Concurrency Level: 100 并發(fā)請(qǐng)求
Time taken for tests: 103.874 seconds 整個(gè)測(cè)試經(jīng)過(guò)的時(shí)長(zhǎng)
Complete requests: 2000 一共2000的請(qǐng)求
Failed requests: 0
Total transferred: 17925162 bytes 包含首部和數(shù)據(jù)
HTML transferred: 15588000 bytes 總共傳輸?shù)臄?shù)據(jù)
Requests per second: 19.25 [#/sec] (mean) 每秒鐘完成的請(qǐng)求數(shù)
Time per request: 5193.681 [ms] (mean) 每一批(100個(gè))請(qǐng)求需要的時(shí)間
Time per request: 51.937 [ms] (mean, across all concurrent requests) 每一個(gè)請(qǐng)求消耗的時(shí)間
Transfer rate: 168.52 [Kbytes/sec] received 傳輸速率
Connection Times (ms) 連接時(shí)間
min mean[+/-sd] median max
Connect: 0 11 58.9 0 497 連接建立
Processing: 2445 5139 1298.0 4850 17286 請(qǐng)求處理
Waiting: 2445 5111 1303.1 4820 17285 等待數(shù)據(jù)從磁盤加載完成并相應(yīng)
Total: 2445 5150 1301.4 4858 17286
Percentage of the requests served within a certain time (ms)
50% 4858
66% 5165
75% 5410
80% 5590
90% 6274
95% 7209
98% 9036
99% 11075
100% 17286 (longest request)
sync
2,下載xcache-3.1.2.tar.bz2 百度搜索即可
解壓解包并編譯安裝
[root@localhost php]# man -M man/ phpize
/usr/local/php/bin/phpize 編譯第三方擴(kuò)展是都需要執(zhí)行
./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
make && make install
安裝結(jié)束后會(huì)出現(xiàn)如下信息:
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
3,配置:
[root@localhost xcache-3.1.2]# mkdir /etc/php.d
[root@localhost xcache-3.1.2]# cp xcache.ini /etc/php.d/
[root@localhost xcache-3.1.2]# vi /etc/php.d/xcache.ini
extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
4,再做壓力測(cè)試:
http://10.10.37.138/pma/index.php 刷新幾次生成緩存
再執(zhí)行測(cè)試
ab -c 100 -n 2000 http://10.10.37.138/pma/index.php
Requests per second: 80.13 [#/sec] (mean)
Time per request: 1248.033 [ms] (mean)
Time per request: 12.480 [ms] (mean, across all concurrent requests)
安裝xcache之前的速度
Requests per second: 19.25 [#/sec] (mean)
Time per request: 5193.681 [ms] (mean)
Time per request: 51.937 [ms] (mean, across all concurrent requests)
速度上能×××倍多
Requests per second: 21.97 [#/sec] (mean)
Time per request: 4552.375 [ms] (mean)
Time per request: 45.524 [ms] (mean, across all concurrent requests)
適用于讀的多,寫的少的服務(wù)器類型
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。