Caching strategy and apc
Upcoming SlideShare
Loading in...5
×
 

Caching strategy and apc

on

  • 3,586 views

Presentation about Cache strategy for your website and u

Presentation about Cache strategy for your website and u

Statistics

Views

Total Views
3,586
Views on SlideShare
2,954
Embed Views
632

Actions

Likes
4
Downloads
52
Comments
0

2 Embeds 632

http://bloghoctap.com 623
http://secret.reader.vn 9

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Determine the existing size of your shared memory segment: sysctl -a | grep shmmax Set sysctl -w kernel.shmmax=50331648
  • Determine the existing size of your shared memory segment: sysctl -a | grep shmmax Set sysctl -w kernel.shmmax=50331648

Caching strategy and apc Caching strategy and apc Presentation Transcript

  • Caching Strategy & APC Vo Duy Tuan - CEO/Founder From the PHP developer view
  • $who_am_I?
    • My Name is Võ Duy Tuấn
    • PHP 5 Zend Certified Engineer
    • Interests: PHP, Social Network, Optimize Web
    • Works:
      • Reader.vn CEO/Founder
      • Trainer
      • Freelancer
      • Help customer Optimize & Speed up website
  • Caching Strategy 1
  • 1.1. Web Caching Introduction
  • 1.2. Cache Strategy
    • Heavy load page/module
    • HIT & MISS ratio.
    • Budget & Technology
    • AJAX
    • SEO friendly
    • Seperating to small tactics
      • Cache WHERE ?
      • Cache WHAT ?
      • Cache HOW LONG ?
  • 1.2.1. Cache WHERE?
  • 1.2.2. Cache WHAT?
    • File
    • Code
    • Query Result
    • Object
    • Array
    • String
    • Number
  • 1.2.3. Cache HOW LONG?
    • Cache Clear Type:
      • Never Expired
      • Normal Expired
      • Force Expired
    “ More time caching, less real time data.”
  • Which cache do you HATE most?
  • Alternative PHP Cache - APC 2
  • 2.1. What is APC?
    • Free PHP Extension
    • PHP Opcode cache
    • Support User data cache
    • Run on SAME machine with PHP
    • NOT support multi servers
  •  
  • 2.2. APC Installation
    • On linux:
      • pecl install apc
    • On Windows:
      • Download apc DLL file to PHP extension directory such as php_apc.dll
  • 2.3. PHP.INI
    • extension=/home/path/to/apc.so
    • [apc]
    • apc.enabled = 1
    • apc.cache_by_default= 0
    • apc.shm_segments=1
    • apc.optimization=0
    • apc.shm_size= 128
    • apc.ttl= 7200
    • apc.user_ttl= 7200
  • phpinfo()
  • 2.4. APC Monitor
  •  
  •  
  • 2.5. APC Using
  •  
  • 2.6. APC Tip
    • Opcode your web code only
    • Disable APC for PhpMyAdmin
    <Directory &quot;/mysite/public_html/&quot;> ... php_admin_flag apc.cache_by_default On </Directory <Directory &quot;/mysite/public_html/ phpmyadmin/ &quot;> ... php_admin_flag apc.cache_by_default Off </Directory>
  • 2.6. APC Tip..
    • Cache STRING is better than ARRAY
    • Long Time To Live better than Short
    • Case study:
      • Caching for Feed System:
  • BEFORE
  • BEFORE
  • ANALYSE
  • AFTER
  • Short TTL make fragmentation
  • Short TTL make fragmentation
    • It’s time to query …
    Thanks you!