SlideShare a Scribd company logo
Turbocharging PHP
Applications With Zend
Server… The Tutorial
Eric Ritchie (eric@zend.com)
Jan Burkl (jan@zend.com)
Slavey Karadzhov (slavey@zend.com)




                                     © All rights reserved. Zend Technologies, Inc.
Eric Ritchie bids you welcome!
• Senior Technical Consultant and Trainer
  at Zend Technologies

• Zend Framework and PHP 5.3 ZCE

• Eighteen years of system administration experience

• Twelve years of PHP (3,4 & 5) and five years Zend
  Framework development experience

• Hobbies: Sampling good wines/whiskies
 (gifts welcome)




                     © All rights reserved. Zend Technologies, Inc.
Slavey Karadzhov welcomes you!
• Senior Technical Consultant and Trainer
  at Zend Technologies


• Zend Framework and PHP 5.3 ZCE


• Many years of PHP (3,4 & 5), ZF 1 and galaxy of
  programming languages.


• Hobbies: Travelling, sampling exotic dishes, outdoor
  sports, hype technologies.
  (in no particular order)




                             © All rights reserved. Zend Technologies, Inc.
Jan Burkl
            • Senior Solution Consultant at Zend
              Technologies

            • Working with the dark side of the
              company


            • Zend Framework and PHP 5.3 ZCE


            • Moved 10 years ago from Java to PHP.


            • Hobbies: Soccer, Automation of Life.



                © All rights reserved. Zend Technologies, Inc.
Agenda

• Defining the problem
• The sharpest tool in the shed… Code Tracing
• Laziness is good (at least for web servers):
  Using caching to avoid work
• If we must work, then procrastinate: Use the Job Queue
• Taking the heat off the disk: Ways to reduce disk I/O
• The ghost in the machine:
  Don‘t forget about network performance
• Don‘t talk too much: Less is more when sending data


                       © All rights reserved. Zend Technologies, Inc.
What we will not cover (probably)

• Database optimisation > caching
• Webservice optimisation
• Varnish and reverse proxying in general
• CDNs (Content Delivery Networks)
• Caching technology comparisons
• Operating system level optimisations
• Javascript performance in general (well, maybe…)
• Network Traffic Analysis



                      © All rights reserved. Zend Technologies, Inc.
Defining the problem
Why is it that we always discover that we have performance
problems AFTER we go live?




                      © All rights reserved. Zend Technologies, Inc.
The evolution of an organic website
• A new website is born...




                                  Internet



LAMP Server




                      © All rights reserved. Zend Technologies, Inc.
...too much of a good thing?
• the smoke begins...




                                    Internet



LAMP Server




                        © All rights reserved. Zend Technologies, Inc.
First job: Bottleneck identification

• Many possible tools:
   Zend Server Event Monitoring

   Profiling

   microtime()

   Slow query logs

• One Swiss army knife:
   Zend Server Code Tracing




                         © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing
A black box for your PHP code




                      © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing: Main view




               © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing: Statistics view




                © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing: How to store a trace?

• Best way (in most cases)
  … Use a web browser




  Very quick and easy, but obviously not so good for POST requests

  Also, we may not be allowed!




                         © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing: How to store a trace?
• The official way
   … Use event monitoring




   Works for all requests where an event is generated
   Great for catching random problems
   Custom events allow for „programmatic“ generation of traces


                          © All rights reserved. Zend Technologies, Inc.
Zend Code Tracing: What can go wrong.

• Sometimes you fail to store a code trace, because:
  The module is disabled

  Code tracing is running in standby mode

  Lack of permission when using „dump_data“

  The triggered event was aggregated

  The code trace was never collected




                       © All rights reserved. Zend Technologies, Inc.
Caching
Reducing the work load of our application architecture




                       © All rights reserved. Zend Technologies, Inc.
Zend Page Cache

• Dynamic content is expensive, so don’t regenerate
  Low impact, since no code changes may be required

  Complete request cached, so a hit is like a static request

  Multiple copies of pages can be maintained

  Controlled by flexable and comprehensive rules

• Sadly, nothing comes for free
  Page design can render page caching useless

  Highly dynamic content cannot be reasonably cached

  Problems with stale content



                        © All rights reserved. Zend Technologies, Inc.
Zend Page Caching: Custom content




               © All rights reserved. Zend Technologies, Inc.
Zend Page Cache: Configuration




               © All rights reserved. Zend Technologies, Inc.
Excursion




            © All rights reserved. Zend Technologies, Inc.
Javascript - AJAX

• Reload stuff on demand
   User name, shopping cart, navigation...

• It‘s not that hard
   If the application is structured well...




                          © All rights reserved. Zend Technologies, Inc.
© All rights reserved. Zend Technologies, Inc.
Full Blown

• Don‘t ajaxify everything!
   Ever profiled 15 MVC runs in 1 request?

• MVC really needed for displaying User Name?
   Be pragmatic

   Lightweight gateway

   Reduce Bootstrapping time
     • Load ressources which are really needed
     $application->bootstrap(array('session'))
                 ->run();

   Remember that you‘re using PHP!


                          © All rights reserved. Zend Technologies, Inc.
JS Architecture

• Dojo, ExtJS, jQuery, ...
   Is a library enough?

• Javascript MVC, Angular.js, EmberJS, ...
   TodoMVC: http://addyosmani.github.com/todomvc/

   Comparison of JS-Framework

• File loading strategy
   Reduce amount of requests – CDN?

   RequireJS

   YUI compress

   Rhino

                           © All rights reserved. Zend Technologies, Inc.
Example – Dojo - build.js

    ./dojo-1.7.3/util/buildscripts/build.sh 
    profile=./profiles/wikizf.profile.js 
    action=release 
    releaseDir=/var/www/wiki-zf-good.session.dev/public 
    cssOptimize=comments 
    layerOptimize=closure 
    mini=true 
    optimize=closure 
    stripConsole=all 
    selectorEngine=acme




                     © All rights reserved. Zend Technologies, Inc.
Example – Dojo - xyz.profile.js
        dependencies = {
        layers:
        [{
        name: "dojo.js",
        dependencies: [
            "dojox.data.QueryReadStore",
            "dijit.form.ComboBox",
            "dijit.form.Form",
            "dojo.parser",
        ]
        }],
        prefixes: [
                ["dojox", "../dojox" ],
                ["dijit", "../dijit"]
        ]
        };


                  © All rights reserved. Zend Technologies, Inc.
Automation

• Integration
• Build process
• Continuous Integration
   Jenkins




                     © All rights reserved. Zend Technologies, Inc.
© All rights reserved. Zend Technologies, Inc.
© All rights reserved. Zend Technologies, Inc.
© All rights reserved. Zend Technologies, Inc.
Data caching

• Protects the data layer:
   Helps prevent repetitive DB/web service calls

   Far easier than scaling the database

• But...
   Requires code changes

   Custom data is also problematic

   Risk of delivering stale content

   De-caching can bring down the data source




                         © All rights reserved. Zend Technologies, Inc.
One common architecture
• Network data cache
  e.g. Memcache



 Internet                                                               DB Server(s)


                LB


                                                                         Cache
                                                                         Server
                                                    Web Farm


                       © All rights reserved. Zend Technologies, Inc.
Network data cache

• Some advantages
  Only one cache to update/invalidate

  Most effective way of protecting the data source

• Many disadvantages...
  Single point of failure (or uncertainty when in distributed mode)

  Limits scalability

  Performance bottleneck

  Slower




                        © All rights reserved. Zend Technologies, Inc.
A different approach
• Shared memory cache                                    Cache
  e.g. Zend Data Cache


                                                       Cache

 Internet                                                             DB Server(s)




                                                                      X
                LB                                     Cache



                                                                       Cache
                                                                       Server
                                                    Web Farm



                     © All rights reserved. Zend Technologies, Inc.
Zend Data Cache: A shared memory cache

• Many advantages
  Completely scalable (copy/paste architecture)

  No single point of failure

  Does not require TCP/IP

  Very fast

• Some disadvantages...
  Not the path of least resistance

  More work for the data source or the developer

  Your colleagues may laugh at you (but they would be wrong)



                         © All rights reserved. Zend Technologies, Inc.
Zend Data Cache: Usage

• Inserting into the cache
   $res = zend_shm_cache_store($key, $value, $ttl)

   $res = zend_disk_cache_store($key, $value, $ttl)

• Reading from the cache
   $value = zend_shm_cache_fetch($key)

   $value = zend_disk_cache_fetch($key)

• In all cases the key can contain a namespace to allow
  grouping of data, e.g. namespace::key




                        © All rights reserved. Zend Technologies, Inc.
Zend Data Cache: Usage

• Deleteing from the cache
  $res = zend_shm_cache_delete($key)

  $res = zend_disk_cache_delete($key)

• Wiping the cache
  $res = zend_shm_cache_clear($namespace)

  $res = zend_disk_cache_clear($namespace)




                       © All rights reserved. Zend Technologies, Inc.
Shared memory caching

• Taming the disadvantages
  True, we need to work a little, but...
    • We can use Zend Server‘s Job Queue to perform remote
      cache maintenance
    • We can get a list of active servers from the Web API
      provided by Zend Server
    • Really, we don‘t have to code much ourselves




                          © All rights reserved. Zend Technologies, Inc.
Remote de-caching
• With Zend Server‘s Job Queue




• ...and the job itself




                          © All rights reserved. Zend Technologies, Inc.
Shared memory cache on steroids

• Don‘t decache, update
  Regenerate the data and insert into the cache

  At a minimum do this for all components of the index page

  Reduces data source load




                       © All rights reserved. Zend Technologies, Inc.
Zend Job Queue
Why do now what you can do a little later?
Or, genius is being calm on the surface while being calculating in
the background. Your application should do just that.
Or, your server‘s marketing department.




                       © All rights reserved. Zend Technologies, Inc.
Zend Job Queue

• Doesn’t make PHP faster, but makes it look that way
  Break slow tasks out of the user workflow

  Offload the heavy lifting to a background server.

  Delay expensive tasks to off peak hours

  Helps to prevent repetitve work reducing overall load

• Possible to create jobs which depend on other jobs, run
  regularly and have set priorites
• Hooks into Zend Server‘s Event Monitoring component
  Jobs can feedback status information

  Problems appear in the central Zend Server event list


                        © All rights reserved. Zend Technologies, Inc.
Zend Job Queue: Typical example




               © All rights reserved. Zend Technologies, Inc.
Zend Job Queue: Basic use

• Would be hard to make it easier…




• We can also pass information to our job...




                      © All rights reserved. Zend Technologies, Inc.
Zend Job Queue: Basic use

• Possible to name our jobs and set an earliest start time…




• Once sheduled, it is possible to check up on jobs



                      © All rights reserved. Zend Technologies, Inc.
Zend Job Queue: Querying jobs

• Finding out the status of our job using the job id




   Find out if the job is still queued, running, completed or failed

   When finished we get a copy of the script‘s output




                          © All rights reserved. Zend Technologies, Inc.
Zend Job Queue: Querying jobs

• Searching for jobs




   Search for an existing queued job of the same type

   Useful for avoiding repetitive work

   Returns the number of matching jobs along with job details




                         © All rights reserved. Zend Technologies, Inc.
Optimization vs. Complexity




           © All rights reserved. Zend Technologies, Inc.
Optimization vs. Complexity

• With every optimization level complexity gets higher
   Who else drapped into the Caching pitfall?

• First: implement functionality
• System performing?
• If not, check why
• Get rid of bottlenecks




                         © All rights reserved. Zend Technologies, Inc.
Reducing Disk I/O
The only component of a web server slower than the disk
subsystem is the guy you ask to set it up.




                      © All rights reserved. Zend Technologies, Inc.
Reducing disk I/O

• Use an opcode cache e.g. Zend Optimizer+
  Avoids the need to open PHP files and compile the contents for
   every request.
  Compiled „opcodes“ are instead held in shared memory for later
   reuse.
  Particularly important for framework based projects where tens
   of files may be needed to answer one request.
  Also saves some compiler time, but disk I/O savings are usually far
   more significant.
  Most obvious benefit for scripts with short run times or running on
   loaded servers.


                        © All rights reserved. Zend Technologies, Inc.
Reducing disk I/O: Zend Optimizer+

• Performs opcode caching
• Also adds multiple optimisation passes
• Allows for the blacklisting of files/directories
• Simple configuration:




                        © All rights reserved. Zend Technologies, Inc.
Check what‘s cached

• Zend Server‘s API
  accelerator_get_status()

  accelerator_get_configuration()

  accelerator_reset()




                         © All rights reserved. Zend Technologies, Inc.
Reducing disk I/O

• Store static files elsewhere
• Do not cache to the file system
• Must have local storage? ...Use a ramdisk
• Reduce PHP/Apache logging to minimal levels
   E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

• Don‘t forget the Zend Server logs!
   Search for log_verbosity_level in the configuration




                         © All rights reserved. Zend Technologies, Inc.
File system concerns

• EXT3 – The default problem
   For a web server ReiserFS can be 20x (or more) faster, really!

   Even XFS is 2.5x faster

   If you must use EXT3/4 then throw memory at the server

• My NFS/Samba server is fast... Honest!
   Even „fast“ NFS servers have terrible performance under load

   Older implementations cannot use buffer cache

   Poor scalability

• Distributed file systems
   Extremely poor scalability

                         © All rights reserved. Zend Technologies, Inc.
PHP uses your network

• PHP communicates with network services like
   Databases (ex: MySQL, Oracle)

   Caching systems (ex: Memcache, Redis ..)

   Job Queue Systems (ex: Zend Job Queue, RabbitMQ )

   Session Clustering Daemon (ex: Zend Session Clustering)

• If one of these services overloads the network then all
  other suffer from slowdown
   Network congestion

   Insufficient bandwidth

   High latency


                         © All rights reserved. Zend Technologies, Inc.
Overloaded network, slow application

• The caching systems have to be very fast
   If they are slow then the complete application can be slow

• The session clustering has to be fast
   Lots of PHP requests wait to get a read/write lock -> the
    application looks slow




                         © All rights reserved. Zend Technologies, Inc.
Know your traffic

• A bit of Linux/Unix networking knowledge is required
• Count the incoming and outgoing traffic
  iptables

• Inspect the network streams
  Tcpdump

  Wireshark




                      © All rights reserved. Zend Technologies, Inc.
Traffic counters

• Network traffic can be
  On different interfaces:
    • eth0, lo
  Incoming/Outgoing

  On different ports

  Uses different transport protocols




                        © All rights reserved. Zend Technologies, Inc.
Traffic counters (2)

• Iptables can help you
   Zeroing the counters
    • iptables -t mangle -L -Z INPUT -v -n
    • iptables -t mangle -L -Z OUTPUT -v -n
   Start measuring
    • Ex: Memcache outgoing
          – iptables -t mangle -I OUTPUT -p tcp --dport 11211
    • Ex: Memcache incoming via udp
          – iptables -t mangle -I INPUT -p udp --sport 11211




                            © All rights reserved. Zend Technologies, Inc.
Network stream inspectors

• Tcpdump
  Helps you to record the traffic based on some rules
    • tcpdump -vv -x -X -s 1500 -i eth0 'port 11211‘




                          © All rights reserved. Zend Technologies, Inc.
Network stream inspectors (2)

• Wireshark
  Helps you understand better the data




                       © All rights reserved. Zend Technologies, Inc.
Hands on session...


   Over to you ;)




                    © All rights reserved. Zend Technologies, Inc.
So long...

• …and thanks for all the fish.




                       © All rights reserved. Zend Technologies, Inc.
Turbocharging PHP
Applications With Zend
Server… The Tutorial
Eric Ritchie (eric@zend.com)
Jan Burkl (jan@zend.com)
Slavey Karadzhov (slavey@zend.com)




                                     © All rights reserved. Zend Technologies, Inc.

More Related Content

What's hot

Expanding dr with_zfssa_110810
Expanding dr with_zfssa_110810Expanding dr with_zfssa_110810
Expanding dr with_zfssa_110810rjmurphyslideshare
 
Using multi tiered storage systems for storing both structured & unstructured...
Using multi tiered storage systems for storing both structured & unstructured...Using multi tiered storage systems for storing both structured & unstructured...
Using multi tiered storage systems for storing both structured & unstructured...
ORACLE USER GROUP ESTONIA
 
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
Verbella CMG
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/O
George Cao
 
Hadoop Operations at LinkedIn
Hadoop Operations at LinkedInHadoop Operations at LinkedIn
Hadoop Operations at LinkedIn
DataWorks Summit
 
Sql Server 2012 HA and DR -- SQL Saturday Richmond
Sql Server 2012 HA and DR -- SQL Saturday RichmondSql Server 2012 HA and DR -- SQL Saturday Richmond
Sql Server 2012 HA and DR -- SQL Saturday Richmond
Joseph D'Antoni
 
Adversity: Good for software
Adversity: Good for softwareAdversity: Good for software
Adversity: Good for software
James Wickett
 
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
Acquia
 
Sql server 2012 ha and dr sql saturday dc
Sql server 2012 ha and dr sql saturday dcSql server 2012 ha and dr sql saturday dc
Sql server 2012 ha and dr sql saturday dc
Joseph D'Antoni
 
Hadoop Operations for Production Systems (Strata NYC)
Hadoop Operations for Production Systems (Strata NYC)Hadoop Operations for Production Systems (Strata NYC)
Hadoop Operations for Production Systems (Strata NYC)
Kathleen Ting
 
The Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
The Perils and Triumphs of using Cassandra at a .NET/Microsoft ShopThe Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
The Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
Jeff Smoley
 
Sql server 2012 ha and dr sql saturday boston
Sql server 2012 ha and dr sql saturday bostonSql server 2012 ha and dr sql saturday boston
Sql server 2012 ha and dr sql saturday boston
Joseph D'Antoni
 
Sql server 2012 ha and dr sql saturday tampa
Sql server 2012 ha and dr sql saturday tampaSql server 2012 ha and dr sql saturday tampa
Sql server 2012 ha and dr sql saturday tampa
Joseph D'Antoni
 
Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014
EDB
 
Apache hbase for the enterprise (Strata+Hadoop World 2012)
Apache hbase for the enterprise (Strata+Hadoop World 2012)Apache hbase for the enterprise (Strata+Hadoop World 2012)
Apache hbase for the enterprise (Strata+Hadoop World 2012)
jmhsieh
 
Securing Your Endpoints Using Novell ZENworks Endpoint Security Management
Securing Your Endpoints Using Novell ZENworks Endpoint Security ManagementSecuring Your Endpoints Using Novell ZENworks Endpoint Security Management
Securing Your Endpoints Using Novell ZENworks Endpoint Security Management
Novell
 
Hana Memory Scale out using the hecatonchire Project
Hana Memory Scale out using the hecatonchire ProjectHana Memory Scale out using the hecatonchire Project
Hana Memory Scale out using the hecatonchire Project
Benoit Hudzia
 
Strata + Hadoop World 2012: Apache HBase Features for the Enterprise
Strata + Hadoop World 2012: Apache HBase Features for the EnterpriseStrata + Hadoop World 2012: Apache HBase Features for the Enterprise
Strata + Hadoop World 2012: Apache HBase Features for the Enterprise
Cloudera, Inc.
 
Big Data in Memory - SpringOne 2014
Big Data in Memory - SpringOne 2014Big Data in Memory - SpringOne 2014
Big Data in Memory - SpringOne 2014
John Davies
 
What's New and Upcoming in HDFS - the Hadoop Distributed File System
What's New and Upcoming in HDFS - the Hadoop Distributed File SystemWhat's New and Upcoming in HDFS - the Hadoop Distributed File System
What's New and Upcoming in HDFS - the Hadoop Distributed File System
Cloudera, Inc.
 

What's hot (20)

Expanding dr with_zfssa_110810
Expanding dr with_zfssa_110810Expanding dr with_zfssa_110810
Expanding dr with_zfssa_110810
 
Using multi tiered storage systems for storing both structured & unstructured...
Using multi tiered storage systems for storing both structured & unstructured...Using multi tiered storage systems for storing both structured & unstructured...
Using multi tiered storage systems for storing both structured & unstructured...
 
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
Streamline Collections by Using Document Imaging Scenarios for Accounts Recei...
 
Thousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/OThousands of Threads and Blocking I/O
Thousands of Threads and Blocking I/O
 
Hadoop Operations at LinkedIn
Hadoop Operations at LinkedInHadoop Operations at LinkedIn
Hadoop Operations at LinkedIn
 
Sql Server 2012 HA and DR -- SQL Saturday Richmond
Sql Server 2012 HA and DR -- SQL Saturday RichmondSql Server 2012 HA and DR -- SQL Saturday Richmond
Sql Server 2012 HA and DR -- SQL Saturday Richmond
 
Adversity: Good for software
Adversity: Good for softwareAdversity: Good for software
Adversity: Good for software
 
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
Acquia Managed Cloud: Highly Available Architecture for Highly Unpredictable ...
 
Sql server 2012 ha and dr sql saturday dc
Sql server 2012 ha and dr sql saturday dcSql server 2012 ha and dr sql saturday dc
Sql server 2012 ha and dr sql saturday dc
 
Hadoop Operations for Production Systems (Strata NYC)
Hadoop Operations for Production Systems (Strata NYC)Hadoop Operations for Production Systems (Strata NYC)
Hadoop Operations for Production Systems (Strata NYC)
 
The Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
The Perils and Triumphs of using Cassandra at a .NET/Microsoft ShopThe Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
The Perils and Triumphs of using Cassandra at a .NET/Microsoft Shop
 
Sql server 2012 ha and dr sql saturday boston
Sql server 2012 ha and dr sql saturday bostonSql server 2012 ha and dr sql saturday boston
Sql server 2012 ha and dr sql saturday boston
 
Sql server 2012 ha and dr sql saturday tampa
Sql server 2012 ha and dr sql saturday tampaSql server 2012 ha and dr sql saturday tampa
Sql server 2012 ha and dr sql saturday tampa
 
Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014Implementing Parallelism in PostgreSQL - PGCon 2014
Implementing Parallelism in PostgreSQL - PGCon 2014
 
Apache hbase for the enterprise (Strata+Hadoop World 2012)
Apache hbase for the enterprise (Strata+Hadoop World 2012)Apache hbase for the enterprise (Strata+Hadoop World 2012)
Apache hbase for the enterprise (Strata+Hadoop World 2012)
 
Securing Your Endpoints Using Novell ZENworks Endpoint Security Management
Securing Your Endpoints Using Novell ZENworks Endpoint Security ManagementSecuring Your Endpoints Using Novell ZENworks Endpoint Security Management
Securing Your Endpoints Using Novell ZENworks Endpoint Security Management
 
Hana Memory Scale out using the hecatonchire Project
Hana Memory Scale out using the hecatonchire ProjectHana Memory Scale out using the hecatonchire Project
Hana Memory Scale out using the hecatonchire Project
 
Strata + Hadoop World 2012: Apache HBase Features for the Enterprise
Strata + Hadoop World 2012: Apache HBase Features for the EnterpriseStrata + Hadoop World 2012: Apache HBase Features for the Enterprise
Strata + Hadoop World 2012: Apache HBase Features for the Enterprise
 
Big Data in Memory - SpringOne 2014
Big Data in Memory - SpringOne 2014Big Data in Memory - SpringOne 2014
Big Data in Memory - SpringOne 2014
 
What's New and Upcoming in HDFS - the Hadoop Distributed File System
What's New and Upcoming in HDFS - the Hadoop Distributed File SystemWhat's New and Upcoming in HDFS - the Hadoop Distributed File System
What's New and Upcoming in HDFS - the Hadoop Distributed File System
 

Similar to Turbocharging php applications with zend server (workshop)

High performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructureHigh performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructure
mkherlakian
 
PHP Apps on the Move - Migrating from In-House to Cloud
PHP Apps on the Move - Migrating from In-House to Cloud  PHP Apps on the Move - Migrating from In-House to Cloud
PHP Apps on the Move - Migrating from In-House to Cloud
RightScale
 
Performance tuning PHP on IBMi
Performance tuning PHP on IBMiPerformance tuning PHP on IBMi
Performance tuning PHP on IBMi
Zend by Rogue Wave Software
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
 
Scalable High-Availability Session Storage with ZSCM
Scalable High-Availability Session Storage with ZSCMScalable High-Availability Session Storage with ZSCM
Scalable High-Availability Session Storage with ZSCM
Zend by Rogue Wave Software
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
Enrico Zimuel
 
What's new with Zend server
What's new with Zend serverWhat's new with Zend server
What's new with Zend server
COMMON Europe
 
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Amazon Web Services
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi
Shlomo Vanunu
 
Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)
Andrejs Prokopjevs
 
Application Deployment on IBM i
Application Deployment on IBM iApplication Deployment on IBM i
Application Deployment on IBM i
Zend by Rogue Wave Software
 
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
Derek Ashmore
 
Standard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerStandard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend Server
Zend by Rogue Wave Software
 
Zend In The Cloud
Zend In The CloudZend In The Cloud
Zend In The Cloud
phptechtalk
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecturedrewz lin
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01jgregory1234
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构yiditushe
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
mysqlops
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
Jurriaan Persyn
 

Similar to Turbocharging php applications with zend server (workshop) (20)

High performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructureHigh performance PHP: Scaling and getting the most out of your infrastructure
High performance PHP: Scaling and getting the most out of your infrastructure
 
PHP Apps on the Move - Migrating from In-House to Cloud
PHP Apps on the Move - Migrating from In-House to Cloud  PHP Apps on the Move - Migrating from In-House to Cloud
PHP Apps on the Move - Migrating from In-House to Cloud
 
Performance tuning PHP on IBMi
Performance tuning PHP on IBMiPerformance tuning PHP on IBMi
Performance tuning PHP on IBMi
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
 
Scalable High-Availability Session Storage with ZSCM
Scalable High-Availability Session Storage with ZSCMScalable High-Availability Session Storage with ZSCM
Scalable High-Availability Session Storage with ZSCM
 
How to scale PHP applications
How to scale PHP applicationsHow to scale PHP applications
How to scale PHP applications
 
What's new with Zend server
What's new with Zend serverWhat's new with Zend server
What's new with Zend server
 
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
Accelerating Application Performance with Amazon ElastiCache (DAT207) | AWS r...
 
Zend Products and PHP for IBMi
Zend Products and PHP for IBMi  Zend Products and PHP for IBMi
Zend Products and PHP for IBMi
 
Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)Running Oracle EBS in the cloud (DOAG TECH17 edition)
Running Oracle EBS in the cloud (DOAG TECH17 edition)
 
Application Deployment on IBM i
Application Deployment on IBM iApplication Deployment on IBM i
Application Deployment on IBM i
 
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
AWS Lambda: Best Practices and Common Mistakes - Chicago Cloud Conference 2020
 
Standard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend ServerStandard CMS on standard PHP Stack - Drupal and Zend Server
Standard CMS on standard PHP Stack - Drupal and Zend Server
 
20120306 dublin js
20120306 dublin js20120306 dublin js
20120306 dublin js
 
Zend In The Cloud
Zend In The CloudZend In The Cloud
Zend In The Cloud
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01Qcon 090408233824-phpapp01
Qcon 090408233824-phpapp01
 
Facebook的架构
Facebook的架构Facebook的架构
Facebook的架构
 
Facebook architecture
Facebook architectureFacebook architecture
Facebook architecture
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

Turbocharging php applications with zend server (workshop)

  • 1. Turbocharging PHP Applications With Zend Server… The Tutorial Eric Ritchie (eric@zend.com) Jan Burkl (jan@zend.com) Slavey Karadzhov (slavey@zend.com) © All rights reserved. Zend Technologies, Inc.
  • 2. Eric Ritchie bids you welcome! • Senior Technical Consultant and Trainer at Zend Technologies • Zend Framework and PHP 5.3 ZCE • Eighteen years of system administration experience • Twelve years of PHP (3,4 & 5) and five years Zend Framework development experience • Hobbies: Sampling good wines/whiskies (gifts welcome) © All rights reserved. Zend Technologies, Inc.
  • 3. Slavey Karadzhov welcomes you! • Senior Technical Consultant and Trainer at Zend Technologies • Zend Framework and PHP 5.3 ZCE • Many years of PHP (3,4 & 5), ZF 1 and galaxy of programming languages. • Hobbies: Travelling, sampling exotic dishes, outdoor sports, hype technologies. (in no particular order) © All rights reserved. Zend Technologies, Inc.
  • 4. Jan Burkl • Senior Solution Consultant at Zend Technologies • Working with the dark side of the company • Zend Framework and PHP 5.3 ZCE • Moved 10 years ago from Java to PHP. • Hobbies: Soccer, Automation of Life. © All rights reserved. Zend Technologies, Inc.
  • 5. Agenda • Defining the problem • The sharpest tool in the shed… Code Tracing • Laziness is good (at least for web servers): Using caching to avoid work • If we must work, then procrastinate: Use the Job Queue • Taking the heat off the disk: Ways to reduce disk I/O • The ghost in the machine: Don‘t forget about network performance • Don‘t talk too much: Less is more when sending data © All rights reserved. Zend Technologies, Inc.
  • 6. What we will not cover (probably) • Database optimisation > caching • Webservice optimisation • Varnish and reverse proxying in general • CDNs (Content Delivery Networks) • Caching technology comparisons • Operating system level optimisations • Javascript performance in general (well, maybe…) • Network Traffic Analysis © All rights reserved. Zend Technologies, Inc.
  • 7. Defining the problem Why is it that we always discover that we have performance problems AFTER we go live? © All rights reserved. Zend Technologies, Inc.
  • 8. The evolution of an organic website • A new website is born... Internet LAMP Server © All rights reserved. Zend Technologies, Inc.
  • 9. ...too much of a good thing? • the smoke begins... Internet LAMP Server © All rights reserved. Zend Technologies, Inc.
  • 10. First job: Bottleneck identification • Many possible tools:  Zend Server Event Monitoring  Profiling  microtime()  Slow query logs • One Swiss army knife:  Zend Server Code Tracing © All rights reserved. Zend Technologies, Inc.
  • 11. Zend Code Tracing A black box for your PHP code © All rights reserved. Zend Technologies, Inc.
  • 12. Zend Code Tracing: Main view © All rights reserved. Zend Technologies, Inc.
  • 13. Zend Code Tracing: Statistics view © All rights reserved. Zend Technologies, Inc.
  • 14. Zend Code Tracing: How to store a trace? • Best way (in most cases)  … Use a web browser  Very quick and easy, but obviously not so good for POST requests  Also, we may not be allowed! © All rights reserved. Zend Technologies, Inc.
  • 15. Zend Code Tracing: How to store a trace? • The official way  … Use event monitoring  Works for all requests where an event is generated  Great for catching random problems  Custom events allow for „programmatic“ generation of traces © All rights reserved. Zend Technologies, Inc.
  • 16. Zend Code Tracing: What can go wrong. • Sometimes you fail to store a code trace, because:  The module is disabled  Code tracing is running in standby mode  Lack of permission when using „dump_data“  The triggered event was aggregated  The code trace was never collected © All rights reserved. Zend Technologies, Inc.
  • 17. Caching Reducing the work load of our application architecture © All rights reserved. Zend Technologies, Inc.
  • 18. Zend Page Cache • Dynamic content is expensive, so don’t regenerate  Low impact, since no code changes may be required  Complete request cached, so a hit is like a static request  Multiple copies of pages can be maintained  Controlled by flexable and comprehensive rules • Sadly, nothing comes for free  Page design can render page caching useless  Highly dynamic content cannot be reasonably cached  Problems with stale content © All rights reserved. Zend Technologies, Inc.
  • 19. Zend Page Caching: Custom content © All rights reserved. Zend Technologies, Inc.
  • 20. Zend Page Cache: Configuration © All rights reserved. Zend Technologies, Inc.
  • 21. Excursion © All rights reserved. Zend Technologies, Inc.
  • 22. Javascript - AJAX • Reload stuff on demand  User name, shopping cart, navigation... • It‘s not that hard  If the application is structured well... © All rights reserved. Zend Technologies, Inc.
  • 23. © All rights reserved. Zend Technologies, Inc.
  • 24. Full Blown • Don‘t ajaxify everything!  Ever profiled 15 MVC runs in 1 request? • MVC really needed for displaying User Name?  Be pragmatic  Lightweight gateway  Reduce Bootstrapping time • Load ressources which are really needed $application->bootstrap(array('session')) ->run();  Remember that you‘re using PHP! © All rights reserved. Zend Technologies, Inc.
  • 25. JS Architecture • Dojo, ExtJS, jQuery, ...  Is a library enough? • Javascript MVC, Angular.js, EmberJS, ...  TodoMVC: http://addyosmani.github.com/todomvc/  Comparison of JS-Framework • File loading strategy  Reduce amount of requests – CDN?  RequireJS  YUI compress  Rhino © All rights reserved. Zend Technologies, Inc.
  • 26. Example – Dojo - build.js ./dojo-1.7.3/util/buildscripts/build.sh profile=./profiles/wikizf.profile.js action=release releaseDir=/var/www/wiki-zf-good.session.dev/public cssOptimize=comments layerOptimize=closure mini=true optimize=closure stripConsole=all selectorEngine=acme © All rights reserved. Zend Technologies, Inc.
  • 27. Example – Dojo - xyz.profile.js dependencies = { layers: [{ name: "dojo.js", dependencies: [ "dojox.data.QueryReadStore", "dijit.form.ComboBox", "dijit.form.Form", "dojo.parser", ] }], prefixes: [ ["dojox", "../dojox" ], ["dijit", "../dijit"] ] }; © All rights reserved. Zend Technologies, Inc.
  • 28. Automation • Integration • Build process • Continuous Integration  Jenkins © All rights reserved. Zend Technologies, Inc.
  • 29. © All rights reserved. Zend Technologies, Inc.
  • 30. © All rights reserved. Zend Technologies, Inc.
  • 31. © All rights reserved. Zend Technologies, Inc.
  • 32. Data caching • Protects the data layer:  Helps prevent repetitive DB/web service calls  Far easier than scaling the database • But...  Requires code changes  Custom data is also problematic  Risk of delivering stale content  De-caching can bring down the data source © All rights reserved. Zend Technologies, Inc.
  • 33. One common architecture • Network data cache e.g. Memcache Internet DB Server(s) LB Cache Server Web Farm © All rights reserved. Zend Technologies, Inc.
  • 34. Network data cache • Some advantages  Only one cache to update/invalidate  Most effective way of protecting the data source • Many disadvantages...  Single point of failure (or uncertainty when in distributed mode)  Limits scalability  Performance bottleneck  Slower © All rights reserved. Zend Technologies, Inc.
  • 35. A different approach • Shared memory cache Cache e.g. Zend Data Cache Cache Internet DB Server(s) X LB Cache Cache Server Web Farm © All rights reserved. Zend Technologies, Inc.
  • 36. Zend Data Cache: A shared memory cache • Many advantages  Completely scalable (copy/paste architecture)  No single point of failure  Does not require TCP/IP  Very fast • Some disadvantages...  Not the path of least resistance  More work for the data source or the developer  Your colleagues may laugh at you (but they would be wrong) © All rights reserved. Zend Technologies, Inc.
  • 37. Zend Data Cache: Usage • Inserting into the cache  $res = zend_shm_cache_store($key, $value, $ttl)  $res = zend_disk_cache_store($key, $value, $ttl) • Reading from the cache  $value = zend_shm_cache_fetch($key)  $value = zend_disk_cache_fetch($key) • In all cases the key can contain a namespace to allow grouping of data, e.g. namespace::key © All rights reserved. Zend Technologies, Inc.
  • 38. Zend Data Cache: Usage • Deleteing from the cache  $res = zend_shm_cache_delete($key)  $res = zend_disk_cache_delete($key) • Wiping the cache  $res = zend_shm_cache_clear($namespace)  $res = zend_disk_cache_clear($namespace) © All rights reserved. Zend Technologies, Inc.
  • 39. Shared memory caching • Taming the disadvantages  True, we need to work a little, but... • We can use Zend Server‘s Job Queue to perform remote cache maintenance • We can get a list of active servers from the Web API provided by Zend Server • Really, we don‘t have to code much ourselves © All rights reserved. Zend Technologies, Inc.
  • 40. Remote de-caching • With Zend Server‘s Job Queue • ...and the job itself © All rights reserved. Zend Technologies, Inc.
  • 41. Shared memory cache on steroids • Don‘t decache, update  Regenerate the data and insert into the cache  At a minimum do this for all components of the index page  Reduces data source load © All rights reserved. Zend Technologies, Inc.
  • 42. Zend Job Queue Why do now what you can do a little later? Or, genius is being calm on the surface while being calculating in the background. Your application should do just that. Or, your server‘s marketing department. © All rights reserved. Zend Technologies, Inc.
  • 43. Zend Job Queue • Doesn’t make PHP faster, but makes it look that way  Break slow tasks out of the user workflow  Offload the heavy lifting to a background server.  Delay expensive tasks to off peak hours  Helps to prevent repetitve work reducing overall load • Possible to create jobs which depend on other jobs, run regularly and have set priorites • Hooks into Zend Server‘s Event Monitoring component  Jobs can feedback status information  Problems appear in the central Zend Server event list © All rights reserved. Zend Technologies, Inc.
  • 44. Zend Job Queue: Typical example © All rights reserved. Zend Technologies, Inc.
  • 45. Zend Job Queue: Basic use • Would be hard to make it easier… • We can also pass information to our job... © All rights reserved. Zend Technologies, Inc.
  • 46. Zend Job Queue: Basic use • Possible to name our jobs and set an earliest start time… • Once sheduled, it is possible to check up on jobs © All rights reserved. Zend Technologies, Inc.
  • 47. Zend Job Queue: Querying jobs • Finding out the status of our job using the job id  Find out if the job is still queued, running, completed or failed  When finished we get a copy of the script‘s output © All rights reserved. Zend Technologies, Inc.
  • 48. Zend Job Queue: Querying jobs • Searching for jobs  Search for an existing queued job of the same type  Useful for avoiding repetitive work  Returns the number of matching jobs along with job details © All rights reserved. Zend Technologies, Inc.
  • 49. Optimization vs. Complexity © All rights reserved. Zend Technologies, Inc.
  • 50. Optimization vs. Complexity • With every optimization level complexity gets higher  Who else drapped into the Caching pitfall? • First: implement functionality • System performing? • If not, check why • Get rid of bottlenecks © All rights reserved. Zend Technologies, Inc.
  • 51. Reducing Disk I/O The only component of a web server slower than the disk subsystem is the guy you ask to set it up. © All rights reserved. Zend Technologies, Inc.
  • 52. Reducing disk I/O • Use an opcode cache e.g. Zend Optimizer+  Avoids the need to open PHP files and compile the contents for every request.  Compiled „opcodes“ are instead held in shared memory for later reuse.  Particularly important for framework based projects where tens of files may be needed to answer one request.  Also saves some compiler time, but disk I/O savings are usually far more significant.  Most obvious benefit for scripts with short run times or running on loaded servers. © All rights reserved. Zend Technologies, Inc.
  • 53. Reducing disk I/O: Zend Optimizer+ • Performs opcode caching • Also adds multiple optimisation passes • Allows for the blacklisting of files/directories • Simple configuration: © All rights reserved. Zend Technologies, Inc.
  • 54. Check what‘s cached • Zend Server‘s API  accelerator_get_status()  accelerator_get_configuration()  accelerator_reset() © All rights reserved. Zend Technologies, Inc.
  • 55. Reducing disk I/O • Store static files elsewhere • Do not cache to the file system • Must have local storage? ...Use a ramdisk • Reduce PHP/Apache logging to minimal levels  E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR • Don‘t forget the Zend Server logs!  Search for log_verbosity_level in the configuration © All rights reserved. Zend Technologies, Inc.
  • 56. File system concerns • EXT3 – The default problem  For a web server ReiserFS can be 20x (or more) faster, really!  Even XFS is 2.5x faster  If you must use EXT3/4 then throw memory at the server • My NFS/Samba server is fast... Honest!  Even „fast“ NFS servers have terrible performance under load  Older implementations cannot use buffer cache  Poor scalability • Distributed file systems  Extremely poor scalability © All rights reserved. Zend Technologies, Inc.
  • 57. PHP uses your network • PHP communicates with network services like  Databases (ex: MySQL, Oracle)  Caching systems (ex: Memcache, Redis ..)  Job Queue Systems (ex: Zend Job Queue, RabbitMQ )  Session Clustering Daemon (ex: Zend Session Clustering) • If one of these services overloads the network then all other suffer from slowdown  Network congestion  Insufficient bandwidth  High latency © All rights reserved. Zend Technologies, Inc.
  • 58. Overloaded network, slow application • The caching systems have to be very fast  If they are slow then the complete application can be slow • The session clustering has to be fast  Lots of PHP requests wait to get a read/write lock -> the application looks slow © All rights reserved. Zend Technologies, Inc.
  • 59. Know your traffic • A bit of Linux/Unix networking knowledge is required • Count the incoming and outgoing traffic  iptables • Inspect the network streams  Tcpdump  Wireshark © All rights reserved. Zend Technologies, Inc.
  • 60. Traffic counters • Network traffic can be  On different interfaces: • eth0, lo  Incoming/Outgoing  On different ports  Uses different transport protocols © All rights reserved. Zend Technologies, Inc.
  • 61. Traffic counters (2) • Iptables can help you  Zeroing the counters • iptables -t mangle -L -Z INPUT -v -n • iptables -t mangle -L -Z OUTPUT -v -n  Start measuring • Ex: Memcache outgoing – iptables -t mangle -I OUTPUT -p tcp --dport 11211 • Ex: Memcache incoming via udp – iptables -t mangle -I INPUT -p udp --sport 11211 © All rights reserved. Zend Technologies, Inc.
  • 62. Network stream inspectors • Tcpdump  Helps you to record the traffic based on some rules • tcpdump -vv -x -X -s 1500 -i eth0 'port 11211‘ © All rights reserved. Zend Technologies, Inc.
  • 63. Network stream inspectors (2) • Wireshark  Helps you understand better the data © All rights reserved. Zend Technologies, Inc.
  • 64. Hands on session... Over to you ;) © All rights reserved. Zend Technologies, Inc.
  • 65. So long... • …and thanks for all the fish. © All rights reserved. Zend Technologies, Inc.
  • 66. Turbocharging PHP Applications With Zend Server… The Tutorial Eric Ritchie (eric@zend.com) Jan Burkl (jan@zend.com) Slavey Karadzhov (slavey@zend.com) © All rights reserved. Zend Technologies, Inc.