mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 02:15:22 +00:00
merge doc changes from master
This commit is contained in:
parent
8b7989c764
commit
3da082551c
@ -42,7 +42,7 @@ master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
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
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
@ -242,7 +242,7 @@ texinfo_documents = [
|
||||
epub_title = u'Yandex.Tank'
|
||||
epub_author = 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
|
||||
# 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
1403
docs/core_and_modules.rst
Normal file
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,7 @@ Contents:
|
||||
install
|
||||
tutorial
|
||||
configuration
|
||||
core_and_modules
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
@ -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 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
|
||||
|
@ -4,7 +4,9 @@ Usage
|
||||
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?
|
||||
|
||||
This guide is for ``phantom`` load generator.
|
||||
.. note::
|
||||
|
||||
This guide is for ``phantom`` load generator.
|
||||
|
||||
First Steps
|
||||
~~~~~~~~~~~
|
||||
@ -28,8 +30,11 @@ values, step - increment value, dur - step duration.
|
||||
|
||||
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)``
|
||||
-- from 1.1rps to 2.5 for 10 seconds. Note: ``const(0, 10)`` - 0 rps for 10 seconds,
|
||||
in fact 10s pause in a test.
|
||||
-- from 1.1rps to 2.5 for 10 seconds.
|
||||
|
||||
.. 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
|
||||
intensity:
|
||||
@ -79,10 +84,11 @@ large files will be readed from stream.
|
||||
address=203.0.113.1 ; Target's address
|
||||
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 you switch format of your ammo, otherwise you might get errors.
|
||||
If ammo type is uri-style or request-style, tank will try to guess it.
|
||||
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
|
||||
''''''''''''
|
||||
@ -125,7 +131,10 @@ Update configuration file with HTTP headers and URIs:
|
||||
/sdfbv/swdfvs/ssfsf
|
||||
|
||||
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
|
||||
'''''''''''''''''''''''
|
||||
@ -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
|
||||
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)**
|
||||
|
||||
::
|
||||
|
||||
|
||||
73 good
|
||||
GET / HTTP/1.0
|
||||
Host: xxx.tanks.example.com
|
||||
User-Agent: xxx (shell 1)
|
||||
|
||||
|
||||
77 bad
|
||||
GET /abra HTTP/1.0
|
||||
Host: xxx.tanks.example.com
|
||||
User-Agent: xxx (shell 1)
|
||||
|
||||
|
||||
78 unknown
|
||||
GET /ab ra HTTP/1.0
|
||||
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-Length:334
|
||||
Connection: Close
|
||||
|
||||
|
||||
--AGHTUNG
|
||||
Content-Disposition: form-data; name="host"
|
||||
|
||||
|
||||
load-test-shop-updatestatus.ru
|
||||
--AGHTUNG
|
||||
Content-Disposition: form-data; name="user_id"
|
||||
|
||||
|
||||
1
|
||||
--AGHTUNG
|
||||
Content-Disposition: form-data; name="wsw-fields"
|
||||
|
||||
|
||||
<wsw-fields><wsw-field name="moderate-code"><wsw-value>disable</wsw-value></wsw-field></wsw-fields>
|
||||
--AGHTUNG--
|
||||
|
||||
@ -335,6 +346,58 @@ Line format: ``GET||/url||case_tag||body(optional)``
|
||||
if __name__ == "__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!
|
||||
~~~~~~~~~
|
||||
|
||||
@ -372,12 +435,12 @@ requests and tags:
|
||||
GET / HTTP/1.0
|
||||
Host: xxx.tanks.example.com
|
||||
User-Agent: xxx (shell 1)
|
||||
|
||||
|
||||
77 bad
|
||||
GET /abra HTTP/1.0
|
||||
Host: xxx.tanks.example.com
|
||||
User-Agent: xxx (shell 1)
|
||||
|
||||
|
||||
75 unknown
|
||||
GET /ab HTTP/1.0
|
||||
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
|
||||
groups (3xx, 5xx, xx). Also you can define relative threshold (percent
|
||||
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
|
||||
in every second of last 10s period exceeds 25% of answers (relative
|
||||
@ -481,8 +546,8 @@ Example:
|
||||
User-Agent: tank
|
||||
Accept: */*
|
||||
Connection: close
|
||||
|
||||
|
||||
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
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
|
||||
``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**
|
||||
|
||||
::
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user