PHP APC configuration file 2 set and parameter details _php tutorial

Source: Internet
Author: User
Tags apc apc configuration posix
I. Installation of APC
Download http://pecl.php.net/get/APC-3.1.9.tgz

The compilation parameters are as follows:
Copy the Code code as follows:./configure--ENABLE-APC--enable-apc-spinlocks--disable-apc-pthreadmutex
The installation process is not said, the standard PHP extension installation mode.

Two, 2 sets of configuration files

High performance, not suitable for frequent updates:
Copy the Code code as follows: Apc.enabled=1
Apc.stat = 0
Apc.stat_ctime = 0
Apc.shm_size = 64M
Apc.shm_segments = 1
Apc.num_files_hint = 1000
Apc.ttl = 0
Apc.slam_defense = 0
Apc.write_lock = 1
Apc.file_update_protection = 2

Slightly lower performance:
Copy the Code code as follows: Apc.enabled=1
Apc.stat = 1
Apc.stat_ctime = 1
Apc.shm_size = 64M
Apc.shm_segments = 1
Apc.num_files_hint = 1000
Apc.ttl = 86400
Apc.slam_defense = 0
Apc.write_lock = 1
Apc.file_update_protection = 2

2 sets of configuration key is Apc.stat, when turned on APC will not check whether the file is updated, this can reduce a large number of unnecessary system calls.
However, you will need to restart PHP for the newly released issue. Can be selected according to the situation.

Also, attach the parameter description:

Apc.enabled Boolean

Apc.enabled can be set to zero to disable APC. Mainly used when APC is statically compiled into PHP, because there is no other way to disable (compile to DSO, you can comment out the php.ini in the extension line).

Apc.shm_segments integer

The number of shared memory blocks that the compiler caches to allocate. If the APC is running out of shared memory but has set apc.shm_size to the maximum allowed by the system, you can try increasing this value.

Apc.shm_size integer

The size of each shared memory block in megabytes. By default, some systems (including most BSD variants) have very low block sizes of shared memory.

Apc.optimization integer

Optimization level. Set to 0 disables the optimizer, and higher values use more aggressive optimizations. Expect a very limited speed boost. is still in the experiment.

Apc.num_files_hint integer

Approximate estimate of the number of different source files that are included or requested on the WEB server. Set to 0 or remove this if unsure; This setting is used primarily in sites with thousands of source files.

Apc.user_entries_hint integer

Like Apc.num_files_hint, cache variables are stored according to the unique number of users. Set to 0 or remove this if you are not sure.

Apc.ttl integer

The number of seconds that the cache entry is allowed to stay in the buffer. 0 means never time out. A recommended value of 7200~86400 set to 0 means that the buffer may be filled with old cache entries, resulting in the inability to cache new entries.

Apc.user_ttl integer

Similar to Apc.ttl, the recommended value is 7200~86400 for each user. A setting of 0 means that the buffer may be filled with old cache entries, causing the new entries to be cached. If greater than 0,APC will attempt to delete expired entries.

Apc.gc_ttl integer

The number of seconds that a cache entry can exist in the garbage collection table. This value provides a security measure that, when the server process executes the cached source file, if the file is modified, the old version will not be reclaimed until this TTL is reached. Set to zero disables this attribute.

Apc.cache_by_default Boolean

The default is on, but can be set to off and used with the apc.filters at the beginning of the plus sign, and the file is cached only when matching the filter.

Apc.filters string

A comma-delimited list of POSIX extension regular expressions. If either pattern matches the source file name, the file is not cached. Note the filename used to match is the file name passed to Include/require, not the absolute path. If the first character of the regular expression is + t then any file matching the expression will be cached, and if the first character is-then no match will be cached. -is the default value and can be omitted.

Apc.mmap_file_mask string

If MMAP support is compiled for APC using--ENABLE-MMAP (enabled by default), the value here is the Mktemp-style file mask that is passed to the Mmap module (the recommended value is "/TMP/APC". XXXXXX "). This mask is used to determine if the memory-mapped area is to be file-backed or shared memory backed. For direct file-backed memory mapping, set to "/TMP/APC". XXXXXX "(exactly 6 x). To use POSIX-style shm_open/mmap, you need to set it to "/apc.shm.xxxxxx". You can also set the "/dev/zero" to use the kernel's "/dev/zero" interface for memory that is mapped anonymously. Undefined this directive means that anonymous mappings are enforced.

Apc.slam_defense integer

On a very busy server, whether it's starting a service or modifying a file, it can cause a race condition because multiple processes are trying to cache a file at the same time. This option sets the percentage of the process to skip cache steps when processing files that are not cached. For example, set to 75 indicates that there is a 75% probability of not caching when a file is not cached, thus reducing the chance of collisions. Objection to the use of the directive, encourage the setting of zero to disable this feature. It is recommended to use the Apc.write_lock directive.

Deprecated by Apc.write_lock.

Apc.file_update_protection integer

When you modify a file on a running server, you should perform atomic operations. That is, first write a temporary file, and then rename the file (MV) to the final name. The text editor, as well as the CP, tar and other programs do not operate this way, resulting in the possibility of buffering the mutilated files. The default value of 2 indicates that the modification time is not buffered if the access time is less than 2 seconds when the file is accessed. The unfortunate visitor may get incomplete content, but the bad effect is not amplified by the cache. If you can ensure that all update operations are atomic, you can turn this feature off with 0. If your system is slow to update due to a large number of IO operations, you need to increase this value.

APC.ENABLE_CLI integer

Whether APC functionality is enabled for the CLI version, this option is turned on only for testing and debugging purposes. Under normal circumstances is not ideal for creating, populating, and destroying the APC cache on each request of the CLI, but various test scenarios are useful to enable the CLI version of the PHP APC to be easily

Apc.max_file_size integer

By default, 1M will not be cached for files larger than this value.

Apc.stat integer

Whether to enable the script update check. Be very careful to change this command value. The default value on indicates that APC checks that the script is updated every time the script is requested, and automatically recompile and cache the compiled content if it is updated. But doing so has a detrimental effect on performance. If set to Off, no check is made, resulting in a significant performance gain. However, in order for the updated content to take effect, you must restart the Web server (translator Note: If you use cgi/fcgi similar, you need to restart the cgi/fcgi process). The script files on the production server are rarely changed and can achieve significant performance gains by disabling this option.

This command is also valid for Include/require files. However, it should be noted that if you are using a relative path, APC must check each time Include/require to locate the file. Using an absolute path allows you to skip the check, so you are encouraged to use an absolute path for include/require operations.

Apc.write_lock Boolean

On a busy server, when the Web server is first started, or many files are modified at the same time, the APC may compile the same file multiple times, and the write lock guarantees that only one process will attempt to compile and cache the script that is not cached. Other processes trying to use the script will not use the opcode cache instead of locking and waiting for the cache to be generated.

Apc.report_autofilter Boolean

Whether to log all scripts that are not cached automatically because of the early/late binding reason.

Apc.include_once_override Boolean

Optimize the include_once () and require_once () functions to avoid performing additional system calls.

apc.rfc1867 Boolean

Enable monitoring file Upload progress function

Apc.rfc1867_prefix string

Buffer entry name prefix for uploading files

Apc.rfc1867_name string

Hidden table item names for uploaded files that need to be processed by APC

Apc.rfc1867_freq string

The frequency at which users upload file cache entries. The value can be a percentage of the total file size, or an absolute size (case insensitive) ending with "K", "M", or "G" kilobytes, megabytes, or gigabytes. 0 means updates as fast as possible, but this may cause the upload speed to drop.

APC.RFC1867_TTL BOOL

TTL for rfc1867 entries.

Apc.localcache Boolean

Using the non-locking local process shadow-cache, it reduces the competition between locks when writing to buffers.

Apc.localcache.size integer

The size of the local process Shadow-cache, should is set to a sufficiently large value, approximately half of Apc.num_fil Es_hint.

Apc.coredump_unmap Boolean

Enable an APC signal handle, such as a SIGSEGV signal, when the signal is written to the core file. When these signals are received, APC will attempt to unmap the shared memory segment and exclude it from the core file. This setting can improve the stability of the system when it receives a fatal signal or uses the large shared memory segment of APC configuration.

Apc.stat_ctime integer

Verifying CTime (creation time) avoids problems with SVN or rsync and ensures that the inode has not changed since the last statistic. APC usually only checks the mtime (modification time).

apc.canonicalize BOOL

If set to ON, the relative path is changed to an absolute path in no-state mode (without checking for file updates).

Apc.preload_path string

apc.use_request_time BOOL
Use the SAPI request to start time for TTL.

APC.FILE_MD5 BOOL

MD5 value of the record file

Apc.lazy_functions integer

Enable function Lazy Loading

Apc.lazy_classes integer

Enable class lazy Loading

http://www.bkjia.com/PHPjc/781813.html www.bkjia.com true http://www.bkjia.com/PHPjc/781813.html techarticle First, install APC download http://pecl.php.net/get/APC-3.1.9.tgz compile parameters as follows: Copy the code as follows:./configure--ENABLE-APC-- Enable-apc-spinlocks--disable-apc-pthreadmut ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.