(Update status) |
(→TODO: add done items from 1.1) |
||
Line 32: | Line 32: | ||
=== TODO === | === TODO === | ||
* Some experiments showed some greater than expected impact on performance in the dormant case. So for each package identified we need to do some benchmarking to make sure there is zero overhead in to normal case. (Add any relevants benchmarks to the scopes section under the relevant package please). | * Some experiments showed some greater than expected impact on performance in the dormant case. So for each package identified we need to do some benchmarking to make sure there is zero overhead in to normal case. (Add any relevants benchmarks to the scopes section under the relevant package please). | ||
=== DONE === | |||
* Identified deficiencies upstream: | * Identified deficiencies upstream: | ||
* [[http://sourceware.org/bugzilla/show_bug.cgi?id=10013 PR10013]] support ENABLED sdt probe macro | * [[http://sourceware.org/bugzilla/show_bug.cgi?id=10013 PR10013]] support ENABLED sdt probe macro - Fixed in 1.1 | ||
* [[http://sourceware.org/bugzilla/show_bug.cgi?id=10601 PR10601]] user-space deref/registers in loc2c (i386 mainly, but could affect x86_64 and other arches also) | * [[http://sourceware.org/bugzilla/show_bug.cgi?id=10601 PR10601]] user-space deref/registers in loc2c (i386 mainly, but could affect x86_64 and other arches also) - Fixed in 1.1 | ||
== Detailed Description == | == Detailed Description == |
Revision as of 14:11, 10 February 2010
Systemtap Static Probes
Summary
Systemtap allows event tracing of programs when they have static probes inserted. This allows for tracing specifics of an application on a higher level that is meaningful to the application user so they don't have to know the exact source code details for tracing what is happening.
Owner
- Name: Mark Wielaard
- email: mjw@redhat.com
Current status
- Targeted release: Fedora 13
- Last updated: 10 Feb 2009
- Percentage of completion: 65%
- systemtap-sdt-devel 1.1 is now available.
- java (since 1:1.6.0-21.b16 and since 34.b17 also jni and jstack support) and postgresql (since 8.3.6-4) have had static probes enabled.
- Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=546295
- Python:
- DONE:
- Built Python 2 with Systemtap patch adding
function__entry
andfunction__return
static markers: http://koji.fedoraproject.org/koji/buildinfo?buildID=155204 (tagged as python-2_6_4-17_fc13) - Python 2 tapset written, hiding some of the complexity of the static markers and providing
python.function.entry
andpython.function.return
; example of usage added to docs in python-libs subpackage, logging all Python function calls/return across whole system. Built as http://koji.fedoraproject.org/koji/buildinfo?buildID=155238 (tagged as python-2_6_4-18_fc13); example script tested on i386 only so far.
- Built Python 2 with Systemtap patch adding
- TODO:
- Test performance
- Double-check generated machine code
- Test with and without probes, on both architectures
- More documentation
- Additional probepoints as listed under "Scope" below
- All of the above for Python 3
- DONE:
TODO
- Some experiments showed some greater than expected impact on performance in the dormant case. So for each package identified we need to do some benchmarking to make sure there is zero overhead in to normal case. (Add any relevants benchmarks to the scopes section under the relevant package please).
DONE
- Identified deficiencies upstream:
* [PR10013] support ENABLED sdt probe macro - Fixed in 1.1 * [PR10601] user-space deref/registers in loc2c (i386 mainly, but could affect x86_64 and other arches also) - Fixed in 1.1
Detailed Description
By packaging a new version of systemtap, that enables programs that already have static dtrace probe markers in their sources and by making those packages build depend on the new systemtap-sdt-devel package and recompiling them with probe points enabled, users of those packages will be able to trace any high level events that these packages provide.
Benefit to Fedora
It will be easier for developers and users to observe what is really happening on their system on a higher (application) level.
Scope
- Work with upstream to identify any issues with the new capabilities while we activate probes in packages.
- Package new version of Systemtap (including new subpackage systemtap-sdt-devel).
- Identify packages that already include static user probes (see below)
- Work with package maintainer to enable them in the Fedora build spec file.
- Add documentation on enabled probes and how to use them with a systemtap tapset.
Currently identified packages:
postgresql
Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=488941 Already able to build something that works with current rpm. Documentation: upstream docs Example: example trace Screencast: video presentation
xorg-x11-server
Need tweaks to systemtap to gen proper header from .d file. (upstream docs) - stan and/or rajan
java-1.6.0-openjdk
Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=498109 Probably likewise, has .d files in there. (upstream docs) - stan and/or mjw Static probes ready, plus hotspot tapset, jni tapset and java backtraces pending upstream.
tcl
Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=489017
- tcl-8.4.16+: Has a single generic/tclDTrace.d file. (upstream docs) - stan
Might need implementation of probe_ENABLED(), which is tracked upstream as http://sourceware.org/bugzilla/show_bug.cgi?id=10013
Firefox
Tracking bug: https://bugzilla.redhat.com/show_bug.cgi?id=496113
- firefox-3.1-0.6 (upstream docs) - rajan
- Profile Firefox using SystemTap on DTrace probes: ProfilingFirefox
mysql
- mysql 6.0.8: really new alpha version from mysql.com has probes. However, the version in fedora 5.0.67 doesn't. A backport would be required. Won't be in next fedora
apachetop/httpd
- apachetop-0.12.6 (newer httpd have patches directly [1] - note needs some build tweaking)
Perl
perl-5.10.0: implemented as an out-of-tree patch to the core (5.10.1 has some, see INSTALL)
Python
- Python-2.6: implemented as an out-of-tree patch to the core (Issue4111)
- --Dmalcolm 00:17, 1 December 2009 (UTC): if we do Python 2, we should also look at doing Python 3; see Features/Python3F13
- Initial work at FUDCon Toronto
- Tracking in our downstream bugzilla here
- TODO: Benchmark the impact of the probe points: http://code.google.com/p/unladen-swallow/wiki/Benchmarks
Ideas for python probes:
- function calls/returns (this is what the dtrace probe has)
- GIL events: instrument the raw function to claim/release of the lock, then capture the times at which it happens, then render stats
- threads starting/stopping
- bytecode execution metrics: e.g. trace individual bytecodes; how often does LOAD_GLOBAL get invoked
- exceptions being thrown
- unhandled exceptions
- arenas being claimed/freed
- dictionaries switching to inefficient form: http://lewk.org/blog/python-dictionary-optimizations
- _warnings.c: do_warn() (e.g. whole-system python3 warnings for all python 2 running on your system)
- py-level backtraces
PHP
- php-5.2.8: implemented as an add-on module (shared library listed in /etc/php.ini) that intercepts internal php interpreter function pointers and wraps those calls with markers
Ruby
- ruby-1.8.6-p287: similar to php, but richer & far more complicated
See http://ruby-dtrace.rubyforge.org/
Haskell
- ghc very recently got some static probe support see http://hackage.haskell.org/trac/ghc/wiki/DTrace (not tried to build yet).
- darcs patch
Notes
It seems as if several of the above were dtrace-instrumented in code that was never merged into the upstream versions of the package, but instead represented as run-time add-ons or private patches for Solaris distributions. Disappointing, but perhaps we can do better and engage the respective upstream teams. This will of course take time and panache.
At least the patches tend to be very small so we have some freedom to choose between approaches (adding STAP_PROBE/whatever hooks directly to the core upstream code; or fedora local patches; or add-on shared libraries like for php/httpd).
Another approach worth considering is adding tapsets that map process.mark() events to process.function/statement() to approximate the dtrace out-of-tree patches.
How To Test
Whether systemtap and static markers are working in general can be tested by installing systemtap, kernel-debuginfo and the systemtap-testsuite. Running sudo make installcheck in /usr/share/systemtap/testsuite
When applications get static markers enabled we should add them to a testing page listing:
- Package install instructions.
- Setup and sample run of the application
- A reference to the probe names.
- And an simple example stap invocation listing markers that can be enabled.
Question: Is there a convention/template for adding such test pages for test days?
Answer: https://fedoraproject.org/wiki/QA/Test_Days/Create
User Experience
For packages that have static probes enabled users will be able to trace high-level events, like for example database transactions, through stap.
Dependencies
- A new version of systemtap with the systemtap-sdt-devel subpackage.
- Any package wishing to expose existing probes in its (upstream) sources depending on systemtap-sdt-devel and adding an --enable-dtrace or equivalent to its spec file.
- Not required for this feature, but since systemtap uses debuginfo, this feature is enhanced by the Debug Info Revamp Feature.
Contingency Plan
Even if all the tracing will not work, packages that are converted to provide static probes will not be impacted since the probe points have (near) zero overhead, so in the worse case some packages were recompiled to enable the feature, but users will still not be able to use it.
Documentation
The upstream wiki is the best description for now http://sourceware.org/systemtap/wiki/UsingStaticUserMarkers the systemtap list has an example on converting a package http://sourceware.org/ml/systemtap/2009-q1/msg00140.html
While working on this feature this section will be expanded to list packages that have probe points enabled and pointers to (upstream) package documentation on the probe names and semantics like for postgresql http://www.postgresql.org/docs/8.2/static/dynamic-trace.html
Release Notes
Systemtap has been extended to support user space tracing, and in particular to support static (dtrace compatible) markers enabled in various programs in Fedora 12. This enables users, developers and administrators a high level overview of what is going on with their system or deep down in a specific program or subsystem.
Systemtap comes with a tutorial, a language reference manual, a tapsets reference and an examples directory under /usr/share/doc/systemtap-?.?/
- TODO: Should have a list of which packages were enabled with markers when finished.
Comments and Discussion