Zend Server: A Guided Tour


By Shahahr Evron
Technical Product Manager, Zend Technologies
Welcome!
I am your tour guide today:
 ▶   A PHP programmer since 2002
 ▶   At Zend since 2005
 ▶   Technical Product Manager for Zend Server

Yes, I have a difficult name      (at least for English speakers)
 ▶   Shachar    (German, Dutch)
 ▶   Shajar   (Spanish)

 ▶   Шахар     (Russian)

 ▶   ‫( ﺷﺨﺮ‬Arabic)
 ▶   ‫( שחר‬Hebrew)


                                                                    2
Agenda
Zend Server: What & Why?

Improving PHP's manageability
 ▶   Installation, Zend Server Administration UI

Improving your application's performance
 ▶   Optimizer+, Data Cache, Page Cache, Job Queue

Improving your application's reliability
 ▶   Zend Monitor, Code Tracing




                                                     3
What is Zend Server?
...and why should I care?




                            4
...Well, Just ask your friend at marketing!

            “Zend Server is a complete, enterprise-
              ready Web Application Server for
                    running and managing
             PHP applications that require a high
             level of reliability, performance and
                            security.”




                                                 5
Let's try to make sense out of that..
Zend Server Is:
 ▶   A complete, well tested PHP runtime environment
 ▶   Supported and updated by Zend
 ▶   Comes with a set of extra features that:
     ●
         Improve the performance and reliability of PHP applications
     ●
         Make it easier to manage a consistent PHP environment


Comes in two flavors:
 ▶   Zend Server
 ▶   Zend Server Community Edition




                                                                       6
Manageability Features
...making PHP even simpler




                             7
Installation
Zend Server uses OS-native installers
  ▶   Linux: Deb and RPM repositories
  ▶   Windows: MSI
  ▶   Mac OS X*: PKG installer



This is good because:
  ▶   Native means well-known, convenient, proven, reliable
  ▶   Upgrading, updating, modifying and removing is easy
  ▶   Automating, scripting and bundling is also easy


                                             * Mac OS X is Community Edition only

                                                                           8
For example, the DEB installation...
All you have to do is:
 ▶   Add a line to /etc/apt/sources.list
 ▶   Run the usual aptitude or apt-get commands, or use Synaptic




                                                                   9
For example, the DEB installation...
And you get:
 ▶   The latest stable* PHP version
     ●
         With additional testing done by Zend's QA team
     ●
         With Zend's extra components

 ▶   All packaging features supported by your distribution's tools:
     ●   automatic update notifications, configuration management
     ●   Repository mirroring / proxying capabilities
     ●   Ability to hold back / roll back / remove specific components


If you know your way around Debian, you can also easily:
 ▶   Script & automate the installation
 ▶   Create your own meta-packages that include the parts you need

                                                                         10
The Administration Interface
Zend Server's GUI allows you to conveniently...
  ▶   Control the different Zend Server components
  ▶   Control your PHP settings
      ●
          PHP Extensions
      ●
          PHP Directives

  ▶   Monitor the current system status
      ●   Extension status
      ●   PHP status
      ●   Logs
      ●   Available updates & security fixes




                                                     11
Performance Features




                       12
Zend Server's approach to performance
A Web application's performance is affected by many
different factors...




    ...This is why taking a single measure will only give partial results

                                                                      13
Zend Server's approach to performance
Really improving performance requires combining
different measures:
  ▶   Configuration Optimization
  ▶   Opcode Optimization and Caching
  ▶   Data Caching and Page Caching
  ▶   Off-line or parallel execution


Not all performance optimizations are equal
  ▶   Some are almost free and should be done in almost all cases
  ▶   Some are expensive and should not be done without insight

Zend Server provides the measures, and the insight!

                                                                    14
Optimizer+
Eliminates the stuff you don't really need:
 ▶   Code optimizer
     ●
         Optimizes certain code fragments to improve execution speed
 ▶   Opcode cache
     ●
         Caches the optimized, compiled bytecode in RAM
     ●   Reduces or eliminates                      Bare PHP    Optimizer+
             compile time        50                             45.55
     ●   Reduces or eliminates   45                                                  41.73
                                 40
             disk access         35
                                 30
                                 25
                                 20
                                                        13.96                12.69
                                 15
                                 10
                                              5.3
                                  5    2.24
                                  0
                                        Magento            Drupal            SugarCRM CE


                                                                                        15
Data Caching
Provides a set of API functions for caching of data items
  ▶   DB query results, web service calls, complex or hard-to-get data
  ▶   Output elements

  ▶   Allows skipping slow PHP code chunks
  ▶   Shared memory and Disk storage backends
  ▶   Data could be grouped using namespaces
  ▶   APC user cache compatibility layer
  ▶   Zend Framework Zend_Cache_Backend adapters




                                                                     16
Page Caching
Don't execute a single line of PHP if you don't have to...
 ▶   Caches entire HTTP response
 ▶   Super fast (seriously!)
 ▶   Configured from UI, no code changes required
 ▶   Live / cached decision is based on request or session parameters
 ▶   Variants can be created   700

     based on request or       600
                                                                 589.26

     session parameters        500

                               400

                               300
                                                    201.17
                               200

                               100
                                      21.94
                                 0
                                     No Cache    Session Rule   Other Rule

                                                                          17
Page Caching




               18
Job Queue
A PHP script often needs to handle several tasks.
 ▶   Some of which don't need to be interactive



Think of a typical on-line forum:
 ▶   A user posts a message to a thread
 ▶   Message is saved in the DB
 ▶   Emails are sent to all thread watchers
 ▶   Search index is refreshed
 ▶   Feeds are regenerated

Your end user shouldn't wait for these to finish!

                                                    19
Job Queue
Job Queue allows you to
 ▶   Put certain tasks into a separate execution queue
     ●
         Off-load to a later time (or even run in parallel)
     ●
         Off-load to a different server
 ▶   Execute certain tasks at a specified time
     ●   Distribute processing load to off-hours
 ▶   Execute certain tasks periodically


While..
 ▶   Maximizing reuse of existing infrastructure & code
 ▶   Making sure nothing falls between the cracks
 ▶   Doing it all from a PHP API


                                                              20
Job Queue – A Common Execution Flow




                                      21
Reliability Features
Make sure it keeps running!




                              22
Reliability?
 Getting your application out there is one thing,
 keeping it working properly is a different story!




 Zend Server helps you by:
  ▶   Making sure your software is
      up-to-date, including critical fixes
  ▶   Monitoring your apps for errors,
      slowdowns and other troubles
  ▶   Capturing data that can be used
      when resolving any detected issues


                                                     23
Application Level Monitoring
Zend Server Monitor will watch your application for:
  ▶   PHP Errors (including warnings, notices, uncaught exceptions...)
  ▶   Failing functions (user-defined or internal)
  ▶   Failing DB queries
  ▶   Slow functions (user-defined or internal) or DB queries
  ▶   Slow request executions
  ▶   High memory consumption
  ▶   Errors reported by Zend Server
          components


When an issue is detected,
  Zend Server will report an event

                                                                     24
Root Cause Analysis
Recurring events are aggregated and placed on a timeline
  ▶   So you can know if a problem repeats, and if so when


Each event report contains context information that can
assist in debugging the event:
  ▶   URL, file, line, error message, repeat count etc.
  ▶   Request information (GET, POST, COOKIE etc.)
  ▶   Server information
  ▶   Session Information
  ▶   Backtrace (if relevant)


For many errors, this information is crucial for debugging

                                                             25
Integration with Zend Studio
Zend Server integrates with Zend Studio and allows you
to “replay” an event
  ▶   In a debugging session
  ▶   In a profiling session

  ▶   This can be done with one button click from the GUI
  ▶   …or, by exporting the event data and passing it to a developer,
      from the developer's IDE

  ▶   You can also “replay” on an alternate testing server


In many cases this eliminates time spent on reproduction

                                                                        26
Code Tracing
Reproducing an issue is not always possible...
 ▶   Dependency on specific SESSION state
 ▶   Dependency on specific database state
 ▶   “Replaying” the request is risky or impossible


             “Hindsight is always twenty-twenty.”
                                               - Billy Wilder



Zend Code Tracing can capture the entire execution flow
 ▶   ...and, it is efficient enough to be used in most production
     environments!


                                                                    27
Code Tracing
Can be used in several ways:
  ▶   Automatic tracing in case of a Zend Monitor event
      ●
          For example a PHP error, a slow execution or high memory usage
  ▶   Manually through the GUI or from a browser
  ▶   Through API


Can capture the following information:
  ▶   Execution tree including function calls and included files
  ▶   Function agrument and return parameters
  ▶   Output and header generation
  ▶   Location of errors, exceptions and Zend Monitor events
  ▶   For each node, execution time and memory usage is measured

                                                                           28
Code Tracing




               29
Updates & Hot Fixes from Zend
Zend Server is regularly updated with...
  ▶   PHP releases
  ▶   Zend Framework releases
  ▶   Important patches to PHP and supporting components
      ●
          Bugs fixed by the PHP team but not yet released
      ●
          Patches committed by Zend to the PHP source tree, but not yet
          released


Zend also issues hot-fixes when needed
  ▶   All relevant security reports are analyzed by Zend
  ▶   This includes PHP, extensions, libraries, and other components
  ▶   Zend is committed to releasing hot-fixes for critical issues


                                                                          30
…So, what have we seen?




                          31
Closing Words...
Zend Server can help you to...
  ▶   Stop worrying about PHP updates
  ▶   Improve your applications performance using various tools
      ●
          Some improvement is effortless
      ●
          You get the infrastructure for future improvement
      ●   You get the diagnostic tools for prioritizing optimizations
  ▶   Know about production issues as they
      happen
  ▶   Quickly resolve these issues




Focus on your own applications!

                                                                        32
Thanks!
Email me: shahar.e@zend.com
Learn more at http://www.zend.com/server




    Copyright © 2009 Zend Technologies Ltd.

    This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of
    this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street,
    Suite 300, San Francisco, California, 94105, USA.


                                                                                                                         33

Zend Server: A Guided Tour

  • 1.
    Zend Server: AGuided Tour By Shahahr Evron Technical Product Manager, Zend Technologies
  • 2.
    Welcome! I am yourtour guide today: ▶ A PHP programmer since 2002 ▶ At Zend since 2005 ▶ Technical Product Manager for Zend Server Yes, I have a difficult name (at least for English speakers) ▶ Shachar (German, Dutch) ▶ Shajar (Spanish) ▶ Шахар (Russian) ▶ ‫( ﺷﺨﺮ‬Arabic) ▶ ‫( שחר‬Hebrew) 2
  • 3.
    Agenda Zend Server: What& Why? Improving PHP's manageability ▶ Installation, Zend Server Administration UI Improving your application's performance ▶ Optimizer+, Data Cache, Page Cache, Job Queue Improving your application's reliability ▶ Zend Monitor, Code Tracing 3
  • 4.
    What is ZendServer? ...and why should I care? 4
  • 5.
    ...Well, Just askyour friend at marketing! “Zend Server is a complete, enterprise- ready Web Application Server for running and managing PHP applications that require a high level of reliability, performance and security.” 5
  • 6.
    Let's try tomake sense out of that.. Zend Server Is: ▶ A complete, well tested PHP runtime environment ▶ Supported and updated by Zend ▶ Comes with a set of extra features that: ● Improve the performance and reliability of PHP applications ● Make it easier to manage a consistent PHP environment Comes in two flavors: ▶ Zend Server ▶ Zend Server Community Edition 6
  • 7.
  • 8.
    Installation Zend Server usesOS-native installers ▶ Linux: Deb and RPM repositories ▶ Windows: MSI ▶ Mac OS X*: PKG installer This is good because: ▶ Native means well-known, convenient, proven, reliable ▶ Upgrading, updating, modifying and removing is easy ▶ Automating, scripting and bundling is also easy * Mac OS X is Community Edition only 8
  • 9.
    For example, theDEB installation... All you have to do is: ▶ Add a line to /etc/apt/sources.list ▶ Run the usual aptitude or apt-get commands, or use Synaptic 9
  • 10.
    For example, theDEB installation... And you get: ▶ The latest stable* PHP version ● With additional testing done by Zend's QA team ● With Zend's extra components ▶ All packaging features supported by your distribution's tools: ● automatic update notifications, configuration management ● Repository mirroring / proxying capabilities ● Ability to hold back / roll back / remove specific components If you know your way around Debian, you can also easily: ▶ Script & automate the installation ▶ Create your own meta-packages that include the parts you need 10
  • 11.
    The Administration Interface ZendServer's GUI allows you to conveniently... ▶ Control the different Zend Server components ▶ Control your PHP settings ● PHP Extensions ● PHP Directives ▶ Monitor the current system status ● Extension status ● PHP status ● Logs ● Available updates & security fixes 11
  • 12.
  • 13.
    Zend Server's approachto performance A Web application's performance is affected by many different factors... ...This is why taking a single measure will only give partial results 13
  • 14.
    Zend Server's approachto performance Really improving performance requires combining different measures: ▶ Configuration Optimization ▶ Opcode Optimization and Caching ▶ Data Caching and Page Caching ▶ Off-line or parallel execution Not all performance optimizations are equal ▶ Some are almost free and should be done in almost all cases ▶ Some are expensive and should not be done without insight Zend Server provides the measures, and the insight! 14
  • 15.
    Optimizer+ Eliminates the stuffyou don't really need: ▶ Code optimizer ● Optimizes certain code fragments to improve execution speed ▶ Opcode cache ● Caches the optimized, compiled bytecode in RAM ● Reduces or eliminates Bare PHP Optimizer+ compile time 50 45.55 ● Reduces or eliminates 45 41.73 40 disk access 35 30 25 20 13.96 12.69 15 10 5.3 5 2.24 0 Magento Drupal SugarCRM CE 15
  • 16.
    Data Caching Provides aset of API functions for caching of data items ▶ DB query results, web service calls, complex or hard-to-get data ▶ Output elements ▶ Allows skipping slow PHP code chunks ▶ Shared memory and Disk storage backends ▶ Data could be grouped using namespaces ▶ APC user cache compatibility layer ▶ Zend Framework Zend_Cache_Backend adapters 16
  • 17.
    Page Caching Don't executea single line of PHP if you don't have to... ▶ Caches entire HTTP response ▶ Super fast (seriously!) ▶ Configured from UI, no code changes required ▶ Live / cached decision is based on request or session parameters ▶ Variants can be created 700 based on request or 600 589.26 session parameters 500 400 300 201.17 200 100 21.94 0 No Cache Session Rule Other Rule 17
  • 18.
  • 19.
    Job Queue A PHPscript often needs to handle several tasks. ▶ Some of which don't need to be interactive Think of a typical on-line forum: ▶ A user posts a message to a thread ▶ Message is saved in the DB ▶ Emails are sent to all thread watchers ▶ Search index is refreshed ▶ Feeds are regenerated Your end user shouldn't wait for these to finish! 19
  • 20.
    Job Queue Job Queueallows you to ▶ Put certain tasks into a separate execution queue ● Off-load to a later time (or even run in parallel) ● Off-load to a different server ▶ Execute certain tasks at a specified time ● Distribute processing load to off-hours ▶ Execute certain tasks periodically While.. ▶ Maximizing reuse of existing infrastructure & code ▶ Making sure nothing falls between the cracks ▶ Doing it all from a PHP API 20
  • 21.
    Job Queue –A Common Execution Flow 21
  • 22.
    Reliability Features Make sureit keeps running! 22
  • 23.
    Reliability? Getting yourapplication out there is one thing, keeping it working properly is a different story! Zend Server helps you by: ▶ Making sure your software is up-to-date, including critical fixes ▶ Monitoring your apps for errors, slowdowns and other troubles ▶ Capturing data that can be used when resolving any detected issues 23
  • 24.
    Application Level Monitoring ZendServer Monitor will watch your application for: ▶ PHP Errors (including warnings, notices, uncaught exceptions...) ▶ Failing functions (user-defined or internal) ▶ Failing DB queries ▶ Slow functions (user-defined or internal) or DB queries ▶ Slow request executions ▶ High memory consumption ▶ Errors reported by Zend Server components When an issue is detected, Zend Server will report an event 24
  • 25.
    Root Cause Analysis Recurringevents are aggregated and placed on a timeline ▶ So you can know if a problem repeats, and if so when Each event report contains context information that can assist in debugging the event: ▶ URL, file, line, error message, repeat count etc. ▶ Request information (GET, POST, COOKIE etc.) ▶ Server information ▶ Session Information ▶ Backtrace (if relevant) For many errors, this information is crucial for debugging 25
  • 26.
    Integration with ZendStudio Zend Server integrates with Zend Studio and allows you to “replay” an event ▶ In a debugging session ▶ In a profiling session ▶ This can be done with one button click from the GUI ▶ …or, by exporting the event data and passing it to a developer, from the developer's IDE ▶ You can also “replay” on an alternate testing server In many cases this eliminates time spent on reproduction 26
  • 27.
    Code Tracing Reproducing anissue is not always possible... ▶ Dependency on specific SESSION state ▶ Dependency on specific database state ▶ “Replaying” the request is risky or impossible “Hindsight is always twenty-twenty.” - Billy Wilder Zend Code Tracing can capture the entire execution flow ▶ ...and, it is efficient enough to be used in most production environments! 27
  • 28.
    Code Tracing Can beused in several ways: ▶ Automatic tracing in case of a Zend Monitor event ● For example a PHP error, a slow execution or high memory usage ▶ Manually through the GUI or from a browser ▶ Through API Can capture the following information: ▶ Execution tree including function calls and included files ▶ Function agrument and return parameters ▶ Output and header generation ▶ Location of errors, exceptions and Zend Monitor events ▶ For each node, execution time and memory usage is measured 28
  • 29.
  • 30.
    Updates & HotFixes from Zend Zend Server is regularly updated with... ▶ PHP releases ▶ Zend Framework releases ▶ Important patches to PHP and supporting components ● Bugs fixed by the PHP team but not yet released ● Patches committed by Zend to the PHP source tree, but not yet released Zend also issues hot-fixes when needed ▶ All relevant security reports are analyzed by Zend ▶ This includes PHP, extensions, libraries, and other components ▶ Zend is committed to releasing hot-fixes for critical issues 30
  • 31.
    …So, what havewe seen? 31
  • 32.
    Closing Words... Zend Servercan help you to... ▶ Stop worrying about PHP updates ▶ Improve your applications performance using various tools ● Some improvement is effortless ● You get the infrastructure for future improvement ● You get the diagnostic tools for prioritizing optimizations ▶ Know about production issues as they happen ▶ Quickly resolve these issues Focus on your own applications! 32
  • 33.
    Thanks! Email me: shahar.e@zend.com Learnmore at http://www.zend.com/server Copyright © 2009 Zend Technologies Ltd. This work is licensed under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 33