This commit is contained in:
José Henrique Ivanchechen 2023-08-31 19:46:13 -03:00
parent 5199519634
commit 209275cce0
1 changed files with 8 additions and 4 deletions

View File

@ -14,7 +14,7 @@ if len(sys.argv) != 3 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
THREADS = 10
FRAMEWORK_NAME = sys.argv[1]
CONTAINER_NAME = sys.argv[2]
URL_BASE = 'http://172.26.48.1:9080'
URL_BASE = 'http://localhost:9080'
API_REQUESTS = [
('/status/ok', range(0, 30_000, 5000)),
('/image/load-image', range(0, 30_000, 5000)),
@ -80,12 +80,16 @@ def run_tests(endpoint, num_requests):
futures = []
#with requests.Session() as session:
# futures = [executor.submit(send_request, session, url) for _ in range(num_request)]
futures = [executor.submit(send_request, url) for _ in range(num_request)]
half = floor(num_request/2)
for i in range(num_request):
futures.append(executor.submit(send_request, url))
if i == half:
cpu, ram = get_resource_usage()
concurrent.futures.wait(futures)
cpu, ram = get_resource_usage()
elapsed_time = time.time() - start_time
for future in futures: