SlideShare a Scribd company logo
<?PHP Performance ?>
                       w/APC + Memcached
                              for Windows

@FordAntiTrust
thaicyberpoint.com
thaithinkpad.com
thaihi5.com
Cache Theory ?
Cache Theory ?

             Req
                               1 Check

                      2 Miss
        Compute

                   Store 3        Cache
     4 Hit
         Output

                     Miss - [Store] - Hit
Type ?
                    Fast                                Slow




http://ralphlosey.files.wordpress.com/2007/06/ram.jpg
http://www.pctechguide.com/images/31HardDrive.jpg
APC ?

Alternative PHP Cache
Opcode Cache and Variables Cache




            Automatic update w/code changes




Code not changes request and Simply Installation
Free & Open Source
PHP Flow
                                             Req
• Scanning and Lexing
  (Plain Text to Tokens)

• Parsing                              • Scanning
                                       • Lexing
  (Tokens to Expressions)              • Parsing
                                       • Compilation
• Compilation
  (Translated Expressions to Opcode)

• Execution                             Execution
  (Opcode stacks are processed)

                                          Output
Normal PHP vs APC
Normal PHP vs APC
                  Req


            • Scanning
            • Lexing
            • Parsing
            • Compilation




             Execution


               Output
Normal PHP vs APC
             Req

           APC hook

       • Scanning
       • Lexing
       • Parsing           Miss
       • Compilation
           APC hook    Store      Opcode
                                   cache
        Execution
                           Hit

          Output
Why ?
Why ?




        http://ralphschindler.com/
Why ?




        http://ralphschindler.com/
Installation
• Windows (http://downloads.php.net/pierre/)
  – extension=php_apc.dll
Installation
• Windows (http://downloads.php.net/pierre/)
  – extension=php_apc.dll
• Basic PECL
  (http://pecl.php.net)
  – pecl install apc
Installation
• Windows (http://downloads.php.net/pierre/)
  – extension=php_apc.dll
                            Conf
• Basic PECL
  (http://pecl.php.net)
  – pecl install apc
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
Benchmark
                                         PHP Native               PHP w/APC
Concurrency Level                                                10
Time taken for tests                                       60 seconds
Complete requests                        298                      914

Total transferred                        643,149 bytes            1,962,675 bytes

HTML transferred                         516,971 bytes            1,582,035 bytes

Requests per second                      4.91 [#/sec] (mean)      15.21 [#/sec] (mean)

Time per request                         2035.405 [ms] (mean)     657.623 [ms] (mean)

Time per request                         203.541 [ms]             65.762 [ms]
(mean, across all concurrent requests)
Transfer rate                            10.35 [KB/s] received    31.88 [KB/s] received
Memcached
History



    “Developed by Danga Interactive for
             LiveJournal.com”
Memcached ?
• a distributed memory object caching system
  with hash table
Memcached ?
• a distributed memory object caching system
  with hash table
Memcached ?
• a distributed memory object caching system
  with hash table
• a generic two stage hashing system (clients
  and servers). Clients are written for specific
  application languages. Server is written in C
Memcached ?
• a distributed memory object caching system
  with hash table
• a generic two stage hashing system (clients
  and servers). Clients are written for specific
  application languages. Server is written in C
Memcached ?
• a distributed memory object caching system
  with hash table
• a generic two stage hashing system (clients
  and servers). Clients are written for specific
  application languages. Server is written in C
• 85% of top 20 sites use memcached; 50%+ of
  top 5k sites uses Memcached
Memcached ?
• a distributed memory object caching system
  with hash table
• a generic two stage hashing system (clients
  and servers). Clients are written for specific
  application languages. Server is written in C
• 85% of top 20 sites use memcached; 50%+ of
  top 5k sites uses Memcached
Limits (c/Hash Table)
• Key : max 250 chars.
• Values: max 1MB
Why Memcached ?
• Scale-out
  – Machine
  – Process (Use different ports)
• Memory faster than Disk
• Allows for efficient use of your database
• Can utilize existing network
  – Uses non-blocking network I/O (TCP/IP)
• Very flexible
• Client libraries in all major languages
/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows
“We use more than 800 servers supplying over
     28 terabytes of memory to our users.”

     “total throughput achieved is 300,000 UDP req/s”
                                       by Paul Saab Saturday, December 13, 2008 at 2:43am
 •   8-core machines
 •   20-30% CPU usage.
 •   scale memcached to 8 threads on an 8-core system
 •   moved to UDP for get operations to reduce network traffic


http://www.facebook.com/note.php?note_id=39391378919
Architecture practical ?




http://barry.files.wordpress.com/2007/04/new-servers-back-04-2007.jpg
Cache
                   Memcached
     APC            Memcached
                    Instance                 Reverse
                      Memcached
                      Instance
                         Memcached
                        Instance              Proxy
                          Instance
                                                                            I
                                                                            n
                                                                            t
                                                                            e
     PHP Web App
                                             Web Server                     r
                                                                            n
                                                                            e
                                       Session                      Files
                                                                            t
                           Memcached               Memcached
                            Memcached
                            Instance                Memcached
                                                    Instance
 Master    Slave              Memcached
                              Instance                Memcached
                                                      Instance
                                 Memcached
                                Instance                Instance
                                                          CDN/DFS
                                  Instance
DB
Installation & Used
memcached binary packages
• http://labs.northscale.com/memcached-packages/

1.   Unzip into a directory of choice
2.   Open the shell of your choice (i.e. cmd.exe); cd into the directory
3.   Run memcached.exe passing standard arguments.


Sample
C:memcachedmemcached.exe -m 128 -p 11211 -l 127.0.0.1 -d
PHP Session w/Memcached
session.save_handler = files
session.save_path = “C:/Windows/temp”

TO

session.save_handler = memcache
session.save_path = “tcp://server:port “

OR

ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://server:port,tcp://server:port');
Coding ? (in PHP)
/* OO API */
$memcacheObj = new Memcache;
$memcacheObj->connect('memcache_host', 11211);

/* set */
$memcacheObj->set('key', 'data', MEMCACHE_COMPRESSED, 50);
/ * get w/single key */
$var = $memcacheObj->get('key');
/ * get w/multiple key */
$var = $memcacheObj->get(array('key1', 'key2'));

$memcacheObj->close();
CMS ?
• Drupal has Memcache API and Integration
  http://drupal.org/project/memcache
• Wordpress has object cache
  http://mohanjith.net/blog/2008/10/using-memcached-with-
  wordpress-object-cache.html
Tips
Two Level Caching with Zend_Cache

• Tagging System in Files Cache
• Memcached Key used Tagging System
Two Level Caching - Workflow

                 Req



 Compute       Files Cache

                                       Memcached




     Output

                        1. Check   3. Store
                        2. Miss    4. Hit
Implement with Zend_Cache
Used Two Level with Zend_Cache
Ref.
• Improving PHP Application Performance with APC
     http://www.slideshare.net/vortexau/improving-php-application-
     performance-with-apc-presentation
• PHP Accelerators : APC vs Zend vs XCache with Zend
  Framework
     http://blog.digitalstruct.com/2007/12/23/php-accelerators-apc-vs-zend-vs-
     xcache-with-zend-framework/
• Scaling with memcached
     http://www.slideshare.net/acme/scaling-with-memcached
• Gear6 and Scaling Website Performance: Caching Session and
  Profile Data with Memcached
     http://www.slideshare.net/gear6memcached/gear6-and-scaling-website-
     performance-caching-session-and-profile-data-with-memcached
Ref. (2)
• PHP: Memcache - Manual
  http://th.php.net/manual/en/book.memcache.php
• http://danga.com/memcached/
• http://pecl.php.net/package/memcache
• http://www.socialtext.net/memcached/
Discussion
   Q&A
Thank you
           @FordAntiTrust
http://www.slideshare.net/FordAntiTrust

More Related Content

What's hot (20)

WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
webhostingguy
 
are available here
are available hereare available here
are available here
webhostingguy
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 
Performance_Up.ppt
Performance_Up.pptPerformance_Up.ppt
Performance_Up.ppt
webhostingguy
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
Joseph Scott
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
Sander Temme
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx Internals
Joshua Zhu
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load Balancer
MobME Technical
 
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSSupercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
CloudLinux
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
Chiranjeevi Jaladi
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
Kit Chan
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniques
Claudio Borges
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentation
Nagesh Chinkeri
 
Fastest Servlets in the West
Fastest Servlets in the WestFastest Servlets in the West
Fastest Servlets in the West
Stuart (Pid) Williams
 
Os Harkins
Os HarkinsOs Harkins
Os Harkins
oscon2007
 
Apache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer AppApache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer App
Jim Jagielski
 
Php psr standard 2014 01-22
Php psr standard 2014 01-22Php psr standard 2014 01-22
Php psr standard 2014 01-22
Võ Duy Tuấn
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magento
Mathew Beane
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
Mike Willbanks
 
WE18_Performance_Up.ppt
WE18_Performance_Up.pptWE18_Performance_Up.ppt
WE18_Performance_Up.ppt
webhostingguy
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 
WordPress Performance & Scalability
WordPress Performance & ScalabilityWordPress Performance & Scalability
WordPress Performance & Scalability
Joseph Scott
 
Apache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling UpApache Performance Tuning: Scaling Up
Apache Performance Tuning: Scaling Up
Sander Temme
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx Internals
Joshua Zhu
 
Web Server Load Balancer
Web Server Load BalancerWeb Server Load Balancer
Web Server Load Balancer
MobME Technical
 
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OSSupercharging your PHP pages with mod_lsapi in CloudLinux OS
Supercharging your PHP pages with mod_lsapi in CloudLinux OS
CloudLinux
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
Kit Chan
 
NginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniquesNginX - good practices, tips and advanced techniques
NginX - good practices, tips and advanced techniques
Claudio Borges
 
Memcached B box presentation
Memcached B box presentationMemcached B box presentation
Memcached B box presentation
Nagesh Chinkeri
 
Apache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer AppApache httpd 2.4: The Cloud Killer App
Apache httpd 2.4: The Cloud Killer App
Jim Jagielski
 
Php psr standard 2014 01-22
Php psr standard 2014 01-22Php psr standard 2014 01-22
Php psr standard 2014 01-22
Võ Duy Tuấn
 
J Ruby Whirlwind Tour
J Ruby Whirlwind TourJ Ruby Whirlwind Tour
J Ruby Whirlwind Tour
oscon2007
 
Zendcon scaling magento
Zendcon scaling magentoZendcon scaling magento
Zendcon scaling magento
Mathew Beane
 
MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011MNPHP Scalable Architecture 101 - Feb 3 2011
MNPHP Scalable Architecture 101 - Feb 3 2011
Mike Willbanks
 

Similar to /* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows (20)

Memcached, presented to LCA2010
Memcached, presented to LCA2010Memcached, presented to LCA2010
Memcached, presented to LCA2010
Mark Atwood
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
Jurriaan Persyn
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
yiditushe
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
guoqing75
 
The Native NDB Engine for Memcached
The Native NDB Engine for MemcachedThe Native NDB Engine for Memcached
The Native NDB Engine for Memcached
John David Duncan
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010
isnull
 
Apc Memcached Confoo 2011
Apc Memcached Confoo 2011Apc Memcached Confoo 2011
Apc Memcached Confoo 2011
Bachkoutou Toutou
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
Scott MacVicar
 
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6
 
Profiling php applications
Profiling php applicationsProfiling php applications
Profiling php applications
Justin Carmony
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
All The Little Pieces
All The Little PiecesAll The Little Pieces
All The Little Pieces
Andrei Zmievski
 
Gear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with MemcachedGear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with Memcached
Gear6
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with Memcache
Ben Ramsey
 
Qcon
QconQcon
Qcon
adityaagarwal
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
webhostingguy
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
webhostingguy
 
Bottom to Top Stack Optimization with LAMP
Bottom to Top Stack Optimization with LAMPBottom to Top Stack Optimization with LAMP
Bottom to Top Stack Optimization with LAMP
katzgrau
 
Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011
CodeIgniter Conference
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
Mauro Cassani
 
Memcached, presented to LCA2010
Memcached, presented to LCA2010Memcached, presented to LCA2010
Memcached, presented to LCA2010
Mark Atwood
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
Jurriaan Persyn
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
yiditushe
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
guoqing75
 
The Native NDB Engine for Memcached
The Native NDB Engine for MemcachedThe Native NDB Engine for Memcached
The Native NDB Engine for Memcached
John David Duncan
 
Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010Dutch php conference_apc_mem2010
Dutch php conference_apc_mem2010
isnull
 
Caching for Cash: Caching
Caching for Cash: CachingCaching for Cash: Caching
Caching for Cash: Caching
Scott MacVicar
 
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...Gear6 and Scaling Website Performance:  Caching Session and Profile Data with...
Gear6 and Scaling Website Performance: Caching Session and Profile Data with...
Gear6
 
Profiling php applications
Profiling php applicationsProfiling php applications
Profiling php applications
Justin Carmony
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
Wim Godden
 
Gear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with MemcachedGear6 Webinar - MySQL Scaling with Memcached
Gear6 Webinar - MySQL Scaling with Memcached
Gear6
 
Give Your Site a Boost with Memcache
Give Your Site a Boost with MemcacheGive Your Site a Boost with Memcache
Give Your Site a Boost with Memcache
Ben Ramsey
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
webhostingguy
 
Solving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and ScalabilitySolving the C20K Problem: PHP Performance and Scalability
Solving the C20K Problem: PHP Performance and Scalability
webhostingguy
 
Bottom to Top Stack Optimization with LAMP
Bottom to Top Stack Optimization with LAMPBottom to Top Stack Optimization with LAMP
Bottom to Top Stack Optimization with LAMP
katzgrau
 
Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011Bottom to Top Stack Optimization - CICON2011
Bottom to Top Stack Optimization - CICON2011
CodeIgniter Conference
 
Caching objects-in-memory
Caching objects-in-memoryCaching objects-in-memory
Caching objects-in-memory
Mauro Cassani
 
Ad

More from Ford AntiTrust (9)

Google calendar
Google calendarGoogle calendar
Google calendar
Ford AntiTrust
 
Drupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows Azure
Ford AntiTrust
 
Web Design, Running A Website And Hosting
Web Design, Running A Website And HostingWeb Design, Running A Website And Hosting
Web Design, Running A Website And Hosting
Ford AntiTrust
 
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2
PHP Hoffman Framework(HMF) at Barcamp Bangkok 2PHP Hoffman Framework(HMF) at Barcamp Bangkok 2
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2
Ford AntiTrust
 
GoOO->PHP [5] at Barcamp Bangkok 2
GoOO->PHP [5]  at Barcamp Bangkok 2GoOO->PHP [5]  at Barcamp Bangkok 2
GoOO->PHP [5] at Barcamp Bangkok 2
Ford AntiTrust
 
MySQL Tuning
MySQL TuningMySQL Tuning
MySQL Tuning
Ford AntiTrust
 
PHP on AJAX
PHP on AJAXPHP on AJAX
PHP on AJAX
Ford AntiTrust
 
PHP Hoffman Framework
PHP Hoffman FrameworkPHP Hoffman Framework
PHP Hoffman Framework
Ford AntiTrust
 
Drupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows AzureDrupal in the Cloud with Windows Azure
Drupal in the Cloud with Windows Azure
Ford AntiTrust
 
Web Design, Running A Website And Hosting
Web Design, Running A Website And HostingWeb Design, Running A Website And Hosting
Web Design, Running A Website And Hosting
Ford AntiTrust
 
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2
PHP Hoffman Framework(HMF) at Barcamp Bangkok 2PHP Hoffman Framework(HMF) at Barcamp Bangkok 2
PHP Hoffman Framework (HMF) at Barcamp Bangkok 2
Ford AntiTrust
 
GoOO->PHP [5] at Barcamp Bangkok 2
GoOO->PHP [5]  at Barcamp Bangkok 2GoOO->PHP [5]  at Barcamp Bangkok 2
GoOO->PHP [5] at Barcamp Bangkok 2
Ford AntiTrust
 
Ad

Recently uploaded (20)

End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath InsightsUiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPathCommunity
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Peter Bittner
 
Fortinet Certified Associate in Cybersecurity
Fortinet Certified Associate in CybersecurityFortinet Certified Associate in Cybersecurity
Fortinet Certified Associate in Cybersecurity
VICTOR MAESTRE RAMIREZ
 
Cybersecurity Fundamentals: Apprentice - Palo Alto Certificate
Cybersecurity Fundamentals: Apprentice - Palo Alto CertificateCybersecurity Fundamentals: Apprentice - Palo Alto Certificate
Cybersecurity Fundamentals: Apprentice - Palo Alto Certificate
VICTOR MAESTRE RAMIREZ
 
AI Trends - Mary Meeker
AI Trends - Mary MeekerAI Trends - Mary Meeker
AI Trends - Mary Meeker
Razin Mustafiz
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
New Ways to Reduce Database Costs with ScyllaDB
New Ways to Reduce Database Costs with ScyllaDBNew Ways to Reduce Database Costs with ScyllaDB
New Ways to Reduce Database Costs with ScyllaDB
ScyllaDB
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
The case for on-premises AI
The case for on-premises AIThe case for on-premises AI
The case for on-premises AI
Principled Technologies
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Lorenzo Miniero
 
Offshore IT Support: Balancing In-House and Offshore Help Desk Technicians
Offshore IT Support: Balancing In-House and Offshore Help Desk TechniciansOffshore IT Support: Balancing In-House and Offshore Help Desk Technicians
Offshore IT Support: Balancing In-House and Offshore Help Desk Technicians
john823664
 
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyesEnd-to-end Assurance for SD-WAN & SASE with ThousandEyes
End-to-end Assurance for SD-WAN & SASE with ThousandEyes
ThousandEyes
 
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath InsightsUiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPath Community Berlin: Studio Tips & Tricks and UiPath Insights
UiPathCommunity
 
Agentic AI - The New Era of Intelligence
Agentic AI - The New Era of IntelligenceAgentic AI - The New Era of Intelligence
Agentic AI - The New Era of Intelligence
Muzammil Shah
 
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Nix(OS) for Python Developers - PyCon 25 (Bologna, Italia)
Peter Bittner
 
Fortinet Certified Associate in Cybersecurity
Fortinet Certified Associate in CybersecurityFortinet Certified Associate in Cybersecurity
Fortinet Certified Associate in Cybersecurity
VICTOR MAESTRE RAMIREZ
 
Cybersecurity Fundamentals: Apprentice - Palo Alto Certificate
Cybersecurity Fundamentals: Apprentice - Palo Alto CertificateCybersecurity Fundamentals: Apprentice - Palo Alto Certificate
Cybersecurity Fundamentals: Apprentice - Palo Alto Certificate
VICTOR MAESTRE RAMIREZ
 
AI Trends - Mary Meeker
AI Trends - Mary MeekerAI Trends - Mary Meeker
AI Trends - Mary Meeker
Razin Mustafiz
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
New Ways to Reduce Database Costs with ScyllaDB
New Ways to Reduce Database Costs with ScyllaDBNew Ways to Reduce Database Costs with ScyllaDB
New Ways to Reduce Database Costs with ScyllaDB
ScyllaDB
 
Grannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI ExperiencesGrannie’s Journey to Using Healthcare AI Experiences
Grannie’s Journey to Using Healthcare AI Experiences
Lauren Parr
 
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
GDG Cloud Southlake #43: Tommy Todd: The Quantum Apocalypse: A Looming Threat...
James Anderson
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Let’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack CommunityLet’s Get Slack Certified! 🚀- Slack Community
Let’s Get Slack Certified! 🚀- Slack Community
SanjeetMishra29
 
Droidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing HealthcareDroidal: AI Agents Revolutionizing Healthcare
Droidal: AI Agents Revolutionizing Healthcare
Droidal LLC
 
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptxECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
ECS25 - The adventures of a Microsoft 365 Platform Owner - Website.pptx
Jasper Oosterveld
 
Supercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMsSupercharge Your AI Development with Local LLMs
Supercharge Your AI Development with Local LLMs
Francesco Corti
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
Lorenzo Miniero
 
Offshore IT Support: Balancing In-House and Offshore Help Desk Technicians
Offshore IT Support: Balancing In-House and Offshore Help Desk TechniciansOffshore IT Support: Balancing In-House and Offshore Help Desk Technicians
Offshore IT Support: Balancing In-House and Offshore Help Desk Technicians
john823664
 

/* pOrt80BKK */ - PHP Day - PHP Performance with APC + Memcached for Windows

  • 1. <?PHP Performance ?> w/APC + Memcached for Windows @FordAntiTrust thaicyberpoint.com thaithinkpad.com thaihi5.com
  • 3. Cache Theory ? Req 1 Check 2 Miss Compute Store 3 Cache 4 Hit Output Miss - [Store] - Hit
  • 4. Type ? Fast Slow http://ralphlosey.files.wordpress.com/2007/06/ram.jpg http://www.pctechguide.com/images/31HardDrive.jpg
  • 6. Opcode Cache and Variables Cache Automatic update w/code changes Code not changes request and Simply Installation
  • 7. Free & Open Source
  • 8. PHP Flow Req • Scanning and Lexing (Plain Text to Tokens) • Parsing • Scanning • Lexing (Tokens to Expressions) • Parsing • Compilation • Compilation (Translated Expressions to Opcode) • Execution Execution (Opcode stacks are processed) Output
  • 10. Normal PHP vs APC Req • Scanning • Lexing • Parsing • Compilation Execution Output
  • 11. Normal PHP vs APC Req APC hook • Scanning • Lexing • Parsing Miss • Compilation APC hook Store Opcode cache Execution Hit Output
  • 12. Why ?
  • 13. Why ? http://ralphschindler.com/
  • 14. Why ? http://ralphschindler.com/
  • 16. Installation • Windows (http://downloads.php.net/pierre/) – extension=php_apc.dll • Basic PECL (http://pecl.php.net) – pecl install apc
  • 17. Installation • Windows (http://downloads.php.net/pierre/) – extension=php_apc.dll Conf • Basic PECL (http://pecl.php.net) – pecl install apc
  • 19. Benchmark PHP Native PHP w/APC Concurrency Level 10 Time taken for tests 60 seconds Complete requests 298 914 Total transferred 643,149 bytes 1,962,675 bytes HTML transferred 516,971 bytes 1,582,035 bytes Requests per second 4.91 [#/sec] (mean) 15.21 [#/sec] (mean) Time per request 2035.405 [ms] (mean) 657.623 [ms] (mean) Time per request 203.541 [ms] 65.762 [ms] (mean, across all concurrent requests) Transfer rate 10.35 [KB/s] received 31.88 [KB/s] received
  • 21. History “Developed by Danga Interactive for LiveJournal.com”
  • 22. Memcached ? • a distributed memory object caching system with hash table
  • 23. Memcached ? • a distributed memory object caching system with hash table
  • 24. Memcached ? • a distributed memory object caching system with hash table • a generic two stage hashing system (clients and servers). Clients are written for specific application languages. Server is written in C
  • 25. Memcached ? • a distributed memory object caching system with hash table • a generic two stage hashing system (clients and servers). Clients are written for specific application languages. Server is written in C
  • 26. Memcached ? • a distributed memory object caching system with hash table • a generic two stage hashing system (clients and servers). Clients are written for specific application languages. Server is written in C • 85% of top 20 sites use memcached; 50%+ of top 5k sites uses Memcached
  • 27. Memcached ? • a distributed memory object caching system with hash table • a generic two stage hashing system (clients and servers). Clients are written for specific application languages. Server is written in C • 85% of top 20 sites use memcached; 50%+ of top 5k sites uses Memcached
  • 28. Limits (c/Hash Table) • Key : max 250 chars. • Values: max 1MB
  • 29. Why Memcached ? • Scale-out – Machine – Process (Use different ports) • Memory faster than Disk • Allows for efficient use of your database • Can utilize existing network – Uses non-blocking network I/O (TCP/IP) • Very flexible • Client libraries in all major languages
  • 31. “We use more than 800 servers supplying over 28 terabytes of memory to our users.” “total throughput achieved is 300,000 UDP req/s” by Paul Saab Saturday, December 13, 2008 at 2:43am • 8-core machines • 20-30% CPU usage. • scale memcached to 8 threads on an 8-core system • moved to UDP for get operations to reduce network traffic http://www.facebook.com/note.php?note_id=39391378919
  • 33. Cache Memcached APC Memcached Instance Reverse Memcached Instance Memcached Instance Proxy Instance I n t e PHP Web App Web Server r n e Session Files t Memcached Memcached Memcached Instance Memcached Instance Master Slave Memcached Instance Memcached Instance Memcached Instance Instance CDN/DFS Instance DB
  • 34. Installation & Used memcached binary packages • http://labs.northscale.com/memcached-packages/ 1. Unzip into a directory of choice 2. Open the shell of your choice (i.e. cmd.exe); cd into the directory 3. Run memcached.exe passing standard arguments. Sample C:memcachedmemcached.exe -m 128 -p 11211 -l 127.0.0.1 -d
  • 35. PHP Session w/Memcached session.save_handler = files session.save_path = “C:/Windows/temp” TO session.save_handler = memcache session.save_path = “tcp://server:port “ OR ini_set('session.save_handler', 'memcache'); ini_set('session.save_path', 'tcp://server:port,tcp://server:port');
  • 36. Coding ? (in PHP) /* OO API */ $memcacheObj = new Memcache; $memcacheObj->connect('memcache_host', 11211); /* set */ $memcacheObj->set('key', 'data', MEMCACHE_COMPRESSED, 50); / * get w/single key */ $var = $memcacheObj->get('key'); / * get w/multiple key */ $var = $memcacheObj->get(array('key1', 'key2')); $memcacheObj->close();
  • 37. CMS ? • Drupal has Memcache API and Integration http://drupal.org/project/memcache • Wordpress has object cache http://mohanjith.net/blog/2008/10/using-memcached-with- wordpress-object-cache.html
  • 38. Tips
  • 39. Two Level Caching with Zend_Cache • Tagging System in Files Cache • Memcached Key used Tagging System
  • 40. Two Level Caching - Workflow Req Compute Files Cache Memcached Output 1. Check 3. Store 2. Miss 4. Hit
  • 42. Used Two Level with Zend_Cache
  • 43. Ref. • Improving PHP Application Performance with APC http://www.slideshare.net/vortexau/improving-php-application- performance-with-apc-presentation • PHP Accelerators : APC vs Zend vs XCache with Zend Framework http://blog.digitalstruct.com/2007/12/23/php-accelerators-apc-vs-zend-vs- xcache-with-zend-framework/ • Scaling with memcached http://www.slideshare.net/acme/scaling-with-memcached • Gear6 and Scaling Website Performance: Caching Session and Profile Data with Memcached http://www.slideshare.net/gear6memcached/gear6-and-scaling-website- performance-caching-session-and-profile-data-with-memcached
  • 44. Ref. (2) • PHP: Memcache - Manual http://th.php.net/manual/en/book.memcache.php • http://danga.com/memcached/ • http://pecl.php.net/package/memcache • http://www.socialtext.net/memcached/
  • 45. Discussion Q&A
  • 46. Thank you @FordAntiTrust http://www.slideshare.net/FordAntiTrust