4
The profiler module supports three basic kinds of integration.
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.
13
Once it is turned on, you can insert /++profile++/ in the URL to get
14
basic instructions on how to use the feature.
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``.
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.
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.
34
The profiler in options 1 and 2 above will only allow profiled requests to
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.
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