It’s used by our QA team and now it’s time for me to take a closer look on it to test one issue with our application running on a Kubernetes cluster.
In this post a short overview of its capabilities and configuration.
In contrast to the Apache Bench, Yandex.Tank displays response codes statistics and is much more simple in running and configuration the JMeter, plus it has a nice Autostop feature for a case when “Huston, we have a problem” (с)
The Yandex Tank core is written in Python.
For load testing, it has few modules – Load generators, by default it uses the Phantom written on С++, so it’s really fast.
The Telegraf tool is a monitoring module that can connect to a testing host via SSH to run its own agent to collect metrics about CPU/mem/etc which will be displayed in Yandex.Tank during load test in real-time.
Also, in the examples below I’ll not cover the “ammo” topic to create more complicated tests with POST, etc requests, as for me now will be enough simple GET requests. But you can find its documentation in the Preparing requests.
Running Yandex.Tank with Docker
Create a minimal config for Phantom:
phantom: address: rtfm.co.ua:443 header_http: "1.1" headers: - "[Host: rtfm.co.ua]" uris: - / load_profile: load_type: rps schedule: const(1,30s) ssl: true console: enabled: true telegraf: enabled: false
address: an address and port to the target
header_http: HTTP version used for requests, set it to the 1.1 to use persistent connections (see HTTP persistent connection)
headers: a set of headers to be passed to the target server
uris: list of URIs to make calls to
load_type: can be set to
rps: requests per second – set desirable requests per second to be issued to a testing host
instances: or set desirable active treads number, which will perform as much RPS as they can, see the Dynamic thread limit
schedule: can be set to
step(or all together) – defines load test profile, see the Tutorials:
const: is set as (load,dur), were load – RPS number, dur – load test duration, in the example above Yandex.Tank will run one request per second for 30 seconds
line: is set as (a,b,dur), where a – start number for RPS, b – final number, dur – load test duration, so RPS will be increased linearly from the a to the b values
step: is set as (a,b,step,dur), where a – start number for RPS, b – final number, step – how much requests will be added on each step after dur seconds
ssl: enable SSL support for HTTPS requests (add 443 port to the
console: display results to the console
telegraf: monitoring agent configuration, will be covered in the Monitoring (Telegraf)
Run Yandex.Tank with Docker:
By using the Telegraf Yandex.Tank can connect via SHS to the testing host to grab resources metrics on it.
Enable it in the
... telegraf: enabled: true package: yandextank.plugins.Telegraf
Metrics to be collected are described in a dedicated file, create it as
monitoring.xml, see more at Configuration file format:
<Monitoring> <Host address="rtfm.co.ua" interval="1" username="root"> <CPU /> <Kernel /> <Net /> <System /> <Memory /> <Disk /> <Netstat/> </Host> </Monitoring>
Here in the
address set the testing target to collect metrics from,
interval – how often get the metrics,
username – the SSH user to be used during connection by the Telegraf module.
This user in the target host must have an SSH key’s public part to be added to the
The private part of this key will be mounted to the Yandex.Tank Docker container as
/root/.ssh/id_rsa, as all process in the container are running under the
Paramiko: SSHException: not a valid RSA private key file
On the first run Telegraf failed with the Paramiko error:
It’s because the RSA key on DigitalOcean is issued in the PEM/OpenSSH format:
Convert it to the RSA:
And check again:
Run test again and Telegraf will print its configuration and metrics to be used:
After this, the load test will be started and on the right side you’ll see the resources used on the target server:
And the agent running on the server:
The Autostop module is used to terminate tests if something went wrong.
For example, you can configure it to stop the tests if 5[[ response rate will be higher than 10%, or if the response time will be greater than a specified value.
Add the following to check it:
... autostop: autostop: - http(2xx,100%,1s)
Here for example tests will be stopped once will get the 2xx response over 1 second.
Run the tests, and:
It was immediately stopped.
See more option in the documenation>>>.
load.yaml now is:
phantom: address: rtfm.co.ua:443 header_http: "1.1" headers: - "[Host: rtfm.co.ua]" uris: - / load_profile: load_type: rps schedule: const(1,30s) ssl: true console: enabled: true telegraf: enabled: true package: yandextank.plugins.Telegraf config: monitoring.xml autostop: autostop: - http(2xx,100%,1s)
All in Russian, unfortunately.
- Автоматизация нагрузочного тестирования при помощи инструмента Яндекс.Танк
- Нагрузочное тестирование c Yandex.Tank и JMeter
- Нагрузочное тестирование http-сервера (nginx), 205k+ RPS
- Тестирование в Яндексе: строим свой Лунапарк
- Пример нагрузочного тестирования сайта с Yandex.Tank
Also published on Medium.