optimizes performance by removing the compilation time of PHP scripts by caching the compiled state of PHP scripts in shm (RAM) and using the compiled version directly from RAM.
Based on observations using PHP 5.5.3 and Xcache 3.1.0 , I can do this:
Cacher
This module covers two types of caching Opcode and Variable .
Opcode caching is designed for easy migration. You cannot configure how it decides to cache how much:
- xcache.count indicates how many cache threads and correlates with the number of processor cores that you want to use - the idea is that multithreading should be the fastest, but there is no guarantee, so experiment yourself.
- As a guideline, the actual values ββof the account will be 2 ^ n, as 1, 2, 4, 8 - 0, disables cacher, and other values ββare rounded to the nearest real value
- xcache.size points to the aggregate memory of all cache threads. Thus, each thread receives approximately
size/count memory - OOM aka Out of Memory , refers to the event when the cache stream reaches its maximum size
For variable caching, you need to use a simple get / set api in the application code. After you enable it using xcache.var_size and xcache.var_count (similar to the opcode settings), you use xcache_set($var1) and xcache_get($var1) in your scripts.
lost
The xcache.stat parameter determines whether to check whether the file has been modified since it was cached:
- When set to On , files are checked and overwritten.
- When set to Off. , the pass will remain in the first cached version until the expiration time, which can help performance by limiting disk I / O
In your development environment, it is recommended to store On so that you can constantly update and check your code, otherwise you must clear the cache to see file updates.
Flushing
There is a web admin interface that allows you to clear a specific cache. The web administrator uses the php api: xcache_clear_cache(β¦) .
Since the cache is RAM, at any time when the server restarts the cache, it must be reset.
Really
Cached objects expire according to xcache.ttl and xcache.var_ttl , which respectively control the number of seconds that a cached item is stored (0 is undefined and the default value).
Corager
The cover module, otherwise called Code Coverage, is a little cryptic. According to FeatureList , this is like a diagnostic tool that should be enabled for temporary administrative / test situations:
- Coverager + real test case environment, including: [TOSHARE]
- realcase testcase framework, a script control with a real browser. you need to write test cases.
- built-in Coverager + its viewer from the Internet to find out how many script you tested.
- testcase + Coverager just helps you make sure that all real php web applications work correctly when
- after turning on XCache
- after upgrading php4 to php5
- after upgrading php4 / 5 to php6
source share