yandex-tank/docs/configuration.rst

234 lines
5.0 KiB
ReStructuredText
Raw Normal View History

2016-02-17 14:00:48 +00:00
==================
2012-10-16 12:18:10 +00:00
Advanced usage
2016-02-17 14:00:48 +00:00
==================
2012-10-16 12:18:10 +00:00
Command line options
2016-02-17 15:14:43 +00:00
============================
2012-10-16 12:18:10 +00:00
Yandex.Tank has an obviously named executable ``yandex-tank``.
Here are available command line options:
2016-02-17 15:14:43 +00:00
:-h, --help:
2016-02-17 12:57:35 +00:00
show command line options
2016-02-17 15:14:43 +00:00
:-c CONFIG, --config=CONFIG:
Read options from INI file.
It is possible to set multiple INI files by specifying the option serveral times.
Default: ``./load.ini``
:-i, --ignore-lock:
2016-02-17 14:00:48 +00:00
Ignore lock files.
2016-02-17 15:14:43 +00:00
:-f, --fail-lock:
2016-02-17 14:00:48 +00:00
Don't wait for lock file, quit if it's busy.
2016-02-17 15:14:43 +00:00
Default behaviour is to wait for lock file to become free
:-l LOG, --log=LOG:
2016-02-17 14:00:48 +00:00
Main log file location.
2016-02-17 15:14:43 +00:00
Default: ``./tank.log``
:-m, --manual-start:
2016-02-17 14:00:48 +00:00
Tank will prepare for test and wait for Enter key to start the test.
2016-02-17 15:14:43 +00:00
:-n, --no-rc:
2016-02-17 14:00:48 +00:00
Don't read ``/etc/yandex-tank/*.ini`` and ``~/.yandex-tank``
2016-02-17 15:14:43 +00:00
:-o OPTION, --option=OPTION:
Set an option from command line.
Options set in cmd line override those have been set in configuration files. Multiple times for multiple options.
2016-02-17 14:13:27 +00:00
2016-02-17 14:00:48 +00:00
Format: ``<section>.<option>=value``
2016-02-17 14:13:27 +00:00
2016-02-17 14:00:48 +00:00
Example: ``yandex-tank -o "console.short_only=1" --option="phantom.force_stepping=1"``
2016-02-17 15:14:43 +00:00
:-s SCHEDULED_START, --scheduled-start=SCHEDULED_START:
2016-02-17 14:00:48 +00:00
Run test on specified time, date format YYYY-MM-DD hh:mm:ss or hh:mm:ss
2016-02-17 15:14:43 +00:00
:-q, --quiet:
2016-02-17 14:00:48 +00:00
Only print WARNINGs and ERRORs to console.
2016-02-17 15:14:43 +00:00
:-v, --verbose:
2016-02-17 14:00:48 +00:00
Print ALL, including DEBUG, messages to console. Chatty mode.
2012-10-16 12:18:10 +00:00
2016-02-17 15:14:43 +00:00
2012-10-16 12:18:10 +00:00
Add an ammo file name as a nameless parameter, e.g.:
``yandex-tank ammo.txt`` or ``yandex-tank ammo.gz``
2012-10-16 12:18:10 +00:00
Advanced configuration
2016-02-17 15:14:43 +00:00
============================
2012-10-16 12:18:10 +00:00
Configuration files organized as standard INI files. Those are files
2016-02-17 14:00:48 +00:00
partitioned into named sections that contain 'name=value' records.
2016-02-17 14:00:48 +00:00
Example:
::
2016-02-17 15:14:43 +00:00
2016-02-17 14:00:48 +00:00
[phantom]
address=example.com:80
rps_schedule=const(100,60s)
[autostop]
autostop=instances(80%,10)
2016-02-17 14:00:48 +00:00
.. note::
A common rule: options with the
same name override those set before them (in the same file or not).
2012-10-16 12:18:10 +00:00
Default configuration files
2016-02-17 15:14:43 +00:00
--------------------------------
2012-10-16 12:18:10 +00:00
If no ``--no-rc`` option passed, Yandex.Tank reads all ``*.ini`` from
2016-02-17 14:00:48 +00:00
``/etc/yandex-tank`` directory, then a personal config file ``~/.yandex-tank``.
So you can easily put your favourite settings in ``~/.yandex-tank``
2016-02-17 14:13:27 +00:00
Example: ``tank.artifacts_base_dir``, ``phantom.cache_dir``, ``console.info_panel_width``
2012-10-16 12:18:10 +00:00
The ``DEFAULT`` section
2016-02-17 15:14:43 +00:00
--------------------------------
2012-10-16 12:18:10 +00:00
One can use a **magic** ``DEFAULT`` section, that contains global
options. Those options are in charge for every section:
2012-10-16 12:18:10 +00:00
::
2016-02-17 15:14:43 +00:00
[autostop]
autostop=time(1,10)
[console]
short_only=1
[meta]
job_name=ask
2012-10-16 12:18:10 +00:00
is an equivalent for:
2012-10-16 12:18:10 +00:00
::
2016-02-17 15:14:43 +00:00
[DEFAULT]
autostop=time(1,10)
short_only=1
job_name=ask
2016-02-17 14:00:48 +00:00
.. note::
Don't use global options wich have same name in different sections.
2012-10-16 12:18:10 +00:00
Multiline options
2016-02-17 15:14:43 +00:00
--------------------------------
2012-10-16 12:18:10 +00:00
Use indent to show that a line is a continuation of a previous one:
::
2016-02-17 15:14:43 +00:00
[autostop]
autostop=time(1,10)
http(404,1%,5s)
net(xx,1,30)
2016-02-17 14:00:48 +00:00
.. note::
Ask Yandex.Tank developers to add multiline capability for options
where you need it!*
2012-10-16 12:18:10 +00:00
Referencing one option to another
2016-02-17 15:14:43 +00:00
-----------------------------------
2016-02-17 14:13:27 +00:00
``%(optname)s`` gives you ability to reference from option to another. It helps to reduce duplication.
2016-02-17 14:13:27 +00:00
Example:
2016-02-17 15:14:43 +00:00
::
2016-02-17 15:14:43 +00:00
[DEFAULT]
host=target12.load.net
2016-02-17 14:00:48 +00:00
[phantom]
2014-03-05 12:53:55 +00:00
address=%(host)s
port=8080
[monitoring]
default_target=%(host)s
[shellexec]
prepare=echo Target is %(host)s
2012-10-16 12:18:10 +00:00
Time units
2016-02-17 15:14:43 +00:00
--------------------------------
2012-10-16 12:18:10 +00:00
2016-02-17 14:00:48 +00:00
*Default* : milliseconds.
2012-10-16 12:18:10 +00:00
2016-02-17 14:00:48 +00:00
Example:
2016-02-17 15:14:43 +00:00
2016-02-17 14:00:48 +00:00
::
2016-02-17 15:14:43 +00:00
2016-02-17 14:00:48 +00:00
``30000 == 30s``
``time(30000,120)`` is an equivalent to ``time(30s,2m)``
2016-02-17 14:00:48 +00:00
Time units encoding is as following:
2016-02-17 14:13:27 +00:00
============= =======
Abbreviation Meaning
============= =======
ms millisecons
s seconds
m minutes
h hours
============= =======
2016-02-17 14:00:48 +00:00
.. note::
You can also mix them: ``1h30m15s`` or ``2s15ms``.
Shell-options
2016-02-17 15:14:43 +00:00
---------------------
2016-02-17 14:00:48 +00:00
Option value with backquotes is evaluated in shell.
2016-02-17 14:00:48 +00:00
Example:
2016-02-17 15:14:43 +00:00
::
2016-02-17 15:14:43 +00:00
2016-02-17 14:00:48 +00:00
[meta]
job_name=`pwd`
2012-10-16 12:18:10 +00:00
Artifacts
2016-02-17 14:00:48 +00:00
================
2012-10-16 12:18:10 +00:00
As a result Yandex.Tank produces some files (logs, results, configs
etc). Those files are placed with care to the **artifact directory**. An
option for that is ``artifacts_base_dir`` in the ``tank`` section. It is
recommended to set it to a convenient place, for example,
``~/yandex-tank-artifacts``; it would be easier to manage the artifacts
2012-10-16 12:18:10 +00:00
there.
Sources
2016-02-17 14:00:48 +00:00
================
2012-10-16 12:18:10 +00:00
Yandex.Tank sources are `here <https://github.com/yandex-load/yandex-tank>`_.
2012-10-16 12:18:10 +00:00
2013-10-30 04:50:32 +00:00
load.ini example
2016-02-17 14:00:48 +00:00
================
2012-10-16 12:18:10 +00:00
::
2013-10-25 09:52:27 +00:00
;Yandex.Tank config file
[phantom]
;Target's address and port
address=fe80::200:f8ff:fe21:67cf
port=8080
instances=1000
;Load scheme
rps_schedule=const(1,30) line(1,1000,2m) const(1000,5m)
; Headers and URIs for GET requests
2012-10-16 12:18:10 +00:00
header_http = 1.1
2013-10-25 09:52:27 +00:00
uris=/
/test
/test2
headers=[Host: www.ya.ru]
[Connection: close]
[autostop] autostop = http(5xx,10%,5s)
2012-10-16 12:18:10 +00:00
2013-10-30 04:50:32 +00:00