欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP開啟opcache提升代碼性能

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

配置指令如下:

[opcache]
zend_extension=opcache.so
opcache.enable_cli=1
;共享內(nèi)存大小, 這個根據(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
;打開快速關(guān)閉, 打開這個在PHP Request Shutdown的時候 會收內(nèi)存的速度會提高
opcache.fast_shutdown=1
;不保存文件/函數(shù)的注釋
opcache.save_comments=0 

實際性能對比:

下面是實際測試中沒有開啟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)

開啟之后的數(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)

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

相關(guān)文章

  • PHP之uniqid()函數(shù)用法

    PHP之uniqid()函數(shù)用法

    這篇文章主要介紹了PHP中uniqid()函數(shù)的用法,包括了函數(shù)的基本用法與應(yīng)用分析,是非常實用的技巧,需要的朋友可以參考下
    2014-11-11
  • PHP內(nèi)存溢出的解決方法詳解

    PHP內(nèi)存溢出的解決方法詳解

    內(nèi)存溢出是指應(yīng)用系統(tǒng)中存在無法回收的內(nèi)存或使用的內(nèi)存過多,最終使得程序運行要用到的內(nèi)存大于虛擬機能提供的最大內(nèi)存。本文為大家總結(jié)了PHP內(nèi)存溢出的解決方法,需要的可以參考一下
    2022-07-07
  • PHP回調(diào)函數(shù)概念與用法實例分析

    PHP回調(diào)函數(shù)概念與用法實例分析

    這篇文章主要介紹了PHP回調(diào)函數(shù)概念與用法,簡單介紹了回調(diào)函數(shù)的概念、原理,并結(jié)合實例形式分析了回調(diào)函數(shù)的相關(guān)使用技巧,需要的朋友可以參考下
    2017-11-11
  • php設(shè)計模式 Interpreter(解釋器模式)

    php設(shè)計模式 Interpreter(解釋器模式)

    php設(shè)計模式 Interpreter(解釋器模式),需要的朋友可以參考下。
    2011-06-06
  • php進行md5加密簡單實例方法

    php進行md5加密簡單實例方法

    在本文里小編給大家整理了一篇非常實用的php如何進行md5加密知識點內(nèi)容,有需要的朋友們可以參考下。
    2019-09-09
  • PHP的Yii框架中View視圖的使用進階

    PHP的Yii框架中View視圖的使用進階

    這篇文章主要介紹了PHP的Yii框架中View視圖的使用進階,包括布局和數(shù)據(jù)塊的創(chuàng)建使用等,需要的朋友可以參考下
    2016-03-03
  • PHP對象遞歸引用造成內(nèi)存泄漏分析

    PHP對象遞歸引用造成內(nèi)存泄漏分析

    這篇文章主要介紹了PHP對象遞歸引用造成內(nèi)存泄漏分析,是PHP程序設(shè)計中需要加以重視的一個bug,并且有助于深入理解PHP運行原理,需要的朋友可以參考下
    2014-08-08
  • php獲取網(wǎng)卡的MAC地址支持WIN/LINUX系統(tǒng)

    php獲取網(wǎng)卡的MAC地址支持WIN/LINUX系統(tǒng)

    這篇文章主要介紹了使用php獲取網(wǎng)卡的MAC地址支持WIN/LINUX系統(tǒng),需要的朋友可以參考下
    2014-04-04
  • 詳解phpmyadmin相關(guān)配置與錯誤解決

    詳解phpmyadmin相關(guān)配置與錯誤解決

    這篇文章主要介紹了詳解phpmyadmin相關(guān)配置與錯誤解決的相關(guān)資料,希望通過本文能幫助到大家,讓大家遇到這種問題可以解決,需要的朋友可以參考下
    2017-10-10
  • PHP中使用Imagick讀取pdf并生成png縮略圖實例

    PHP中使用Imagick讀取pdf并生成png縮略圖實例

    這篇文章主要介紹了PHP中使用Imagick讀取pdf并生成png縮略圖實例,本文直接給出實現(xiàn)代碼,需要的朋友可以參考下
    2015-01-01

最新評論