Your SlideShare is downloading. ×
  • Like
Application Diagnosis with Zend Server Tracing
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.


Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Application Diagnosis with Zend Server Tracing


Talk by Kevin Schroeder of Zend at ZendCon 2009

Talk by Kevin Schroeder of Zend at ZendCon 2009

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


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • When code tracing is activated we ignore other activation requests.


  • 1. Application Diagnosis with Zend Server Tracing
    Kevin Schroeder
    Zend Technologies
  • 2. About me
    Kevin Schroeder
    Consultant for Zend
    Sys Admin
  • 3. "As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to spent in finding mistakes in my own programs"
    - Maurice Wilkes, 1949
  • 4. Why do we need diagnostic tools?
  • 5. Let’s see that again in slow motion
  • 6. The point
    NOT to highlight an individual company
    Why not?
    How many web-based applications look like this when an error occurs?
    All of them
    Web requests are intended to be short and quick
    If an error occurs, recover, quit and go on to the next request
  • 7. Debugging the old way
    var_dump($var)(I still use this occasionally)
    Some obvious problems
    What if you forget to remove it?
    Are you doing this in a production environment? If you are …
    Very limited scope
  • 8. Debugging the better way – ZS Debugging
    You can see what the variable values are at run time and modify them too
    Good for development
    Not good for production
  • 9. Monitoring
    MUCH better for production systems
    You get a lot of really good information to help replay the issue
  • 10. Monitoring
    You are able to debug or profile the event on a remote machine
  • 11. Events that can be monitored
  • 12. Instrumentation on the next level
    Zend Code Tracing
  • 13. Code Tracing: Rapid Problem Resolution
    Similar in concept to a black box flight recorder - Eliminates the need to reproduce problems in order to find root cause
    Activated automatically (through rules) or manually
    Records live application execution
    Function calls
    Arguments and return values
    Useful in all parts of the software development lifecycle
  • 14. Practical Code Tracing Functionality
    By capturing PHP applications code in real time:
    Code Tracing enables to capture problems when they occur.
    Code Tracing recorded data eliminate the need to reproduce the steps led up to a failure.
    Code Tracing enables to analyze PHP applications execution both in production and in test lab environments, by that, it enables to quickly find the root cause of problems.
    Insert->Header & Footer
  • 15. Supported Workflows
    Manual workflow:
    Used while performing unit tests during development or when running functional tests in QA.
    Calling URLs as part of the testing process
    Monitoring events workflow
    Used when running automated tests and load tests and when running your application in staging or production environments.
    Code tracing extends the monitoring rules mechanism by enabling to save trace data when a monitoring event is generated.
    Suitable for production in Standby mode
  • 16. Detailed Runtime Instrumentation
    Pinpoint root cause by viewing the sequence of events that led up to an error
  • 17. Detailed Runtime Instrumentation
    Optimize your code by analyzing application performance at the function level
  • 18. Code Tracing – Monitoring Level Modes
    Always on
    Collects trace data when monitoring event is kicked off
    Collects trace data for manual requests.
    Collects data only for manual requests.
    Off (turn code tracing extension off)
  • 19. Code Tracing – Operating Modes
    Standby mode
    A monitoring event activates code tracing
    Trace mode:
    Tracing switches back for “Standby” mode
    Tracing is activated for X minutes
    A monitoring event with an “Activate Trace” action is generated
    Collect trace data according to the monitoring set of rules
  • 20. The basics
    Trace a Request
  • 21. Interpreting the results
    Screenshots are boring. Let’s look at live data
  • 22. Setup
    Attaching traces to events
    Tracing can be attached to any PHP-specific events
  • 23. Tracing Events – Standby Mode
    Set zend_monitor.event_tracing_mode
    Active, Inactive or Standby
    Determines integration with tracer mechanism in case of events that require a trace data dump
    • Create an Event Action – “Enable Tracing” will change
  • Tracing Process Signals
    Tracing can also be initiated upon a fatal signal
  • 24. Tracing Log
    Step 1 – Make sure that you have it set to log
    Step 2 – Set the verbosity between 1 and 5
  • 25. Example log file
    [Tracing Log 08.10.2009 14:14:56 DBG1] 5387 Tracer request startup
    [Tracing Log 08.10.2009 14:14:56 DBG3] 5387 Setting dump reason to 0
    [Tracing Log 08.10.2009 14:14:56 DBG3] 5387 Dump reason is now 0
    [Tracing Log 08.10.2009 14:14:56 DBG1] 5387 Remote address is
    [Tracing Log 08.10.2009 14:14:56 DBG2] 5387 Allow hostmask is,,,
    [Tracing Log 08.10.2009 14:14:56 DBG2] 5387 Deny hostmask is
    [Tracing Log 08.10.2009 14:14:56 DBG1] 5387 Remote access allowed
    [Tracing Log 08.10.2009 14:14:56 DBG1] 5387 Request parameter requires dump
    [Tracing Log 08.10.2009 14:14:56 DBG3] 5387 Setting dump reason to 2
    [Tracing Log 08.10.2009 14:14:56 NOTICE] 5387 Installing signal handler
    [Tracing Log 08.10.2009 14:14:56 DBG2] 5387 Staring trace generation
    [Tracing Log 08.10.2009 14:14:56 DBG2] 5387 Tracer request startup done
    [Tracing Log 08.10.2009 14:14:56 DBG3] 5387 Options updated to 7FFF
    [Tracing Log 08.10.2009 14:14:57 DBG1] 5387 Tracer request shutdown
    [Tracing Log 08.10.2009 14:14:57 WARNING] 5387 Code tracing buffer full
    [Tracing Log 08.10.2009 14:14:57 DBG1] Using socket /usr/local/zend/tmp/monitor_events.sock rules /usr/local/zend/etc/events_rules.xml
    [Tracing Log 08.10.2009 14:14:58 NOTICE] Event type 1 (0) reported
    [Tracing Log 08.10.2009 14:14:58 NOTICE] 5387 Generating trace dump, format 2
    [Tracing Log 08.10.2009 14:14:58 DBG2] 5387 Dump name is /usr/local/zend/var/codetracing/dump.5387.1
    Monitoring Event was triggered
  • 26. Functional Examples
    Uncaught exceptions
    Destructor being called
    Prepared Statements
  • 27. Where did all my memory go?
    Memory usage
    Large variable going out of scope
  • 28. Impact
  • 29. The all-important question…
    “Where should I use this?”
    Development – Possibly, though profiling and debugging may be more pertinent
    Testing – Absolutely
    Staging – Absolutely
    Production - Absolutely
    In Standby mode
    Activated on a subset of servers
  • 30. Questions?
    Want to join in the public beta? Go to
    for more information
  • 31. Additional Information
  • 32. What happens when you have too much data
    Need to up the zend_codetracing.buffer_size setting
  • 33. Increasing the buffer size to 5MB
    That’s better
  • 34. Settings
  • 35. Settings
  • 36. Settings
  • 37. Settings