Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test_files/compare_container_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TestFields:
failed_requests: str = "failed_requests"
rps: str = "rps"
time_mean: str = "time_mean"
non_2xx: str = "non-2xx-responses"


def get_field_from_container_name(name, pos:int = 1):
Expand Down Expand Up @@ -169,6 +170,12 @@ def run(self):
self.ab_raw_results = _ab_runner.ab_results

def get_results(self):
non_2xx = self.ab_raw_results.get(TestFields.non_2xx) or 0
assert not non_2xx, (
f"{non_2xx} non-2xx responses from {self.uri} on port {self.port}. "
f"The measurement is not hitting the endpoint: FastAPI answers 307 "
f"when the trailing slash of the route is missing from the URL."
)
_return = {}
for key in [TestFields.time_mean, TestFields.rps, TestFields.failed_requests]:
_return[key] = self.ab_raw_results.get(key)
Expand Down
8 changes: 4 additions & 4 deletions test_files/test_combo_best_worst.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ class TestComboBestWorst(TestBase):
def test_combo_sync_big_json_best_vs_worst(self):
test_config = []
for container in worst_config.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 500
test_config.append(container)
for container in best_config.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 500
test_config.append(container)
p = CompareContainers(test_config)
Expand All @@ -32,11 +32,11 @@ def test_combo_sync_big_json_best_vs_worst(self):
def test_combo_async_big_json_best_vs_worst(self):
test_config = []
for container in worst_config.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 500
test_config.append(container)
for container in best_config.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 500
test_config.append(container)
p = CompareContainers(test_config)
Expand Down
4 changes: 2 additions & 2 deletions test_files/test_gunicorn_vs_uvicorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_gunicorn_vs_uvicorn_sync_w1(self):
def test_gunicorn_vs_uvicorn_async_w1(self):
async_test_config = []
for container in test_config_w1.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -43,7 +43,7 @@ def test_gunicorn_vs_uvicorn_sync_w2(self):
def test_gunicorn_vs_uvicorn_async_w2(self):
async_test_config = []
for container in test_config_w2.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand Down
6 changes: 3 additions & 3 deletions test_files/test_keepalive.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def testnginx_socker_keepalive_sync(self):
def test_nginx_socker_keepalive_async(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -31,7 +31,7 @@ def test_nginx_socker_keepalive_async(self):
def test_nginx_socker_keepalive_sync_big_json_response(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -43,7 +43,7 @@ def test_nginx_socker_keepalive_sync_big_json_response(self):
def test_nginx_socker_keepalive_async_big_json_response(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand Down
42 changes: 21 additions & 21 deletions test_files/test_nginx_port_vs_socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def testnginx_port_vs_socket_sync(self):
def test_nginx_port_vs_socket_async(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -63,7 +63,7 @@ def test_nginx_port_vs_socket_async(self):
def test_nginx_port_vs_socket_sync_big_json_response(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -75,7 +75,7 @@ def test_nginx_port_vs_socket_sync_big_json_response(self):
def test_nginx_port_vs_socket_async_big_json_response(self):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -94,7 +94,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w1t0(self):
def test_nginx_port_vs_socket_async_gunicorn_w1t0(self):
async_test_config = []
for container in test_config_gunicorn_w1t0.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -105,7 +105,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w1t0(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t0(self):
async_test_config = []
for container in test_config_gunicorn_w1t0.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -117,7 +117,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t0(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w1t0(self):
async_test_config = []
for container in test_config_gunicorn_w1t0.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -136,7 +136,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w2t0(self):
def test_nginx_port_vs_socket_async_gunicorn_w2t0(self):
async_test_config = []
for container in test_config_gunicorn_w2t0.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -147,7 +147,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w2t0(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t0(self):
async_test_config = []
for container in test_config_gunicorn_w2t0.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -159,7 +159,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t0(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w2t0(self):
async_test_config = []
for container in test_config_gunicorn_w2t0.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -178,7 +178,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w1t1(self):
def test_nginx_port_vs_socket_async_gunicorn_w1t1(self):
async_test_config = []
for container in test_config_gunicorn_w1t1.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -189,7 +189,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w1t1(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t1(self):
async_test_config = []
for container in test_config_gunicorn_w1t1.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -201,7 +201,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t1(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w1t1(self):
async_test_config = []
for container in test_config_gunicorn_w1t1.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -220,7 +220,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w2t1(self):
def test_nginx_port_vs_socket_async_gunicorn_w2t1(self):
async_test_config = []
for container in test_config_gunicorn_w2t1.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -231,7 +231,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w2t1(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t1(self):
async_test_config = []
for container in test_config_gunicorn_w2t1.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -243,7 +243,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t1(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w2t1(self):
async_test_config = []
for container in test_config_gunicorn_w2t1.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -262,7 +262,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w1t2(self):
def test_nginx_port_vs_socket_async_gunicorn_w1t2(self):
async_test_config = []
for container in test_config_gunicorn_w1t2.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -273,7 +273,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w1t2(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t2(self):
async_test_config = []
for container in test_config_gunicorn_w1t2.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -285,7 +285,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w1t2(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w1t2(self):
async_test_config = []
for container in test_config_gunicorn_w1t2.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -304,7 +304,7 @@ def test_nginx_port_vs_socket_sync_gunicorn_w2t2(self):
def test_nginx_port_vs_socket_async_gunicorn_w2t2(self):
async_test_config = []
for container in test_config_gunicorn_w2t2.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -315,7 +315,7 @@ def test_nginx_port_vs_socket_async_gunicorn_w2t2(self):
def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t2(self):
async_test_config = []
for container in test_config_gunicorn_w2t2.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand All @@ -327,7 +327,7 @@ def test_nginx_port_vs_socket_sync_big_json_response_gunicorn_w2t2(self):
def test_nginx_port_vs_socket_async_big_json_response_gunicorn_w2t2(self):
async_test_config = []
for container in test_config_gunicorn_w2t2.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 1000
async_test_config.append(container)
print(async_test_config)
Expand Down
6 changes: 3 additions & 3 deletions test_files/test_workers_and_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_workers_and_threads_sync(self, test_config):
def test_workers_and_threads_async(self, test_config):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/items"
container["uri"] = "/async/items/"
async_test_config.append(container)
print(async_test_config)
p = CompareContainers(async_test_config)
Expand All @@ -68,7 +68,7 @@ def test_workers_and_threads_async(self, test_config):
def test_workers_and_threads_sync_big_json_response(self, test_config):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/sync/big_json_response"
container["uri"] = "/sync/big_json_response/"
container["request_count"] = 500
async_test_config.append(container)
print(async_test_config)
Expand All @@ -83,7 +83,7 @@ def test_workers_and_threads_sync_big_json_response(self, test_config):
def test_workers_and_threads_async_big_json_response(self, test_config):
async_test_config = []
for container in test_config.copy():
container["uri"] = "/async/big_json_response"
container["uri"] = "/async/big_json_response/"
container["request_count"] = 500
async_test_config.append(container)
print(async_test_config)
Expand Down
Loading