2013-03-11 62 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中获益。事实上,通常你甚至不需要基准来区分差异;只需浏览您的网站即可看到差异。

如果你看不到任何差异,你的基准不具有某种错误,那么我建议你开始调试的问题(启用错误报告,检查日志等)。