From 5093aadd306ebe7bfd1fa337159ff979722d9bee Mon Sep 17 00:00:00 2001 From: kakwa Date: Thu, 8 Sep 2016 20:44:28 +0200 Subject: [PATCH] adding a small stress script --- tests/stress.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/stress.py diff --git a/tests/stress.py b/tests/stress.py new file mode 100644 index 0000000..bc8494b --- /dev/null +++ b/tests/stress.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import httplib +import time +import os + +tsq_path = os.path.join(os.path.dirname(__file__),'example.tsq') + +with open(tsq_path) as f: + body = f.read() + + +counter=0 +old_time = time.time() +while True: + h1 = httplib.HTTPConnection('localhost:2020') + h1.request('POST', '/', body, {"Content-Type": "application/timestamp-query"}) + response = h1.getresponse() + h1.close() + counter += 1 + if counter % 10000 == 0: + new_time = time.time() + print( str(int(10000 / (new_time - old_time))) + " req/s (10000 requests in " + str(new_time - old_time) + " seconds)") + old_time = time.time()