最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

PHP開(kāi)啟opcache提升代碼性能

 更新時(shí)間:2015年04月26日 16:25:05   投稿:hebedich  
APC在PHP5.4及以下版本是性能最好的代碼緩存。不過(guò)PHP升級(jí)到5.5及以上后,APC不再有效。需要使用Zend的OpCache擴(kuò)展。

配置指令如下:

[opcache]
zend_extension=opcache.so
opcache.enable_cli=1
;共享內(nèi)存大小, 這個(gè)根據(jù)你們的需求可調(diào)
opcache.memory_consumption=256   
;interned string的內(nèi)存大小, 也可調(diào)
opcache.interned_strings_buffer=8
;最大緩存的文件數(shù)目
opcache.max_accelerated_files=4000
;60s檢查一次文件更新
opcache.revalidate_freq=60
;打開(kāi)快速關(guān)閉, 打開(kāi)這個(gè)在PHP Request Shutdown的時(shí)候 會(huì)收內(nèi)存的速度會(huì)提高
opcache.fast_shutdown=1
;不保存文件/函數(shù)的注釋
opcache.save_comments=0 

實(shí)際性能對(duì)比:

下面是實(shí)際測(cè)試中沒(méi)有開(kāi)啟opcache的數(shù)據(jù):

[root@localhost ~]# ab -n 10000 -c 200 "http://112.126.69.14/main.php?a=Role&m=createRole"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 112.126.69.14 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests

Server Software:    openresty/1.7.2.1
Server Hostname:    112.126.69.14
Server Port:      80

Document Path:     /main.php?a=Role&m=createRole
Document Length:    2 bytes

Concurrency Level:   200
Time taken for tests:  26.061 seconds
Complete requests:   10000
Failed requests:    20
  (Connect: 0, Receive: 0, Length: 20, Exceptions: 0)
Write errors:      0
Non-2xx responses:   20
Total transferred:   1713580 bytes
HTML transferred:    23520 bytes
Requests per second:  383.72 [#/sec] (mean)
Time per request:    521.216 [ms] (mean)
Time per request:    2.606 [ms] (mean, across all concurrent requests)
Transfer rate:     64.21 [Kbytes/sec] received

Connection Times (ms)
       min mean[+/-sd] median  max
Connect:    2  3  3.2   2   60
Processing:  17 461 905.0  219  16496
Waiting:    17 461 904.9  219  16496
Total:     21 464 905.0  222  16502

Percentage of the requests served within a certain time (ms)
 50%  222
 66%  271
 75%  369
 80%  412
 90%  805
 95%  1248
 98%  2597
 99%  3489
 100% 16502 (longest request)

開(kāi)啟之后的數(shù)據(jù):

[root@localhost ~]# ab -n 10000 -c 200 "http://112.126.69.14/main.php?a=Role&m=createRole"
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 112.126.69.14 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software:    openresty/1.7.2.1
Server Hostname:    112.126.69.14
Server Port:      80

Document Path:     /main.php?a=Role&m=createRole
Document Length:    2 bytes

Concurrency Level:   200
Time taken for tests:  14.237 seconds
Complete requests:   10000
Failed requests:    0
Write errors:      0
Total transferred:   1711710 bytes
HTML transferred:    20020 bytes
Requests per second:  702.40 [#/sec] (mean)
Time per request:    284.739 [ms] (mean)
Time per request:    1.424 [ms] (mean, across all concurrent requests)
Transfer rate:     117.41 [Kbytes/sec] received

Connection Times (ms)
       min mean[+/-sd] median  max
Connect:    2  66 272.6   2  3005
Processing:   4 176 666.4   6  9026
Waiting:    4 163 642.8   6  9026
Total:     6 242 745.7   9  10028

Percentage of the requests served within a certain time (ms)
 50%   9
 66%   14
 75%   99
 80%  122
 90%  1006
 95%  1476
 98%  2853
 99%  3543
 100% 10028 (longest request)

以上所述就是本文的全部?jī)?nèi)容,希望大家能夠喜歡。

相關(guān)文章

  • PHP編程基本語(yǔ)法快速入門手冊(cè)

    PHP編程基本語(yǔ)法快速入門手冊(cè)

    這篇文章主要介紹了PHP編程基本語(yǔ)法快速入門的一些知識(shí),包括PHP的數(shù)組與循環(huán)語(yǔ)句等基礎(chǔ)知識(shí)點(diǎn),需要的朋友可以參考下
    2016-01-01
  • php動(dòng)態(tài)綁定變量的用法

    php動(dòng)態(tài)綁定變量的用法

    這篇文章主要介紹了php動(dòng)態(tài)綁定變量的用法,涉及php變量的判定與動(dòng)態(tài)定義的相關(guān)技巧,需要的朋友可以參考下
    2015-06-06
  • PHP 登錄記住密碼實(shí)現(xiàn)思路

    PHP 登錄記住密碼實(shí)現(xiàn)思路

    在登錄的時(shí)候記住用戶輸入的密碼在某些情況下是很有必要的,下面是一個(gè)小例子,感興趣的朋友可以參考下哈,希望對(duì)你有所幫助
    2013-05-05
  • php 如何獲取文件的后綴名

    php 如何獲取文件的后綴名

    本文給大家匯總了幾種使用PHP實(shí)現(xiàn)獲取文件的后綴名的方法,十分的簡(jiǎn)單實(shí)用,有需要的小伙伴可以參考下
    2016-06-06
  • 通過(guò)PHP自帶的服務(wù)器來(lái)查看正則匹配結(jié)果的方法

    通過(guò)PHP自帶的服務(wù)器來(lái)查看正則匹配結(jié)果的方法

    這篇文章主要介紹了通過(guò)PHP自帶的服務(wù)器來(lái)查看正則匹配結(jié)果的方法,通過(guò)這樣的方式可以在搬上服務(wù)器之前在工作環(huán)境上完成很多輕量級(jí)的試驗(yàn),需要的朋友可以參考下
    2015-12-12
  • php處理帶有中文URL的方法

    php處理帶有中文URL的方法

    這篇文章主要介紹了php處理帶有中文URL的方法,涉及php編碼轉(zhuǎn)換相關(guān)操作技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2016-07-07
  • php字符比較函數(shù)similar_text、strnatcmp與strcasecmp用法分析

    php字符比較函數(shù)similar_text、strnatcmp與strcasecmp用法分析

    這篇文章主要介紹了php字符比較函數(shù)similar_text、strnatcmp與strcasecmp用法,以實(shí)例形式詳細(xì)分析了這三個(gè)字符串比較函數(shù)的具體用法,非常具有實(shí)用價(jià)值,需要的朋友可以參考下
    2014-11-11
  • PHP行為型模式之責(zé)任鏈模式

    PHP行為型模式之責(zé)任鏈模式

    責(zé)任鏈模式,其目的是組織一個(gè)對(duì)象鏈處理一個(gè)如方法調(diào)用的請(qǐng)求。當(dāng)ConcreteHandler(具體的處理程序)不知道如何滿足來(lái)自Client的請(qǐng)求時(shí),或它的目的不是這個(gè)時(shí),它會(huì)委派給鏈中的下一個(gè)Handler(處理程序)來(lái)處理
    2023-04-04
  • php中獲取關(guān)鍵詞及所屬來(lái)源搜索引擎名稱的代碼

    php中獲取關(guān)鍵詞及所屬來(lái)源搜索引擎名稱的代碼

    有時(shí)候我們需要知道用戶通過(guò)哪個(gè)搜索引擎,通過(guò)拿個(gè)關(guān)鍵詞訪問(wèn)我們頁(yè)面,當(dāng)然js也可以實(shí)現(xiàn),但這里介紹下php的實(shí)現(xiàn)代碼。
    2011-02-02
  • PHP設(shè)計(jì)模式之命令模式示例詳解

    PHP設(shè)計(jì)模式之命令模式示例詳解

    這篇文章主要給大家介紹了關(guān)于PHP設(shè)計(jì)模式之命令模式的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12

最新評(píng)論

德化县| 三穗县| 芦溪县| 五常市| 厦门市| 株洲市| 蒙城县| 青铜峡市| 东乡族自治县| 柏乡县| 通江县| 二连浩特市| 辽阳县| 永兴县| 芮城县| 舞阳县| 西乡县| 司法| 平利县| 徐水县| 横峰县| 西吉县| 霍城县| 区。| 滨州市| 宝丰县| 瑞金市| 濮阳市| 崇明县| 军事| 六枝特区| 体育| 隆林| 佛冈县| 马山县| 剑河县| 枝江市| 东乡县| 泰州市| 伽师县| 确山县|