yandex / yandex-tank

Load and performance benchmark tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Information lost when response times are high

Alpherie opened this issue · comments

When the response times are high (15-20s), yandextank loses some of statistics. For example, tank had made 28 requests (according to logs), but only 22 are displayed in stats. Sometimes even more is lost, with 3-5 requests only displayed.

Version of tank: YandexTank/1.12.6

My log:
tmp_log.txt

My config:

overload:
  enabled: true
  package: yandextank.plugins.DataUploader
  token_file: "token.txt"
influx:
  enabled: true
  address: my.ip.0.1
  port: 8086
  database: base
  username: user
  password: pass
  histograms: true
  labeled: true
  tank_tag: test
phantom:
  enabled: false
bfg:
  enabled: true
  ammofile: python_tests/ammores.txt
  instances: 32
  gun_config:
    class_name: LoadTest
    module_path: ./python_tests/
    module_name: test
    init_param: Not used
    address: http://127.0.0.1:8888
  gun_type: ultimate
  load_profile:
    load_type: rps
    schedule: const(8,1s) const(1, 20s)
  loop: 256
console:
  enabled: false

Some more info, that may be useful:
My python code for bfg:

# -*- coding: utf-8 -*-

import os
import json
import logging
log = logging.getLogger(__name__)

import requests as r

class LoadTest(object):
    def __init__(self, gun):
        self.gun = gun
        self.addr = self.gun.get_option("address")

    def case1(self, missile):
        with self.gun.measure('test') as m:
            try:
                res = r.post(self.addr)
            except r.exceptions.Timeout:
                m['proto_code'] = 601
            except Exception:
                m['proto_code'] = 602
            else:
                m['proto_code'] = res.status_code
        try:
            log.info(res.content)
        except Exception:
            log.info('Error!!!')
        

    def setup(self, param):
        ''' this will be executed in each worker before the test starts '''
        pass

    def teardown(self):
        ''' this will be executed in each worker after the end of the test '''
        os._exit(0)
        return 0

Test target I made for this problem (python3):

import time
import datetime
import random

import tornado.ioloop
import tornado.web
import tornado.locks

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

    @tornado.web.asynchronous
    async def post(self):
        condition = tornado.locks.Condition()
        await condition.wait(datetime.timedelta(seconds=random.randint(10, 20)))
        self.write('Test answer')

def make_app():
    return tornado.web.Application([
        (r"/.*", MainHandler),
    ])

if __name__ == "__main__":
    print('Started')
    app = make_app()
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()