Web application caching is the process of storing dynamically generated data
for reuse and leaving data closer to the end user.
Caching used to store static & dynamic data.
For static (js, images, css) there are different kind of caching mechanism used,
CDN : akamai, maxcdn,
For application File, object cache opcode cache get used : APC, eaccelarator,
For dynamic data caching Memcache, Redis,
Why to use
• To improve web application performance
• To minimize the requests to the server
• Even small performance improvements from caching can drastically
improve the user experience.
• Reduced server workload can translate to reduced hardware and support
Type of caches
• Opcode Cache : APC, eAccelerator, Wincache, Xcache
• Query Result cache : Memcache, Redis
• CDNs : Content Delivery Networks
• APC : Alternative PHP Cache
• That heavily optimizes and tunes the output of the PHP bytecode compiler and stores
the final, compiled result in shared memory.
• This bytecode optimization leads to faster runtime execution since source files do not
need to be recompiled
• re-use the compiled code rather than having to retrieve the opcodes from a disk cache,
• 3x increase in page generation speed
Key Value pair
Slabs, pages, chunks
A slab class is a collection of pages divided into same sized chunk.
Each slab class has one or more pages, The page is of a predefined size (default
1MB). So, depending on the chunk size each page has a certain number of chunks
and some space left over wasted
• LRU is rescue : When memory gets full, so no pages can be created, the LRU (Least
Recently Used) algorithm kicks in.
• A content delivery network or content distribution network (CDN)
• large distributed system of servers deployed in multiple data centers
across the Internet
• The goal of a CDN is to serve content to end-users with high availability
and high performance.
• CDN serves : static files like js, css, images, text files