Yandex-tank tools
Project description
Yandex-tank prepare phout file with statistics after load testing. tanktools module helps to parse such files and convert to DataFrame. You can use pandas module in manual mode to handle DataFrame or use build-in functions.
So you can:
calc quantiles
get information about timings, latency, status codes
extract requests by timestamp, tag and other columns
group and analyze specific data like total/partial RPS, average request/response size
calc statistical metrics
Installation
pip install tanktools
Import
from tanktools import phout
Examples
Select DataFrame by timestamp
It is possible to parse a part of staistics by time and overal count
flags = {
'from_date': '2018-01-18 20:09:50.123',
'to_date' : '2018-01-18 20:10:00.456',
'limit': 100
}
data = phout.parse_phout(args.input, flags)
print("Total count: %d" % phout.size(data))
Total count: 100
Print percentiles
data = phout.parse_phout('phout.log')
phout.print_quantiles(data, 'receive_time')
Percentiles for 150030 requests
from 2018-01-18 20:09:42.983
to 2018-01-18 20:10:55.108:
quantile (%) receive_time (mks)
10.0 9
20.0 9
30.0 10
40.0 10
50.0 10
60.0 10
70.0 11
80.0 12
90.0 13
95.0 14
98.0 16
99.0 17
100.0 716
Print latency median
data = phout.parse_phout('phout.log')
# Convert and print timing in milliseconds
print("\n\nLatency median: %d ms" % int(data.latency.median() / 1000))
Latency median: 30 ms
Get RPS
data = phout.parse_phout('phout.log')
rps = phout.get_rps(data)
Print HTTP response statistics
data = phout.parse_phout('phout.log')
phout.print_http_reponses(data)
HTTP code count percent (%)
500 83429 56.38
200 61558 41.60
502 2944 1.99
0 41 0.03
Select 200 OK responses and print latency median
data = phout.parse_phout('phout.log')
selected_http_responses = data[data.proto_code == 200]
print("Latency median for 200 OK: %d" %
selected_http_responses.latency.median())
Latency median for 200 OK: 3539
Print average request/response size
print("Avg. Request / Response: %d / %d bytes" % (
data.size_in.astype(float).mean(),
data.size_out.astype(float).mean()
))
Avg. Request / Response: 364 / 26697 bytes
Print RPS at Nth request
print("RPS at request:")
chunk_size = int(phout.size(data) / 2)
for start in range(0, phout.size(data), chunk_size):
data_subset = phout.subset(data, start, chunk_size)
print("\t%s: %.2f" %
(start + chunk_size, phout.get_rps(data_subset)))
RPS at request:
73986: 2062.50
147972: 2530.56
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tanktools-1.0.2.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for tanktools-1.0.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7894db572c092be0ee273b3279abc82c655bda6c19cdfd31fca2f1e9f3a3db3 |
|
MD5 | 7adcd7e7cfc3c8b50eecb3e325d99ff3 |
|
BLAKE2b-256 | 2cd487d058d5d08594ac630ede70642a29347908b0674c5ab69182e6d3563c27 |