PHPAPC configuration file 2 sets and parameter details _ PHP Tutorial

Source: Internet
Author: User
Tags apc
Two sets of PHPAPC configuration files and detailed descriptions of parameters. 1. install APC to download pecl. php. the netgetAPC-3.1.9.tgz compilation parameters are as follows: Copy the code as follows:. configure -- enable-apc-spinlocks -- disable-apc-pthreadmut 1. install APC
Download http://pecl.php.net/get/APC-3.1.9.tgz

The compilation parameters are as follows:

The code is as follows:

./Configure -- enable-apc-spinlocks -- disable-apc-pthreadmutex


The installation process will not be mentioned. The standard php extension installation mode.

2. 2 sets of configuration files

High performance, not suitable for frequent updates:

The code is as follows:

Apc. enabled = 1
Apc. stat = 0
Apc. stat_ctime = 0
Apc. shm_size = 64 M
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


Low performance:

The code is as follows:

Apc. enabled = 1
Apc. stat = 1
Apc. stat_ctime = 1
Apc. shm_size = 64 M
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

The key to the two sets of configuration is apc. stat. after it is enabled, APC will not check whether the file is updated, which can reduce unnecessary system calls.
However, you need to restart PHP for new release issues. you can choose as needed.

In addition, Parameter descriptions are attached:

Apc. enabled boolean

Apc. enabled can be set to 0 to disable APC. it is mainly used when APC is statically compiled into PHP, because there is no other method to disable it (when compiling to DSO, php can be used. the extension line in ini is commented out ).

Apc. shm_segments integer

The number of shared memory blocks to be allocated in the compiler cache. If APC uses up shared memory but has set apc. shm_size to the maximum value allowed by the system, you can increase the value.

Apc. shm_size integer

The size of each shared memory block in MB. By default, the size of shared memory blocks in some systems (including most BSD variants) is very low.

Apc. optimization integer

Optimization level. If it is set to 0, the optimizer is disabled. if it is set to a higher value, more active optimizations are used. We expect a very limited speed increase. It is still being tested.

Apc. num_files_hint integer

Estimate the number of different source files contained or requested on the Web server. If you are not sure, set it to 0 or remove this option. this setting is mainly used for sites with thousands of source files.

Apc. user_entries_hint integer

Similar to apc. num_files_hint, cache variables are stored based on the number of unique users. If not, set it to 0 or remove it.

Apc. ttl integer

The number of seconds that cache entries can stay in the buffer. 0 indicates never timeout. Recommended value: 7200 ~ If 86400 is set to 0, 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 ~ for each user ~ 86400. If it is set to 0, the buffer may be filled with old cache entries, resulting in the inability to cache new entries. If the value is greater than 0, APC will try to delete the expired entries.

Apc. gc_ttl integer

The number of seconds that cache entries can exist in the garbage collection table. This value provides a security measure, that is, when the server process executes the cached source file, if the file is modified, the old version will not be recycled until the TTL is reached. Setting 0 disables this feature.

Apc. cache_by_default boolean

The default value is on, but it can be set to off and used together with apc. filters starting with the plus sign. the file is cached only when the filter is matched.

Apc. filters string

A list of POSIX extension regular expressions separated by commas. If any mode matches the source file name, the file is not cached. Note that the file name used for matching is the file name passed to include/require, rather than the absolute path. If the first character of the regular expression is + t, it means that any file that matches the expression will be cached. if the first character is-, no matching item will be cached. -It is the default value and can be omitted.

Apc. mmap_file_mask string

If you use -- enable-mmap (enabled by default) to compile MMAP support for APC, the value here is the mktemp file mask passed to the mmap module (recommended value: "/tmp/apc. XXXXXX "). This mask is used to determine whether the memory ing area is file-backed or shared memory backed. For direct file-backed memory ING, set it to "/tmp/apc. XXXXXX" (exactly 6 X ). To use the POSIX shm_open/mmap style, you must set it to "/apc. shm. XXXXXX. You can also set it to "/dev/zero" to use the kernel "/dev/zero" interface for anonymous ing memory. If this command is not defined, anonymous ING is mandatory.

Apc. slam_defense integer

On a very busy server, whether it is to start the service or modify files, it may be caused by multiple processes attempting to cache a file at the same time. This option is used to set the percentage of cached steps skipped by a process when processing files that are not cached. For example, if the value is set to 75, it indicates that no cache is performed for files that are not cached, reducing the chance of collision. We recommend that you set this command to 0 to disable this feature. We recommend that you use the apc. write_lock command.

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. This is not the case for text editors, cp, tar, and other programs, which may buffer incomplete files. The default value is 2, indicating that the file is not buffered if the modification time is less than 2 seconds away from the access time. The unfortunate visitor may get incomplete content, but this bad effect will not be extended through the cache. If you can ensure that all update operations are atomic operations, you can disable this feature with 0. If your system updates slowly due to a large number of IO operations, you need to increase this value.

Apc. enable_cli integer

Whether to enable APC for the CLI version. this option is enabled only for testing and debugging purposes. Under normal circumstances, it is not ideal to create, populate, and destroy the APC cache on each request of the CLI, but various test schemes are very useful and can easily make the php apc of the CLI version

Apc. max_file_size integer

The default value is 1 MB. files larger than this value are not cached.

Apc. stat integer

Whether to enable the script update check. Be very careful when changing the command value. The default value On indicates that APC checks whether the script is updated every time it requests the script. if the script is updated, it automatically re-compiles and caches the compiled content. However, this has a negative impact on performance. If it is set to Off, the check is not performed, which greatly improves the performance. However, to make the updated content take effect, you must restart the Web server (note: If cgi/fcgi is used, restart the cgi/fcgi process ). Script files on the production server are rarely changed. you can disable this option to significantly improve performance.

This command is also valid for include/require files. However, if you are using a relative path, APC must check each include/require operation to locate the file. If you use absolute paths, you can skip the check. Therefore, you are encouraged to use absolute paths for the include/require operation.

Apc. write_lock boolean

On a busy server, the Web server is started for the first time, or many files are modified at the same time. APC may compile the same file multiple times, write locks ensure that only one process will attempt to compile and cache uncached scripts. Other processes attempt to use this script will not use opcode cache, instead of locking and waiting for cache generation.

Apc. report_autofilter boolean

Whether to record all scripts that are automatically not cached due to early/late binding.

Apc. include_once_override boolean

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

Apc. rfc1867 boolean

Enable the upload progress monitoring function

Apc. rfc1867_prefix string

Prefix of the buffer entry name used to upload files

Apc. rfc1867_name string

Name of the hidden form item of the uploaded file to be processed by APC

Apc. rfc1867_freq string

The update frequency of file cache items uploaded by users. The value can be the percentage of the Total file size, or the absolute size ending with "k", "m", or "g" kilobytes, megabytes, or gigabytes (case insensitive ). 0 indicates the update speed as fast as possible, but this may cause the upload speed to decrease.

Apc. rfc1867_ttl bool

TTL for rfc1867 entries.

Apc. localcache boolean

Using a non-locked local process shadow-cache can reduce the competition between locks when writing data to the buffer zone.

Apc. localcache. size integer

The size of the local process shadow-cache, shocould be set to a sufficiently large value, approximately half of apc. num_files_hint.

Apc. coredump_unmap boolean

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

Apc. stat_ctime integer

Verifying ctime can avoid problems caused by SVN or rsync and ensure that inode has not changed since the previous statistics. APC usually only checks the mtime (modification time ).

Apc. canonicalize bool

If it is set to on, the relative path will be changed to absolute path when no-state mode (file update is not checked.

Apc. preload_path string

Apc. use_request_time bool
Use the SAPI request start time for TTL.

Apc. file_md5 bool

Record the md5 value of the file

Apc. lazy_functions integer

Enable function delayed loading

Apc. lazy_classes integer

Enable class delay loading

The compile download http://pecl.php.net/get/APC-3.1.9.tgz compilation parameters are as follows:./configure -- 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.