~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/services/profile/README.txt

  • Committer: Gary Poster
  • Date: 2010-08-26 15:57:56 UTC
  • mto: This revision was merged to the branch mainline in revision 11465.
  • Revision ID: gary.poster@canonical.com-20100826155756-7cr6koukadkg5ykh
fix-ups: fix some tests, move new docs to existing doctest, convert existing doctest into being more like docs, hook up doctest with apidoc, write replacement and new unit tests for stuff taken from doctest

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Profiling Integration
2
 
=====================
3
 
 
4
 
The profiler module supports three basic kinds of integration.
5
 
 
6
 
1.  It can be configured to optionally profile requests.  To turn this on, in
7
 
    ``launchpad-lazr.conf`` (e.g.,
8
 
    ``configs/development/launchpad-lazr.conf``) , in the ``[profiling]``
9
 
    section, set ``profiling_allowed: True``.  As of this writing, this
10
 
    is the default value for development.  It might be OK to occasionally
11
 
    turn it on in staging, though note the `Profiler Warnings`_ below.
12
 
 
13
 
    Once it is turned on, you can insert /++profile++/ in the URL to get
14
 
    basic instructions on how to use the feature.
15
 
 
16
 
2.  It can be configured to profile all requests, indiscriminately.  To turn
17
 
    this on, use the ``profiling_allowed`` setting described in option 1
18
 
    above and also set ``profile_all_requests: True`` in the
19
 
    ``[profiling]`` section of ``launchpad-lazr.conf``.
20
 
 
21
 
    Once it is turned on, every request will create a profiling log usable
22
 
    with KCacheGrind.  The browser will include information on the file
23
 
    created for that request.
24
 
 
25
 
3.  It can be configured to record the virtual and resident memory before and
26
 
    after a request.  To turn this on, use the ``profiling_allowed``
27
 
    setting described in option 1 above and also set the
28
 
    ``memory_profile_log`` in the ``[profiling]`` section of
29
 
    ``launchpad-lazr.conf`` to a path to a log file.
30
 
 
31
 
Profiler Warnings
32
 
-----------------
33
 
 
34
 
The profiler in options 1 and 2 above will only allow profiled requests to
35
 
run in serial.
36
 
 
37
 
The data collected in option 3 will be polluted by parallel requests: if
38
 
memory increases in one request while another is also running in a different
39
 
thread, both requests will show the increase.  It also will probably be
40
 
polluted by simultaneous use of options 1 and 2.
41
 
 
42
 
Note that none of these options are currently blessed for production use.
43
 
For options 1 and 2, this is because of the typical cost of employing a
44
 
profiling hook.  The fact that requests are forced to run in serial is also
45
 
a concern, since some of our requests can take much longer than others.
46
 
For option 3, the implementation relies on lib/canonical/mem.py, which
47
 
as of this writing warns in its docstring that "[n]one of this should be
48
 
in day-to-day use."