Your SlideShare is downloading. ×
  • Like
Caching strategy and apc
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Caching strategy and apc

  • 3,170 views
Published

Presentation about Cache strategy for your website and u

Presentation about Cache strategy for your website and u

Published in Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,170
On SlideShare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
54
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • 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

Transcript

  • 1. Caching Strategy & APC Vo Duy Tuan - CEO/Founder From the PHP developer view
  • 2. $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
  • 3. Caching Strategy 1
  • 4. 1.1. Web Caching Introduction
  • 5. 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 ?
  • 6. 1.2.1. Cache WHERE?
  • 7. 1.2.2. Cache WHAT?
    • File
    • Code
    • Query Result
    • Object
    • Array
    • String
    • Number
  • 8. 1.2.3. Cache HOW LONG?
    • Cache Clear Type:
      • Never Expired
      • Normal Expired
      • Force Expired
    “ More time caching, less real time data.”
  • 9. Which cache do you HATE most?
  • 10. Alternative PHP Cache - APC 2
  • 11. 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
  • 12.  
  • 13. 2.2. APC Installation
    • On linux:
      • pecl install apc
    • On Windows:
      • Download apc DLL file to PHP extension directory such as php_apc.dll
  • 14. 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
  • 15. phpinfo()
  • 16. 2.4. APC Monitor
  • 17.  
  • 18.  
  • 19. 2.5. APC Using
  • 20.  
  • 21. 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>
  • 22. 2.6. APC Tip..
    • Cache STRING is better than ARRAY
    • Long Time To Live better than Short
    • Case study:
      • Caching for Feed System:
  • 23. BEFORE
  • 24. BEFORE
  • 25. ANALYSE
  • 26. AFTER
  • 27. Short TTL make fragmentation
  • 28. Short TTL make fragmentation
  • 29.
    • It’s time to query …
    Thanks you!