Using APC to cache PHP opcode

Source: Internet
Author: User

1. About the version

My PHP version is 5.3.10 the first to use APC-3.1.8 compile successfully, but php-m not be extended, replaced APC-3.1.9 after resolution.

2. About Configuration

Apc.cache_by_default = 0 When you need to filters to match the open files generally these two are compatible with

Apc.cache_by_default Caching is enabled by default. 1 means "enabled" and 0 means "disabled"
Apc.filters The comma-delimited POSIX regular expression determines whether the file needs to be cached or not. A regular that starts with a +
An expression will force APC not to cache any files that match this regular expression. A regular expression that begins with a-a will force
APC caches any files that match this regular expression
Apc.stat Enables or disables APC checks for all requests for PHP scripts for changes. This is performed every time the script is invoked.
Process. If you disable this setting, you will need to restart the Web server after making any changes to the PHP script to
Clears the cache and changes the contents of the script. 0= disabled, 1 = enabled, default 1
Apc.enabled Enables or disables the APC cache. 0= disabled, 1 = enabled, default 1
Apc.shm_size Sets the shared memory size that is allowed by APC, which is measured in megabytes
Apc.shm_segments To set the total number of shared memory segments available
Apc.include_once_override Enables or disables optimizations for include_once and require_once. When you enable this setting, you can reduce the additional system calls made by PHP intrinsics. 0= disabled, 1 = enabled, default 0
Apc.optimization Set the optimization level. 0= Disabling the optimization feature
Apc.num_files_hint Set the number of files you think you need to cache. The default value is 1000, and if you are unsure of the number of files, you can set 0
Apc.ttl Sets the expiration time, in seconds, that the file is stored in the cache.
Apc.write_lock Turning on this setting forces a single process to cache a specific footstep. For high-traffic Web servers or applications that must cache multiple files

3. Variable cache open in CLI mode

APC.ENABLE_CLI = 1

4. Performance YII Framework Xhprof test Results

No, it was before it started.

Yiibase::autoload inc:29.730 MS (18.1%)  excl:0.867 MS (0.5%) Total Calls

Same 35 load operation after opening

Yiibase::autoload inc:6.477 MS (5.5%)   excl:0.454 MS (0.4%) Total Calls

Time-consuming significantly reduced

5. Variable Caching

$bar = ' Bar ';
Apc_store (' foo ', $bar);
Var_dump (Apc_fetch (' foo '));

6. Process Communication Tools

The APC variable cache at the time of the next multi-process is tried, and the main process can be shared with the child process, which means that APC can be used as a process communication tool, which is awesome.

Using APC to cache PHP opcode

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.