merge doc changes from master

This commit is contained in:
Alexey Lavrenuke 2016-02-17 19:18:47 +03:00
parent 8b7989c764
commit 3da082551c
6 changed files with 1607 additions and 906 deletions

View File

@ -42,7 +42,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Yandex.Tank' project = u'Yandex.Tank'
copyright = u'2015, Yandex' copyright = u'2016, Yandex'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -242,7 +242,7 @@ texinfo_documents = [
epub_title = u'Yandex.Tank' epub_title = u'Yandex.Tank'
epub_author = u'Yandex' epub_author = u'Yandex'
epub_publisher = u'Yandex' epub_publisher = u'Yandex'
epub_copyright = u'2015, Yandex' epub_copyright = u'2016, Yandex'
# The language of the text. It defaults to the language option # The language of the text. It defaults to the language option
# or en if the language is not set. # or en if the language is not set.

File diff suppressed because it is too large Load Diff

1403
docs/core_and_modules.rst Normal file

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ Contents:
install install
tutorial tutorial
configuration configuration
core_and_modules
Indices and tables Indices and tables

View File

@ -28,7 +28,7 @@ Remember that if you want to use phantom as a load generator you should install
sudo add-apt-repository ppa:yandex-load/main && sudo apt-get update sudo add-apt-repository ppa:yandex-load/main && sudo apt-get update
sudo apt-get install phantom phantom-ssl sudo apt-get install phantom phantom-ssl
Report plugin is a distinct project. You can found it `here via github <https://github.com/yandex-load/yatank-online>>`_ Report plugin is a distinct project. You can found it `here via github <https://github.com/yandex-load/yatank-online>`_
Installation, .deb packages Installation, .deb packages

View File

@ -4,7 +4,9 @@ Usage
So, you've installed Yandex.Tank to a proper machine, it is close to target, So, you've installed Yandex.Tank to a proper machine, it is close to target,
access is permitted and server is tuned. How to make a test? access is permitted and server is tuned. How to make a test?
This guide is for ``phantom`` load generator. .. note::
This guide is for ``phantom`` load generator.
First Steps First Steps
~~~~~~~~~~~ ~~~~~~~~~~~
@ -28,8 +30,11 @@ values, step - increment value, dur - step duration.
3. ``const (load,dur)`` makes constant load. ``load`` - rps amount, ``dur`` 3. ``const (load,dur)`` makes constant load. ``load`` - rps amount, ``dur``
- load duration. You can set fractional load like this: ``line(1.1, 2.5, 10)`` - load duration. You can set fractional load like this: ``line(1.1, 2.5, 10)``
-- from 1.1rps to 2.5 for 10 seconds. Note: ``const(0, 10)`` - 0 rps for 10 seconds, -- from 1.1rps to 2.5 for 10 seconds.
in fact 10s pause in a test.
.. note::
``const(0, 10)`` - 0 rps for 10 seconds,
in fact 10s pause in a test.
``step`` and ``line`` could be used with increasing and decreasing ``step`` and ``line`` could be used with increasing and decreasing
intensity: intensity:
@ -79,10 +84,11 @@ large files will be readed from stream.
address=203.0.113.1 ; Target's address address=203.0.113.1 ; Target's address
ammofile=https://yourhost.tld/path/to/ammofile.txt ammofile=https://yourhost.tld/path/to/ammofile.txt
If ammo type is uri-style or request-style, tank will try to guess it. .. note::
Use ``ammo_type`` option to explicitly specify ammo format. Don't forget to change ``ammo_type`` option If ammo type is uri-style or request-style, tank will try to guess it.
if you switch format of your ammo, otherwise you might get errors. Use ``ammo_type`` option to explicitly specify ammo format. Don't forget to change ``ammo_type`` option
if you switch format of your ammo, otherwise you might get errors.
Access mode Access mode
'''''''''''' ''''''''''''
@ -125,7 +131,10 @@ Update configuration file with HTTP headers and URIs:
/sdfbv/swdfvs/ssfsf /sdfbv/swdfvs/ssfsf
Parameter ``uris`` contains uri, which should be used for requests generation. Parameter ``uris`` contains uri, which should be used for requests generation.
Pay attention to sample above, because whitespaces in ``uris`` and ``headers`` options are important.
.. note::
Pay attention to sample above, because whitespaces in ``uris`` and ``headers`` options are important.
URI-style, URIs in file URI-style, URIs in file
''''''''''''''''''''''' '''''''''''''''''''''''
@ -199,22 +208,24 @@ where ``size_of_request`` request size in bytes. '\r\n' symbols after
include them in a file after each request. Pay attention to the sample above include them in a file after each request. Pay attention to the sample above
because '\r' symbols are strictly required. because '\r' symbols are strictly required.
Parameter ``ammo_type`` is unnecessary, request-style is default ammo type. .. note::
Parameter ``ammo_type`` is unnecessary, request-style is default ammo type.
**sample GET requests (null body)** **sample GET requests (null body)**
:: ::
73 good 73 good
GET / HTTP/1.0 GET / HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
User-Agent: xxx (shell 1) User-Agent: xxx (shell 1)
77 bad 77 bad
GET /abra HTTP/1.0 GET /abra HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
User-Agent: xxx (shell 1) User-Agent: xxx (shell 1)
78 unknown 78 unknown
GET /ab ra HTTP/1.0 GET /ab ra HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
@ -255,18 +266,18 @@ Parameter ``ammo_type`` is unnecessary, request-style is default ammo type.
Content-Type: multipart/form-data; boundary=AGHTUNG Content-Type: multipart/form-data; boundary=AGHTUNG
Content-Length:334 Content-Length:334
Connection: Close Connection: Close
--AGHTUNG --AGHTUNG
Content-Disposition: form-data; name="host" Content-Disposition: form-data; name="host"
load-test-shop-updatestatus.ru load-test-shop-updatestatus.ru
--AGHTUNG --AGHTUNG
Content-Disposition: form-data; name="user_id" Content-Disposition: form-data; name="user_id"
1 1
--AGHTUNG --AGHTUNG
Content-Disposition: form-data; name="wsw-fields" Content-Disposition: form-data; name="wsw-fields"
<wsw-fields><wsw-field name="moderate-code"><wsw-value>disable</wsw-value></wsw-field></wsw-fields> <wsw-fields><wsw-field name="moderate-code"><wsw-value>disable</wsw-value></wsw-field></wsw-fields>
--AGHTUNG-- --AGHTUNG--
@ -335,6 +346,58 @@ Line format: ``GET||/url||case_tag||body(optional)``
if __name__ == "__main__": if __name__ == "__main__":
main() main()
**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! Run Test!
~~~~~~~~~ ~~~~~~~~~
@ -372,12 +435,12 @@ requests and tags:
GET / HTTP/1.0 GET / HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
User-Agent: xxx (shell 1) User-Agent: xxx (shell 1)
77 bad 77 bad
GET /abra HTTP/1.0 GET /abra HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
User-Agent: xxx (shell 1) User-Agent: xxx (shell 1)
75 unknown 75 unknown
GET /ab HTTP/1.0 GET /ab HTTP/1.0
Host: xxx.tanks.example.com Host: xxx.tanks.example.com
@ -413,7 +476,9 @@ HTTP and Net codes conditions
There is an option to define specific codes (404,503,100) as well as code There is an option to define specific codes (404,503,100) as well as code
groups (3xx, 5xx, xx). Also you can define relative threshold (percent groups (3xx, 5xx, xx). Also you can define relative threshold (percent
from the whole amount of answer per second) or absolute (amount of from the whole amount of answer per second) or absolute (amount of
answers with specified code per second). Examples: answers with specified code per second).
Examples:
* ``autostop = http(4xx,25%,10)`` stop test, if amount of 4xx http codes * ``autostop = http(4xx,25%,10)`` stop test, if amount of 4xx http codes
in every second of last 10s period exceeds 25% of answers (relative in every second of last 10s period exceeds 25% of answers (relative
@ -481,8 +546,8 @@ Example:
User-Agent: tank User-Agent: tank
Accept: */* Accept: */*
Connection: close Connection: close
HTTP/1.1 200 OK HTTP/1.1 200 OK
Content-Type: application/javascript;charset=UTF-8 Content-Type: application/javascript;charset=UTF-8
@ -592,7 +657,9 @@ parser could be switched off, providing ability to generate load with
any data, receiving any answer in return. To do that add any data, receiving any answer in return. To do that add
``tank_type = 2`` to ``load.ini``. ``tank_type = 2`` to ``load.ini``.
**Indispensable condition: Connection close must be initiated by remote side** .. note::
**Indispensable condition: Connection close must be initiated by remote side**
:: ::