私は最近 APC について知り (ショーに遅れてしまいました)、自分の開発サーバーで試してみることにしました。ApacheBench でベンチマークを行ったところ、驚いたことに、動作が以前よりも遅くなったことがわかりました。
使用するコードの最適化などは行っていませんが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セクションです。デフォルトのサイズを 32 ではなく 128MB に拡張する以外は、ほとんどをデフォルトのままにしました。
[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/store を使用するだけで本当に APC の恩恵を受けることができますか?
皆さんが与えることができる洞察に感謝します。