• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Application Diagnosis with Zend Server Tracing
 

Application Diagnosis with Zend Server Tracing

on

  • 2,884 views

Talk by Kevin Schroeder of Zend at ZendCon 2009

Talk by Kevin Schroeder of Zend at ZendCon 2009

Statistics

Views

Total Views
2,884
Views on SlideShare
2,880
Embed Views
4

Actions

Likes
1
Downloads
57
Comments
0

1 Embed 4

http://www.slideshare.net 4

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • When code tracing is activated we ignore other activation requests.

Application Diagnosis with Zend Server Tracing Application Diagnosis with Zend Server Tracing Presentation Transcript

  • Application Diagnosis with Zend Server Tracing
    Kevin Schroeder
    Zend Technologies
  • About me
    Kevin Schroeder
    Consultant for Zend
    Programmer
    Sys Admin
    Author
    Etc.
    Me!
  • "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
  • Why do we need diagnostic tools?
  • Let’s see that again in slow motion
  • The point
    NOT to highlight an individual company
    Why not?
    How many web-based applications look like this when an error occurs?
    Answer
    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
  • 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
  • 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
  • Monitoring
    MUCH better for production systems
    You get a lot of really good information to help replay the issue
  • Monitoring
    You are able to debug or profile the event on a remote machine
  • Events that can be monitored
  • Instrumentation on the next level
    Zend Code Tracing
  • 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
    Errors
    Duration
    Useful in all parts of the software development lifecycle
  • 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.
    14
    Insert->Header & Footer
  • 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
  • Detailed Runtime Instrumentation
    Pinpoint root cause by viewing the sequence of events that led up to an error
  • Detailed Runtime Instrumentation
    Optimize your code by analyzing application performance at the function level
  • Code Tracing – Monitoring Level Modes
    Always on
    Collects trace data when monitoring event is kicked off
    Collects trace data for manual requests.
    Inactive
    Collects data only for manual requests.
    Standby
    Off (turn code tracing extension off)
  • Code Tracing – Operating Modes
    Standby mode
    A monitoring event activates code tracing
    Trace mode:
    On
    Standby
    Tracing switches back for “Standby” mode
    Tracing is activated for X minutes
    Time
    A monitoring event with an “Activate Trace” action is generated
    Collect trace data according to the monitoring set of rules
  • The basics
    Trace a Request
  • Interpreting the results
    Screenshots are boring. Let’s look at live data
  • Setup
    Attaching traces to events
    Tracing can be attached to any PHP-specific events
  • 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
  • Tracing Log
    Step 1 – Make sure that you have it set to log
    Step 2 – Set the verbosity between 1 and 5
    Restart
  • 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 127.0.0.1
    [Tracing Log 08.10.2009 14:14:56 DBG2] 5387 Allow hostmask is 127.0.0.1/32,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12
    [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
  • Functional Examples
    Uncaught exceptions
    Destructor being called
    Prepared Statements
  • Where did all my memory go?
    Memory usage
    Large variable going out of scope
  • Impact
  • 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
  • Questions?
    Want to join in the public beta? Go to
    http://www.zend.com/en/products/server/zend-server-5-new
    for more information
    kevin@zend.com
  • Additional Information
  • What happens when you have too much data
    Need to up the zend_codetracing.buffer_size setting
  • Increasing the buffer size to 5MB
    That’s better
  • Settings
  • Settings
  • Settings
  • Settings