summaryrefslogtreecommitdiff
path: root/manual/en/160-tuning.mdwn
blob: 1fe2173248e4583fd3090d0e90c450d27c8dbe68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Performance tuning

This chapter discusses ways to tune Obnam performance for various
situations. It covers the various options that can affect CPU and
memory consumption, as well as ways to experiment to find a good set
of values.

See <http://obnam.org/faq/tuning/> for a start.


## Running Obnam under the Python profiler

A **profiler** is a program that measures where another program spends
its time. This can be very useful for finding out why the other
program is slow.

Obnam can easily be run under the Python profiler. You need to have
the profiler installed. Check with your operating system or Python
installation how to achieve that. To see if you have it installed, run
the following command on the command line:

    python -c 'import cProfile'

If this outputs nothing, all is well. If it outputs an error such as
the following, you have not got the profiler installed:

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    ImportError: No module named cProfiler

Once you have the profiler installed, run Obnam like this:

    OBNAM_PROFILE=backup.prof obnam backup

This will cause the profiling data to be written to the file
`backup.prof`. You can do this for any Obnam command, and write it to
any file.

The profiling data is in binary form. Obnam comes with a little helper
program to transform it to a human-readable form:

    obnam-viewprof backup.prof | less

If you run the above command, you'll see that the humans to whom this
is readable are programmers and circus clowns. If you can understand
the output, great! If not, it's still useful to send that to the Obnam
developers to report a performance problem.