Hi, this is for U only.Do well, Feel Free…

  • No of Hits

    • 6,971 hits
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 8 other followers

  • Time is Now

    August 2012
    M T W T F S S
    « Jun   Oct »
  • Zip

  • Advertisements

Alternative PHP Cache

Posted by Manikandan.MS on August 3, 2012

             This article describes about Alternative PHP Cache(APC). In PHP scripting program there are basically two kinds of caching technique one is opcode cache and next one is data cache. The APC is the opcode cache which can significantly speed up your applications. It caches both user variables and php code so that it minimize overall server load and memory usage.

The following points will explains about APC in detail. Suppose a site has thousands of requests per minute then we want to speed up the things to response given. So that the APC comes. Actually it is a free, open and robust framework for caching and optimizing PHP intermediate code. Simply APC caches the compiled output of each php script and reuse it for subsequent requests.

How it speed up the applications? Actually it uses shared memory for read/write operations. That means it stores the opcode into shared memory then copies opcode into execution process. Classes and functions tables are also stored into shared memory. APC alos provides a user cache for storing application data.

Next parameter will explains execution of APC. Simply, it checks the required data in already exists cache. If it doesn’t, it should be generated from the original data source and a copy saved to cache for future use. If it does, it can use it from the cache directly. There are predefined methods available for developers to store and fetching data in apc cache. APC allows you to cache arrays, objects, functions and references.

Configuration is the main points in APC. There are some procedures need to follow to configure . It takes time to configure and must be re-configured whenever php script added. There are two primary decisions to be made while configuring. First, ensure how much memory is going to be allocated to APC and second, whether APC will check if a file has been modified for every request. Once the server is running the apc.php script is bundled and copied somewhere into root directory and viewed with a browser. If the cache capacity reached maximum it has to forcefully clean. Data capacity should be minimized in a well configured cache. The easiest way to minimize the capacity allocate more memory to APC. In default It use 32Mb. So use APC for caches which sites are do not change often and will not grow large.

When APC is build with Memory Mapping, it will use only one memory segment, unlike when APC is build with SHM(SysV Shared Memory), it will support multiple memory segment. But I don’t know much about SHM. A well configured APC will absolutely speed up the application. Use Apc caching module depends on project requirements which are not change often and will not grow large.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Why We live

TechView Mani

A blog of New Technologies


Hi, this is for U only.Do well, Feel Free...

%d bloggers like this: