Skip to content

Commit 9ba2afe

Browse files
authored
[docs] Overhaul the documentation (#136)
There were multiple mentions of how to run a server, all of them slightly different. This reorganizes the documentation to have a single place explaining how to run a server, either locally or in production via Docker. This also moves the documentation of the deprecated `nts` test suite to a less prominent location -- we should actually see if that can be removed entirely. Finally, it updates the Quickstart section of "Running tests" to ensure that the commands actually run on anyone's machine. A quickstart should not require custom setup.
1 parent 4edc628 commit 9ba2afe

File tree

9 files changed

+320
-416
lines changed

9 files changed

+320
-416
lines changed

deployment/app_wrapper.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/concepts.rst

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
Concepts
44
========
55

6-
LNT's data model is pretty simple, and just following the :ref:`quickstart` can
7-
get you going with performance testing. Moving beyond that, it is useful to have
8-
an understanding of some of the core concepts in LNT. This can help you get the
9-
most out of LNT.
6+
LNT's data model is pretty simple and can be grasped intuitively. However, for
7+
more advanced usage, it is useful to have an understanding of some of the core
8+
concepts in LNT. This can help you get the most out of LNT.
109

11-
Orders Machines and Tests
12-
-------------------------
10+
Orders, Machines and Tests
11+
--------------------------
1312

1413
LNT's data model was designed to track the performance of a system in many
1514
configurations over its evolution. In LNT, an Order is the x-axis of your
@@ -19,15 +18,15 @@ also be used to represent treatments, such as a/b. You can put anything you
1918
want into LNT as an order, as long as it can be sorted by Python's sort
2019
function.
2120

22-
A Machine in LNT is the logical bucket which results are categorized by.
21+
A Machine in LNT is the logical bucket which results are categorized by.
2322
Comparing results from the same machine is easy, across machines is harder.
2423
Sometimes machine can literally be a machine, but more abstractly, it can be any
2524
configuration you are interested in tracking. For example, to store results
26-
from an Arm test machine, you could have a machine call "ArmMachine"; but, you
25+
from an Arm test machine, you could have a machine called "ArmMachine"; but, you
2726
may want to break machines up further for example "ArmMachine-Release"
2827
"ArmMachine-Debug", when you compile the thing you want to test in two modes.
2928
When doing testing of LLVM, we often string all the useful parameters of the
30-
configuration into one machines name::
29+
configuration into the name of the machine::
3130

3231
<hardware>-<arch>-<optimization level>-<branch-name>
3332

@@ -37,7 +36,7 @@ Runs and Samples
3736
----------------
3837

3938
Samples are the actual data points LNT collects. Samples have a value, and
40-
belong to a metric, for example a 4.00 second (value) compile time (metric).
39+
belong to a metric, for example a 4.00 second (value) compile time (metric).
4140
Runs are the unit in which data is submitted. A Run represents one run through
4241
a set of tests. A run has a Order which it was run
4342
on, a Machine it ran on, and a set of Tests that were run, and for each Test
@@ -54,7 +53,7 @@ Test Suites
5453
LNT uses the idea of a Test Suite to control what metrics are collected. Simply,
5554
the test suite acts as a definition of the data that should be stored about
5655
the tests that are being run. LNT currently comes with two default test suites.
57-
The Nightly Test Suite (NTS) (which is run far more often than nightly now),
56+
The Nightly Test Suite (NTS) (which is run far more often than nightly now),
5857
collects 6 metrics per test: compile time, compile status, execution time, execution
5958
status, score and size. The Compile (compile) Test Suite, is focused on metrics
6059
for compile quality: wall, system and user compile time, compile memory usage

docs/contents.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ Contents
88

99
intro
1010

11-
quickstart
11+
tests
1212

13-
tools
13+
running_server
1414

15-
tests
15+
importing_data
16+
17+
tools
1618

1719
concepts
1820

1921
api
2022

21-
importing_data
23+
profiles
2224

2325
developer_guide
2426

25-
profiles
26-
2727
Indices and tables
2828
==================
2929

@@ -39,4 +39,3 @@ Module Listing
3939
:maxdepth: 2
4040

4141
modules/testing
42-

docs/importing_data.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ Importing Data
66
Importing Data in a Text File
77
-----------------------------
88

9-
The LNT importreport command will import data in a simple text file format. The
9+
The ``lnt importreport`` command will import data in a simple text file format. The
1010
command takes a space separated key value file and creates an LNT report file,
1111
which can be submitted to a LNT server. Example input file::
1212

13-
foo.exec 123
13+
foo.execution_time 123
1414
bar.size 456
1515
foo/bar/baz.size 789
1616

17-
The format is "test-name.metric", so exec and size are valid metrics for the
18-
test suite you are submitting to.
17+
The format is ``test-name.metric value``, so ``execution_time`` and ``size`` must be valid
18+
metrics for the test suite you are submitting to.
1919

2020
Example::
2121

22-
echo -n "foo.exec 25\nbar.score 24.2\nbar/baz.size 110.0\n" > results.txt
22+
echo -n "foo.execution_time 25\nbar.score 24.2\nbar/baz.size 110.0\n" > results.txt
2323
lnt importreport --machine=my-machine-name --order=1234 --testsuite=nts results.txt report.json
2424
lnt submit http://mylnt.com/db_default/submitRun report.json
2525

@@ -28,7 +28,7 @@ Example::
2828
LNT Report File Format
2929
----------------------
3030

31-
The lnt importreport tool is an easy way to import data into LNTs test format.
31+
The ``lnt importreport`` tool is an easy way to import data into LNT's test format.
3232
You can also create LNTs report data directly for additional flexibility.
3333

3434
First, make sure you've understood the underlying :ref:`concepts` used by LNT.

docs/intro.rst

Lines changed: 21 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -8,116 +8,38 @@ of two main parts, a web application for accessing and visualizing performance
88
data, and command line utilities to allow users to generate and submit test
99
results to the server.
1010

11-
The package was originally written for use in testing LLVM compiler
12-
technologies, but is designed to be usable for the performance testing of any
13-
software.
14-
15-
If you are an LLVM developer who is mostly interested in just using LNT to run
16-
the test-suite against some compiler, then you should fast forward to the
17-
:ref:`quickstart` or to the information on :ref:`tests`.
18-
19-
LNT uses a simple and extensible format for interchanging data between the test
20-
producers and the server; this allows the LNT server to receive and store data
21-
for a wide variety of applications.
11+
The package was originally written for use in testing LLVM compiler technologies,
12+
but is designed to be usable for the performance testing of any software. LNT uses
13+
a simple and extensible format for interchanging data between the test producers and
14+
the server; this allows the LNT server to receive and store data for a wide variety
15+
of applications.
2216

2317
Both the LNT client and server are written in Python, however the test data
2418
itself can be passed in one of several formats, including property lists and
2519
JSON. This makes it easy to produce test results from almost any language.
2620

21+
.. _installation:
2722

2823
Installation
2924
------------
3025

31-
If you are only interested in using LNT to run tests locally, see the
32-
:ref:`quickstart`.
33-
34-
If you want to run an LNT server, you will need to perform the following
35-
additional steps:
36-
37-
2. Create a new LNT installation::
38-
39-
lnt create path/to/install-dir
40-
41-
This will create the LNT configuration file, the default database, and a
42-
.wsgi wrapper to create the application. You can execute the generated app
43-
directly to run with the builtin web server, or use::
44-
45-
lnt runserver path/to/install-dir
46-
47-
which provides additional command line options. Neither of these servers is
48-
recommended for production use.
49-
50-
3. Edit the generated 'lnt.cfg' file if necessary, for example to:
51-
52-
a. Update the databases list.
53-
54-
b. Update the public URL the server is visible at.
55-
56-
c. Update the nt_emailer configuration.
57-
58-
4. Add the 'lnt.wsgi' app to your Apache configuration. You should set also
59-
configure the WSGIDaemonProcess and WSGIProcessGroup variables if not
60-
already done.
61-
62-
If running in a virtualenv you will need to configure that as well; see the
63-
`modwsgi wiki <http://code.google.com/p/modwsgi/wiki/VirtualEnvironments>`_.
64-
65-
For production servers, you should consider using a full DBMS like PostgreSQL.
66-
To create an LNT instance with PostgreSQL backend, you need to do this instead:
26+
You can install the latest stable release of LNT from PyPI. We recommend doing
27+
that from a virtual environment::
6728

68-
1. Create an LNT database in PostgreSQL, also make sure the user has
69-
write permission to the database::
29+
python3 -m venv .venv
30+
source .venv/bin/activate
31+
pip install llvm-lnt
7032

71-
CREATE DATABASE "lnt.db"
33+
This will install the client-side tools. If you want to run a production server,
34+
you should instead install ``llvm-lnt`` while including the server-side optional
35+
requirements::
7236

73-
2. Then create LNT installation::
37+
pip install "llvm-lnt[server]"
7438

75-
lnt create path/to/install-dir --db-dir postgresql://user@host
39+
That's it! ``lnt`` should now be accessible from the virtual environment.
7640

77-
3. Run server normally::
78-
79-
lnt runserver path/to/install-dir
80-
81-
Architecture
82-
------------
83-
84-
The LNT web app is currently implemented as a Flask WSGI web app, with Jinja2
85-
for the templating engine. My hope is to eventually move to a more AJAXy web
86-
interface.
87-
88-
The database layer uses SQLAlchemy for its ORM, and is typically backed by
89-
SQLite, although I have tested on MySQL on the past, and supporting other
90-
databases should be trivial. My plan is to always support SQLite as this allows
91-
the possibility of developers easily running their own LNT installation for
92-
viewing nightly test results, and to run with whatever DB makes the most sense
93-
on the server.
94-
95-
Running a LNT Server Locally
96-
----------------------------
97-
98-
LNT can accommodate many more users in the production config. In production:
99-
- Postgres or MySQL should be used as the database.
100-
- A proper wsgi server should be used, in front of a proxy like Nginx or Apache.
101-
102-
To install the extra packages for the server config::
103-
104-
virtualenv venv
105-
. ./venv/bin/activate
106-
pip install -r requirements.server.txt
107-
lnt create path/to/data_dir --db-dir postgresql://user@host # data_dir path will be where lnt data will go.
108-
cd deployment
109-
# Now edit app_wrapper.py to have your path/to/data_dir path and the log-file below.
110-
gunicorn app_wrapper:app --bind 0.0.0.0:8000 --workers 8 --timeout 300 --name lnt_server --log-file /var/log/lnt/lnt.log --access-logfile /var/log/lnt/gunicorn_access.log --max-requests 250000
111-
112-
113-
Running a LNT Server via Docker
114-
-------------------------------
115-
116-
We provide a Docker Compose setup with Docker containers that can be used to
117-
easily bring up a fully working production server within minutes. The container
118-
can be built and run with::
119-
120-
docker compose --file docker/compose.yaml --env-file <secrets> up
121-
122-
``<secrets>`` should be the path to a file containing environment variables
123-
required by the containers. Please refer to the Docker Compose file for details.
41+
If you are an LLVM developer who is mostly interested in just using LNT to run
42+
the test-suite against some compiler, then you should fast forward to the section
43+
on :ref:`running tests <tests>`. If you want to run your own LNT server, jump to
44+
the section on :ref:`running a server <running_server>`. Otherwise, jump to the
45+
:ref:`table of contents <contents>` to get started.

docs/quickstart.rst

Lines changed: 0 additions & 118 deletions
This file was deleted.

0 commit comments

Comments
 (0)