Coral: php apc

Revision as of 13:43, 12 November 2011 by Ric (talk | contribs) (Created page with "<div id="top" style="margin:0;padding: 0px 0px 0px 5px; color: #000; background-color: #FFFFEB; border: 1px solid darkslateblue;"><span id="top" style="margin:0;padding: 0px;font...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

PHP - APC

The APC administrator interface is a PHP script named apc.php located in folder UniServer\home\us_extra. It can be accessed using UniController


Server Configuration > PHP > PHP Accelerators

Alternatively, you can type the following into your browser: http://localhost/us_extra/apc.php

This page covers the administrator interface menu bar and fine-tuning the cache.


UniServer 8-Coral
  Home
  Quick Start
  General
  Apache
  MySQL
» PHP
  MSMTP
  CRON
  DtDNS
  Db Backup
  Perl
  Main Index

APC administrator menu

The APC administrator interface has the following menu options allowing you to view usage or inspect cached variables.


 


Refresh Data
This captures the current cache status and updates the statistics.


View Host Stats
This option allows you to view the current cache status, general cache information, and usage and statistics on hits and misses. Information displayed covers both the system cache (which handles opcodes) and the user cache (which handles user variables). Various other statistics are displayed, such as the number of cache requests per second, hit rate and miss rate.

This information allows you identify areas that are under-optimized. For example, the cache full count value indicates how often the cache has filled up. A high number indicates high cache churn. To reduce this, assign more memory to the cache.


System Cache Entries
The System Cache Entries menu lists the PHP scripts that are currently being cached, together with their filename, size and number of hits. APC automatically caches each script's opcodes.

Note: You can clear the opcode cache at any time with the Clear cache button top right of the page.


User Cache Entries
The User Cache Entries menu lists user variables that have been stored in the cache, together with their identifier, size, and creation and modification times. You can select any of these entries to look inside the cache entry and see what it contains. User cache entries are not automatically created by APC. They are the result of specific instructions in a PHP script.

Note: You can clear the user cache at any time with the Clear cache button top right of the page.

Top

Tuning the cache

The Uniform Server default apc.shm_size memory size is 64M, which should be adequate for most small applications. The setting is application specific. It may require adjusting to avoid fragmentation and cache churning. To determine if changes are required, open the APC control panel and check the following:


  • Under File Cache Information, check Cache Full Count. If it's greater than zero, the cache is filling up and churning. This is because there is not enough memory allocated. Resolve this by increasing the memory allocation (apc.shm_size).
  • Under Detailed Memory Usage and Fragmentation the Fragmentation value should be 0% (this may occasionally vary). A non-zero value is probably due to cache churning. Solve this the same as above.

Fragmentation occurs when cached items expire and new items fill their vacated memory space. The new item maybe slightly smaller than the old item and the remaining memory space may be too small for a new cache item. This unused memory space is referred to as fragmentation.


To avoid fragmentation, ensure you run your servers during high traffic conditions and note the value for Memory Usage. Double this value and add another Meg to it. Update the PHP configuration files with this new value for apc.shm_size

Additional Information

Read more about configuration directives at http://in3.php.net/manual/en/apc.configuration.php


Top