mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 02:15:22 +00:00
Merge pull request #267 from netortik/master
Documentation update: timeout/ammo genearators
This commit is contained in:
commit
64b68c663e
@ -102,9 +102,13 @@ Line format: ``GET||/url||case_tag||body(optional)``
|
||||
|
||||
if __name__ == "__main__":
|
||||
#usage sample below
|
||||
#target's hostname and port
|
||||
#this will be resolved to IP for TCP connection
|
||||
host = 'test.host.ya.ru'
|
||||
port = '8080'
|
||||
namespace = '/some/path'
|
||||
#below you should specify or able to operate with
|
||||
#virtual server name on your target
|
||||
headers = {
|
||||
'Host': 'ya.ru'
|
||||
}
|
||||
@ -113,7 +117,9 @@ Line format: ``GET||/url||case_tag||body(optional)``
|
||||
'apikey': '123'
|
||||
}
|
||||
files = {
|
||||
'file': open('./testfile', 'rb')
|
||||
# name, path_to_file, content-type, additional headers
|
||||
'file': ('image.jpeg', open('./imagex.jpeg', 'rb'), 'image/jpeg ', {'Expires': '0'})
|
||||
}
|
||||
|
||||
print post_multipart(host, port, namespace, files, headers, payload)
|
||||
|
||||
|
@ -100,9 +100,6 @@ options. Those options are in charge for every section:
|
||||
[console]
|
||||
short_only=1
|
||||
|
||||
[aggregator]
|
||||
time_periods=10 20 30 100
|
||||
|
||||
[meta]
|
||||
job_name=ask
|
||||
|
||||
@ -113,7 +110,6 @@ is an equivalent for:
|
||||
[DEFAULT]
|
||||
autostop=time(1,10)
|
||||
short_only=1
|
||||
time_periods=10 20 30 100
|
||||
job_name=ask
|
||||
|
||||
.. note::
|
||||
|
@ -168,10 +168,22 @@ Additional options
|
||||
:ssl:
|
||||
Enable SSL.
|
||||
|
||||
Default: 0.
|
||||
Default: 0.
|
||||
|
||||
Available options: 1 - enable, 0 - disable.
|
||||
|
||||
:timeout:
|
||||
Response timeout.
|
||||
|
||||
Default: ``11s``.
|
||||
|
||||
.. note::
|
||||
Default multiplier is ``seconds``. If you specify ``10``, timeout will be 10 seconds.
|
||||
Currently we support here multipliers: 'd' for days, 'h' for hours, 'm' for minutes, 's' for seconds
|
||||
Examples:
|
||||
``0.1s`` is 100 milliseconds.
|
||||
``1m`` for 1 minute.
|
||||
|
||||
:address:
|
||||
Address of target.
|
||||
|
||||
@ -384,6 +396,7 @@ Example:
|
||||
address=fe80::200:f8ff:fe21:67cf
|
||||
port=8080
|
||||
ssl=1
|
||||
timeout=15
|
||||
instances=3
|
||||
gatling_ip=127.0.0.1 127.0.0.2
|
||||
phantom_http_line=123M
|
||||
@ -1150,17 +1163,12 @@ INI file section: **[aggregator]**
|
||||
Options
|
||||
-------
|
||||
|
||||
:time_periods:
|
||||
time intervals list divided by zero.
|
||||
|
||||
Default: ``1ms 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 150 200 250 300 350 400 450 500 600 650 700 750 800 850 900 950 1s 1500 2s 2500 3s 3500 4s 4500 5s 5500 6s 6500 7s 7500 8s 8500 9s 9500 10s 11s``
|
||||
|
||||
:precise_cumulative:
|
||||
Controls the accuracy of cumulative percentile. When disabled, cumulative percentiles are calculated with ``time_periods`` precision, otherwise - up to milliseconds.
|
||||
|
||||
:verbose_histogram:
|
||||
Controls the accuracy of cumulative percentile.
|
||||
|
||||
Available options: 0/1.
|
||||
|
||||
Default: ``1``.
|
||||
Default: ``0``.
|
||||
|
||||
|
||||
ShellExec
|
||||
|
@ -330,57 +330,6 @@ because '\r' symbols are strictly required.
|
||||
sample ammo generators you may find on the :doc:`ammo_generators` page.
|
||||
|
||||
|
||||
**sample POST multipart form-data generator (python)**
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
|
||||
def print_request(request):
|
||||
req = "{method} {path_url} HTTP/1.1\r\n{headers}\r\n{body}".format(
|
||||
method = request.method,
|
||||
path_url = request.path_url,
|
||||
headers = ''.join('{0}: {1}\r\n'.format(k, v) for k, v in request.headers.items()),
|
||||
body = request.body or "",
|
||||
)
|
||||
return "{req_size}\n{req}\r\n".format(req_size = len(req), req = req)
|
||||
|
||||
#POST multipart form data
|
||||
def post_multipart(host, port, namespace, files, headers, payload):
|
||||
req = requests.Request(
|
||||
'POST',
|
||||
'https://{host}:{port}{namespace}'.format(
|
||||
host = host,
|
||||
port = port,
|
||||
namespace = namespace,
|
||||
),
|
||||
headers = headers,
|
||||
data = payload,
|
||||
files = files
|
||||
)
|
||||
prepared = req.prepare()
|
||||
return print_request(prepared)
|
||||
|
||||
if __name__ == "__main__":
|
||||
#usage sample below
|
||||
host = 'test.host.ya.ru'
|
||||
port = '8080'
|
||||
namespace = '/some/path'
|
||||
headers = {
|
||||
'Host': 'ya.ru'
|
||||
}
|
||||
payload = {
|
||||
'langName': 'en',
|
||||
'apikey': '123'
|
||||
}
|
||||
files = {
|
||||
'file': open('./testfile', 'rb')
|
||||
}
|
||||
|
||||
print post_multipart(host, port, namespace, files, headers, payload)
|
||||
|
||||
|
||||
Run Test!
|
||||
=========
|
||||
@ -581,10 +530,10 @@ Use `Report plugin <https://github.com/yandex-load/yatank-online>`_
|
||||
OR
|
||||
use your favorite stats packet, R, for example.
|
||||
|
||||
Custom timings
|
||||
Precise timings
|
||||
==============
|
||||
|
||||
You can set custom timings in ``load.ini`` with ``time_periods``
|
||||
You can set precise timings in ``load.ini`` with ``verbose_histogram``
|
||||
parameter like this:
|
||||
|
||||
::
|
||||
@ -594,9 +543,12 @@ parameter like this:
|
||||
port=80 ;target's port
|
||||
rps_schedule=const(10, 10m) ;load scheme
|
||||
[aggregator]
|
||||
time_periods = 10 45 50 100 150 300 500 1s 1500 2s 3s 10s ; the last value - 10s is considered as connect timeout.
|
||||
verbose_histogram = 1
|
||||
|
||||
.. note::
|
||||
Please keep an eye, last value of `time_periods` is no longer used as response timeout
|
||||
Use phantom.timeout option.
|
||||
|
||||
According to this "buckets", tanks' aggregator will aggregate test results.
|
||||
|
||||
Thread limit
|
||||
============
|
||||
|
Loading…
Reference in New Issue
Block a user