Weitere ähnliche Inhalte Ähnlich wie Code Tracing with Zend Server 5: A Flight Recorder for your PHP Applications! (20) Mehr von Zend by Rogue Wave Software (20) Kürzlich hochgeladen (20) Code Tracing with Zend Server 5: A Flight Recorder for your PHP Applications!1. Zend Server 5.0 – Code Tracing
Cohen Tzahi – Product Manager Nov. 2009
To watch the webinar please go to:
http://www.zend.com/en/webinar/Server/webinar-code-
tracing-with-zserver5-a-flight-recorder-for-your-php-
applications-20091111.flv
© All rights reserved. Zend Technologies, Inc.
2. Zend Server 5.0
• Faster problem resolution with code tracing
• Better application performance with Job Queue
• Support for the new PHP 5.3
• Various fixes and minor enhancements
2 © All rights reserved. Zend Technologies, Inc.
3. Why Developers Spend 30%-40%(!) of
their Time on Problem Resolution
• Most problem resolution time is spent on identifying root cause
• Problem reproduction is often difficult and time-consuming
• Many moving parts – server load, input data, database state, etc.
• Some problems cannot be reproduced…
Root Cause Analysis
Root Cause Analysis
reproduce problem – debug Fix
reproduce problem – debug
3 © All rights reserved. Zend Technologies, Inc.
4. Zend Server Code Tracing:
Cuts Root Cause Analysis Time by up to 50%
• Eliminates the need to reproduce problems
• Records live application execution when problems occur
• Activated through Zend Server monitoring rules or manually
• Works in a live production environment or in a test lab
Problem resolution time Root Cause Analysis
Fix
without Code Tracing reproduce problem – debug
Problem resolution time Root Cause Analysis
Fix
with Code Tracing analyze code trace
4 © All rights reserved. Zend Technologies, Inc.
5. Code Tracing – Data Capture
• Reproducing an issue is not always possible.
Dependency on specific SESSION state.
Dependency on specific database state.
“Replaying” the request is risky or impossible.
• Code Tracing can capture the entire execution flow.
5 © All rights reserved. Zend Technologies, Inc.
6. Code Tracing – Data Capture
Code Tracing captures the following information:
Execution tree including function calls and included files.
Function arguments and return parameters.
Output and HTTP headers generation.
Location of errors, exceptions and Zend Monitor events.
For each node, execution time and memory usage is measured.
6 © All rights reserved. Zend Technologies, Inc.
7. DVD-Like Playback of Application Problems
• Opening a Trace File enables you to “playback” the
request execution flow using two perspectives:
• A Tree perspective: Pinpoint root
cause by viewing the sequence of
function calls.
Highlights the critical path of
functions execution flow (duration).
Pinpoints events led up to an error.
7 © All rights reserved. Zend Technologies, Inc.
8. DVD-Like Playback of Application Problems
• A Statistics perspective: displays traced data from a
function perspective.
Execution time: aggregated and a break down of each function
invocation.
Memory consumption:
aggregated and a break down
of each function invocation.
Total number of calls.
8 © All rights reserved. Zend Technologies, Inc.
9. How to Generate Trace Data?
Manually
• Code Trace data can be generated as a result of a manual
request or by a monitoring event.
• Zend Server’s console (Monitor | Code Trace) page contains
a “Trace URL” field and a “Trace” button.
Typing a valid URL and clicking the “Trace” button, will execute
the request while adding a unique parameter (“dump_data=1” )
to the request.
When Zend Server identifies the “dump_data=1” parameter, it
generates a trace file for that request.
9 © All rights reserved. Zend Technologies, Inc.
10. How to Generate Trace Data?
Manually
Trace Files are created and stored on the server where the URLs
are executed on.
10 © All rights reserved. Zend Technologies, Inc.
11. How to Generate Trace Data?
Using Monitoring Rules
• Code Tracing is tightly integrated with Zend Monitoring
mechanism.
• Monitoring rules supports two new actions:
“Save code tracing” – when a monitoring event is generated,
Zend Server will create a Trace file that captures the request’s
execution flow.
“Awake tracing” – when a monitoring event is generated, it will
activate code tracing if it is running in standby mode.
11 © All rights reserved. Zend Technologies, Inc.
12. Code Tracing – Operating modes
• Code Tracing is a standard Zend Server extension, it can be
turned on/off.
Off – Trace files will not be generated.
On –
• Manual Trace files will be saved.
• Trace files generated by Monitoring events will be saved according to
the code tracing for monitoring settings.
(Directive: zend_monitor.event_tracing_mode).
12 © All rights reserved. Zend Technologies, Inc.
13. Code Tracing – Operating modes
• Code Tracing for Monitoring Events : a Zend Monitoring
parameter that controls whether Trace files will be created
by Monitoring events.
Active – When a monitoring rule with a “save trace” action is
generated, trace data will be saved.
Inactive – Trace data will not be saved regardless the events’
actions.
Standby - Trace data will not be saved, unless a monitoring event
with an “Activation” action is generated. At that point, code
tracing for monitoring is activated for a certain amount of time.
13 © All rights reserved. Zend Technologies, Inc.
14. Code Tracing – Standby Mode
Code Tracing for Monitoring Status: ACTIVE
STANDBY
ACTIVE
Trace Files
Trace C
Trace D
Trace E
Event A: Event B: Event C: Event D: Event E: Event F:
Save Trace Activate Save Trace Save Trace Save Trace Save Trace
Action Trace Action Action Action Action Action
6 min
Time
(min) 00:00 00:01 00:02 00:03 00:04 00:05 00:06 00:07 00:08 00:09
14 © All rights reserved. Zend Technologies, Inc.
15. Code Tracing Supported Workflows
• Monitoring workflow:
When a monitoring event is created, the associated trace data of
the specific request is captured.
Trace data is attached and associated to the monitoring event.
• Manual tests/functional workflow:
Manually through the GUI or from a browser by adding a
parameter to the request.
• Production workflow
Can be activated automatically in case of a Zend Monitoring
event, for example a PHP error, a slow execution or high memory
usage.
15 © All rights reserved. Zend Technologies, Inc.
16. Monitoring Workflow
• Monitoring workflow is used when running automated/load
tests in pre-production/staging or even for monitoring
applications in production environments.
• Zend Monitoring proactively alerts when critical problem
occurs.
Code Tracing can be associated to the Monitoring mechanism as
an action of a Monitoring Rules.
Enables to capture a complete execution flow only when
problems occur.
Trace data is associated to the Monitoring Rule and can be
“replayed” in context.
16 © All rights reserved. Zend Technologies, Inc.
17. Manual Tests/Functional Workflow
• Manual/functional workflow is used when performing unit
tests during development or when running functional tests
in QA.
• Code tracing GUI enables to manually execute a one time
request.
The request’s execution
flow is captured and
stored in a Trace file.
17 © All rights reserved. Zend Technologies, Inc.
18. Production Workflow
• Production workflow is used when running in production or
when running load tests.
• Code Tracing Stand-by mode:
Code Tracing can be set to work in Stand-by mode.
Monitoring Rules can activate Code Tracing for a certain
timeframe.
By the end of that timeframe, Code Tracing is switched back to
Standby.
18 © All rights reserved. Zend Technologies, Inc.
19. Code Tracing - Live Demo
© All rights reserved. Zend Technologies, Inc.
20. Q&A
• Zend Server 5.0 beta: download information:
http://www.zend.com/en/products/server/zend-server-5-
new
• Zend Server 5.0 beta forum:
http://forums.zend.com/viewforum.php?f=74
• Feel free to contact me:
• tzahi.c@zend.com
Thank you.
20 © All rights reserved. Zend Technologies, Inc.
21. Webinar
To watch the webinar please go to:
http://www.zend.com/en/webinar/Server/webinar-code-
tracing-with-zserver5-a-flight-recorder-for-your-php-
applications-20091111.flv
or
http://bit.ly/oFYmwn
(short registration required)
21 © All rights reserved. Zend Technologies, Inc.