基本上,既然已经安装了APC,我就认为内存跟踪会在需要时显示较少的内存跟踪(因为它是共享的)。但是,当使用相同页面的XDebug进行跟踪时(在此之前和之后,需要多次重新加载),它将显示内存的使用情况仍然与处理前相同。
我已经确认APC是通过成功输出apc_cache_info()来工作的。
以下是我在PHP.ini中的APC配置
[APC]
; This can be set to 0 to disable APC.
apc.enabled=1
; The number of shared memory segments to allocate for the compiler cache.
apc.shm_segments=1
; The size of each shared memory segment, with M/G suffixe
apc.shm_size=64M
; A "hint" about the number of distinct source files that will be included or
; requested on your web server. Set to zero or omit if you're not sure;
apc.num_files_hint=1024
; Just like num_files_hint, a "hint" about the number of distinct user cache
; variables to store. Set to zero or omit if you're not sure;
apc.user_entries_hint=4096
; The number of seconds a cache entry is allowed to idle in a slot in case this
; cache entry slot is needed by another entry.
apc.ttl=7200
; use the SAPI request start time for TTL
apc.use_request_time=1
; The number of seconds a user cache entry is allowed to idle in a slot in case
; this cache entry slot is needed by another entry.
apc.user_ttl=7200
; The number of seconds that a cache entry may remain on the garbage-collection list.
apc.gc_ttl=3600
; On by default, but can be set to off and used in conjunction with positive
; apc.filters so that files are only cached if matched by a positive filter.
apc.cache_by_default=1
; A comma-separated list of POSIX extended regular expressions.
apc.filters
; The mktemp-style file_mask to pass to the mmap module
apc.mmap_file_mask=c:/apc_cache/apc.XXXXXX
; This file_update_protection setting puts a delay on caching brand new files.
apc.file_update_protection=2
; Setting this enables APC for the CLI version of PHP (Mostly for testing and debugging).
apc.enable_cli=0
; Prevents large files from being cached
apc.max_file_size=1M
; Whether to stat the main script file and the fullpath includes.
apc.stat=1
; Vertification with ctime will avoid problems caused by programs such as svn or rsync by making
; sure inodes havn't changed since the last stat. APC will normally only check mtime.
apc.stat_ctime=0
; Whether to canonicalize paths in stat=0 mode or fall back to stat behaviour
apc.canonicalize=0
; With write_lock enabled, only one process at a time will try to compile an
; uncached script while the other processes will run uncached
apc.write_lock=1
; Logs any scripts that were automatically excluded from being cached due to early/late binding issues.
apc.report_autofilter=0
;This setting is deprecated, and replaced with apc.write_lock, so let's set it to zero.
apc.slam_defense=0编辑#1
我终于有时间再查一遍.
apc_cache_info()将显示:
DEBUG: Array
(
[num_slots] => 2048
[ttl] => 7200
[num_hits] => 4313
[num_misses] => 124
[start_time] => 1334152023
[expunges] => 0
[mem_size] => 21653480
[num_entries] => 119
[num_inserts] => 124
[file_upload_progress] => 1
[memory_type] => IPC shared
[locking_type] => file
[cache_list] => Array
(
[0] => Array
(
[filename] => ...phpinfo()将显示:
apc
APC Support enabled
Version 3.0.15-dev
MMAP Support Disabled
Locking type File Locks
Revision $Revision: 3.145 $
Build Date May 31 2007 09:39:25可以发送标题来改变APC的行为吗?(即)总是得到一个新的网页副本?)
编辑#2
我甚至将apc.max_file_size设置增加到500万,只是为了看看这是否是问题所在。同样的事情。要求在重新加载之间仍然使用相同数量的RAM。
我还注意到,文件的num_hits确实增加了。
编辑#3
从我的追踪档案来看:
0.0740 6152208 +492816 -> require(E:\my_require.php) E:\main.php:60当内存增量被缓存后,内存增量不应该在子库传递上显示一个低得多的值吗?
发布于 2012-04-20 00:27:31
编辑#3
从我的追踪档案来看:
0.0740 6152208 +492816 -> require(E:\my_require.php) E:\main.php:60
当内存增量被缓存后,内存增量不应该在子库传递上显示一个低得多的值吗?
是的,应该
此外,我认为使用缓存引擎将使其能够缓存并共享内存,从而限制了用于脚本的内存量。
https://stackoverflow.com/questions/9909054
复制相似问题