php apc configuration in detail

Introduction APC stands for Alternative PHP Cache is a free open source php caching plugin, its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code that .The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. APC can be directly used for caching php file content it can also be used to store key / value data for operation and maintenance for the former is used mostly for programmers, which is greater than a next section for an example of APC memory stick key / value data. xache common and have similar cache plugin eAccelerator , be familiar with the following configurations regarding the apc. PHP. ini configuration [Apc]; alternative php cache for caching, and optimization intermediate code php apc.cache_by_default = on; sys; whether the buffer is enabled by default for all files. ; If set off, and the instruction beginning apc.filters used together with a plus sign, if the file is only cached matched filter. apc.enable_cli = off; sys; apc function is enabled for the cli version, only for testing and debugging purposes only opened this directive. apc.enabled = on; apc is enabled, if statically compiled into php apc want to disable it, this is the only way. apc.file_update_protection = 2; sys; when you modify files on a running server, you should perform atomic operations. ; That is written to a temporary file and then rename the file (mv) to the final name. ; Text editor and cp, tar and other programs do not do the operation, leading to a possible buffer incomplete files. ; The default value of 2 indicates that if the modification time is less than 2 seconds from the access time when accessing the files will not be cached. ; The unfortunate visitors may get incomplete content, but this impact is not bad by caching expansion. ; If you can ensure that all update operations are atomic operations, you can use 0 to disable this feature. ; If your operating system is due to the large number of io lead to slow to update, you will need to increase this value. apc.filters =; sys; a comma-separated list posix extended regular expressions. ; If the source file name with any one of the pattern matching, the file is not cached. ; Pay attention to match the file name is passed to include / require the file name, rather than an absolute path. ; If the first character of the regular expression is "+" means any expression matching files are cached; if the first character is "-" then anything matched will not be cached. "-" is the default value, you can swap omitted. apc.ttl = 0; sys; the number of seconds to allow the cache entry to stay in the buffer. 0 means never timeout. The recommended value is 7200 ~ 36,000. ; Zero means that your cache could potentially fill up with stale cache entries, new entries will not be cached. apc.user_ttl = 0; sys; apc.ttl similar, but for each user, the recommended value of 7200 to 36000.. ; Zero means that your cache could potentially fill up with stale cache entries, new entries will not be cached. apc.gc_ttl = 3600; sys; garbage collection table in a cache entry may exist seconds. ; This value provides a safety measure, even if a server process crashes when performing a cache of source file; and the source file has been modified, the memory allocated for the old version will not be recovered until it reaches this ttl value. ; Set to zero to disable this feature. apc.include_once_override = off; sys; on the instruction currently no documentation, see:? http: //pecl.php.net/bugs/bug.php id = 8754; please keep off, it may cause unexpected result. apc.max_file_size = 1m; sys; larger than this prohibition files are cached. apc.mmap_file_mask =; sys; if using -enable-mmap (enabled by default) as apc compiled mmap support; value here is passed to mktemp-style mmap module file mask (recommended value is "/ tmp / apc. xxxxxx "). ; This mask is used to determine whether the region is to be memory-mapped file-backed or shared memory backed. ; For file-backed direct memory map, to set to "/tmp/apc.xxxxxx" appearance (just 6 x). ; To use posix-style shm_open / mmap need to set "/apc.shm.xxxxxx" look. ; You can also set "/ dev / zero" to anonymous mapping kernel memory usage "/ dev / zero" interface. ; This command is not defined, it said coerced to the anonymous mapping. apc. num_files_hint = 1000; sys; may be substantially different from the number of source files included or requested (the recommended value is 1024 to 4096) on a web server. ; If you are not sure, set to 0; this setting is mainly used for sites with thousands of source files. apc.optimization = 0; optimization level (recommended value is 0). ; Positive integer value optimization is enabled, a higher value is used more aggressive optimization. ; Higher values ​​may have very limited speed boost, but is still under trial. apc.report_autofilter = off; sys; whether to record all due to the early / late binding reasons are not automatically cached script. apc.shm_segments = 1; sys; is the number of shared memory buffers allocated blocks compiler (1 is recommended). ; If apc run out of shared memory, and the system has apc.shm_size instruction set to the maximum allowed; you can try to increase this value. apc.shm_size = 30; sys; shared memory size of each block (as a unit of mb, recommended value is 128 to 256). ; Some systems (including most bsd variants) default shared memory block size is very small. apc.slam_defense = 0; sys (against the use of this command, it is recommended that the use apc.write_lock instruction); on a very busy server, whether it is to start the server or modify files; at the same time are likely to attempt a cache of many processes files resulting in race conditions. ; This command is used to set the percentage of cache process to skip the step of uncached file. ; For example, represent 75 to 75% probability is not cached, thereby reducing the probability of collision in the event of non-cached files. ; Encouraged to 0 to disable this feature. apc.stat = on; sys; check whether the script updates enabled. ; Changing the value of this directive to be very careful. ; Defaults on apc represented at every script requests to check whether the script has been updated; if it is updated automatically recompiled after caching the content and compiled. But this has an adverse effect on performance. ; If set off said they did not check, so that the performance is greatly improved. ; But in order to make content updates to take effect, you must restart the web server. ; This command also valid for the include / require a file. However, it notes that; if you are using a relative path, apc it must be checked to locate the file each time include / require. ; And using an absolute path, you can skip the check, so you are encouraged to use absolute paths include / require operations. apc.user_entries_hint = 100; sys; num_files_hint similar instruction, but different for each user. ; If you are not sure, set to 0. apc.write_lock = on; sys; whether to enable the write lock. ; On a very busy server, whether it is to start the server or modify files; all may be due to multiple processes at the same time attempting to cache a file which led to competitive conditions. ; Enabling this directive can avoid race conditions. apc.rfc1867 = off; sys; the open command for each field contains exactly apc_upload_progress upload file field before,; APC will automatically create a cache entry upload_ user (that is apc_upload_progress field value). Probably look apc cache configuration, do not need to force yourself to remember the above, perhaps you CTRL + D Bookmark this page is the best way. Please wait a few hours, there will be accompanied by a simple example. Examples of address paste: Write lock is enabled. ; On a very busy server, whether it is to start the server or modify files; all may be due to multiple processes at the same time attempting to cache a file which led to competitive conditions. ; Enabling this directive can avoid race conditions. apc.rfc1867 = off; sys; the open command for each field contains exactly apc_upload_progress upload file field before,; APC will automatically create a cache entry upload_ user (that is apc_upload_progress field value). Probably look apc cache configuration, do not need to force yourself to remember the above, perhaps you CTRL + D Bookmark this page is the best way. Please wait a few hours, there will be accompanied by a simple example. Examples of address paste: Write lock is enabled. ; On a very busy server, whether it is to start the server or modify files; all may be due to multiple processes at the same time attempting to cache a file which led to competitive conditions. ; Enabling this directive can avoid race conditions. apc.rfc1867 = off; sys; the open command for each field contains exactly apc_upload_progress upload file field before,; APC will automatically create a cache entry upload_ user (that is apc_upload_progress field value). Probably look apc cache configuration, do not need to force yourself to remember the above, perhaps you CTRL + D Bookmark this page is the best way. Please wait a few hours, there will be accompanied by a simple example. Examples of address paste: accelerate the speed of large files apache article is taken from the network: http: //koda.iteye.com/blog/275869 operation and maintenance of survival time to sort out: http: //www.ttlsa.com/html/2819.html

Reproduced in: https: //my.oschina.net/766/blog/211505

Guess you like

Origin blog.csdn.net/weixin_33835690/article/details/91546022