2013-03-11 37 views
2

我最近了解APC(我知道,我來晚的演出),並決定嘗試一下我的開發服務器上。我做了一些基準測試與ApacheBench,讓我吃驚,我發現,事情正在運行比以前。APC讓PHP 5.3更慢?

我還沒有做任何代碼優化使用apc_fetch或任何東西,但我覺得操作碼緩存應該對它自己產生積極的影響嗎?

C:\Apache24\bin>ab -n 1000 http://localhost/ 
This is ApacheBench, Version 2.3 <$Revision: 1178079 $> 
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Licensed to The Apache Software Foundation, http://www.apache.org/ 

Benchmarking localhost (be patient) 
Finished 1000 requests 


Server Software:  Apache/2.4.2 
Server Hostname:  localhost 
Server Port:   80 

Document Path:  /
Document Length:  22820 bytes 

Concurrency Level:  1 
Time taken for tests: 120.910 seconds 
Complete requests:  1000 
Failed requests:  95 
    (Connect: 0, Receive: 0, Length: 95, Exceptions: 0) 
Write errors:   0 
Total transferred:  23181893 bytes 
HTML transferred:  22819893 bytes 
Requests per second: 8.27 [#/sec] (mean) 
Time per request:  120.910 [ms] (mean) 
Time per request:  120.910 [ms] (mean, across all concurrent requests) 
Transfer rate:   187.23 [Kbytes/sec] received 

Connection Times (ms) 
       min mean[+/-sd] median max 
Connect:  0 0 0.4  0  1 
Processing: 110 120 7.2 121  156 
Waiting:  61 71 7.1  72  103 
Total:  110 121 7.2 121  156 

Percentage of the requests served within a certain time (ms) 
    50% 121 
    66% 122 
    75% 123 
    80% 130 
    90% 131 
    95% 132 
    98% 132 
    99% 137 
100% 156 (longest request) 

這是我的php.ini中的APC部分。我最左邊的東西在默認情況下,除了不斷擴大的默認大小爲128MB,而不是32

[APC] 
apc.enabled = 1 
apc.enable_cli = 1 
apc.ttl=3600 
apc.user_ttl=3600 
apc.shm_size = 128M 
apc.slam_defense = 0 

難道我做錯了什麼,或者我只需要使用apc_fetch /存儲真正得到好處APC?

感謝你們能給任何見解。

+0

_「注意:在Windows上,APC需要一個臨時路徑來存在,並且可以通過Web服務器寫入,它按順序檢查TMP,TEMP和USERPROFILE環境變量」_此路徑是否存在? – Wrikken 2013-03-11 16:54:48

+1

APC應該有所作爲......你有AB數字之前和之後,還是之後? – 2013-03-11 16:55:28

+0

而且要知道,有很多其他因素的影響,如不良的數據庫查詢或文件訪問可以有一個很大的不利開銷 – 2013-03-11 17:12:36

回答

0

啓用APC使用默認設置將發揮顯着的(至少可以這樣說),響應時間爲你的PHP腳本的區別。您不必使用任何特定的存儲/獲取功能從APC中獲益。事實上,通常你甚至不需要基準來區分差異;只需瀏覽您的網站即可看到差異。

如果你看不到任何差異,你的基準不具有某種錯誤,那麼我建議你開始調試的問題(啓用錯誤報告,檢查日誌等)。