From 8ab3849286114fee2273902eaeda802dabae37dd Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 22:45:05 +0100 Subject: [PATCH 01/42] Aiohttp: minor optimisation --- frameworks/Python/aiohttp/app/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/app/views.py b/frameworks/Python/aiohttp/app/views.py index c743cc47054..d5dbccba677 100644 --- a/frameworks/Python/aiohttp/app/views.py +++ b/frameworks/Python/aiohttp/app/views.py @@ -25,8 +25,8 @@ def get_num_queries(request): try: - num_queries = int(request.match_info.get('queries', 1)) - except ValueError: + num_queries = int(request.match_info['queries']) + except (KeyError, ValueError): return 1 if num_queries < 1: return 1 From 690f7c67a5c46bdae590d8b4e9609f84d4951f31 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 22:47:43 +0100 Subject: [PATCH 02/42] Create aiohttp-pypy.dockerfile --- .../Python/aiohttp/aiohttp-pypy.dockerfile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 frameworks/Python/aiohttp/aiohttp-pypy.dockerfile diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile new file mode 100644 index 00000000000..b579adbcb80 --- /dev/null +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -0,0 +1,16 @@ +FROM pypy:3.13 + +ADD ./requirements.txt /aiohttp/requirements.txt + +RUN pip3 install cython==3.0.11 && \ + pip3 install -r /aiohttp/requirements.txt + +ADD ./ /aiohttp + +WORKDIR /aiohttp + +ENV CONNECTION=RAW + +EXPOSE 8080 + +CMD python3 -O -m app.server From 0cbe6e56a4b5a70f732766d73745c57ea7fc0bce Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 22:50:01 +0100 Subject: [PATCH 03/42] Update benchmark_config.json --- .../Python/aiohttp/benchmark_config.json | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/benchmark_config.json b/frameworks/Python/aiohttp/benchmark_config.json index 366ff434220..8465fbb4da1 100644 --- a/frameworks/Python/aiohttp/benchmark_config.json +++ b/frameworks/Python/aiohttp/benchmark_config.json @@ -23,6 +23,29 @@ "display_name": "aiohttp", "notes": "uses asyncpg for database access" }, + "pypy": { + "json_url": "/json", + "db_url": "/db", + "query_url": "/queries/", + "fortune_url": "/fortunes", + "update_url": "/updates/", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "database": "Postgres", + "framework": "aiohttp", + "language": "Python", + "flavor": "Pypy3", + "orm": "Raw", + "platform": "asyncio", + "webserver": "None", + "os": "Linux", + "database_os": "Linux", + "display_name": "aiohttp-pypy", + "notes": "uses Pypy instead of CPython", + "versus": "default" + }, "nginx": { "json_url": "/json", "db_url": "/db", @@ -43,7 +66,8 @@ "os": "Linux", "database_os": "Linux", "display_name": "aiohttp-nginx", - "notes": "uses nginx as proxy" + "notes": "uses nginx as proxy", + "versus": "default" }, "gunicorn": { "json_url": "/json", From 94f3f70c03c7bb5ca1a4400ddd4d78aeef68d683 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 22:50:52 +0100 Subject: [PATCH 04/42] Update config.toml --- frameworks/Python/aiohttp/config.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frameworks/Python/aiohttp/config.toml b/frameworks/Python/aiohttp/config.toml index 195a408ba2e..10e19834f0b 100644 --- a/frameworks/Python/aiohttp/config.toml +++ b/frameworks/Python/aiohttp/config.toml @@ -18,6 +18,23 @@ platform = "asyncio" webserver = "None" versus = "None" +[pypy] +urls.plaintext = "/plaintext" +urls.json = "/json" +urls.db = "/db" +urls.query = "/queries/" +urls.update = "/updates/" +urls.fortune = "/fortunes" +approach = "Realistic" +classification = "Micro" +database = "Postgres" +database_os = "Linux" +os = "Linux" +orm = "Raw" +platform = "asyncio" +webserver = "None" +versus = "default" + [nginx] urls.plaintext = "/plaintext" urls.json = "/json" From 6d05a9a7b463de6553298147a409a08e063d1847 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 22:58:12 +0100 Subject: [PATCH 05/42] Update aiohttp-pypy.dockerfile --- frameworks/Python/aiohttp/aiohttp-pypy.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile index b579adbcb80..9e7f5b6714a 100644 --- a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -1,4 +1,4 @@ -FROM pypy:3.13 +FROM pypy:3.11 ADD ./requirements.txt /aiohttp/requirements.txt From 195ee974ca0e36e61bdcf8f64e249ab8751996b5 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:05:18 +0100 Subject: [PATCH 06/42] Update aiohttp-gunicorn.dockerfile --- frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile index 6fb96c40f5a..01acc503d45 100644 --- a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13 +FROM python:latest ADD ./ /aiohttp @@ -11,4 +11,4 @@ ENV CONNECTION=RAW EXPOSE 8080 -CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py \ No newline at end of file +CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py From 69cf225e2ad3e38b88fa03082af778d56cf3b705 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:05:38 +0100 Subject: [PATCH 07/42] Update aiohttp-nginx.dockerfile --- frameworks/Python/aiohttp/aiohttp-nginx.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile index 9739a8e83bd..eeeb7b66dc8 100644 --- a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13 +FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt @@ -17,4 +17,4 @@ EXPOSE 8080 RUN chmod +x /aiohttp/nginx-entrypoint.sh -ENTRYPOINT ["/aiohttp/nginx-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/aiohttp/nginx-entrypoint.sh"] From 9df516ce02cded8aeaf719dad700d019776920a9 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:05:57 +0100 Subject: [PATCH 08/42] Update aiohttp-orm.dockerfile --- frameworks/Python/aiohttp/aiohttp-orm.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile index c113afcd7d5..7ee2201a7dc 100644 --- a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13 +FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt @@ -13,4 +13,4 @@ ENV CONNECTION=ORM EXPOSE 8080 -CMD python3 -O -m app.server \ No newline at end of file +CMD python3 -O -m app.server From 3d6f056a3783eca9b955a0884a7ae78fa7ddcca7 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:06:15 +0100 Subject: [PATCH 09/42] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index a9ecfff8c07..9c109549d41 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13 +FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt @@ -13,4 +13,4 @@ ENV CONNECTION=RAW EXPOSE 8080 -CMD python3 -O -m app.server \ No newline at end of file +CMD python3 -O -m app.server From 084db562638ec20145a41c8e03f6efe83699b37c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:12:18 +0100 Subject: [PATCH 10/42] Update requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index 7729cae3c1d..e0bc71bb3b2 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -2,5 +2,4 @@ aiohttp==3.11.18 asyncpg==0.30.0 jinja2==3.1.6 SQLAlchemy==2.0.40 -orjson==3.10.16 uvloop==0.21.0 From 6658cc22898c0bcbad05623fd191a10b0a5271d9 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:12:51 +0100 Subject: [PATCH 11/42] Create requirements-cpython.txt --- frameworks/Python/aiohttp/requirements-cpython.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 frameworks/Python/aiohttp/requirements-cpython.txt diff --git a/frameworks/Python/aiohttp/requirements-cpython.txt b/frameworks/Python/aiohttp/requirements-cpython.txt new file mode 100644 index 00000000000..e89ed1b9d4e --- /dev/null +++ b/frameworks/Python/aiohttp/requirements-cpython.txt @@ -0,0 +1,3 @@ +-r requirements.txt + +orjson==3.10.16 From 31be4e63ba49b1f84cbd68e100b08106d9b1ebf0 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:13:16 +0100 Subject: [PATCH 12/42] Update aiohttp-gunicorn.dockerfile --- frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile index 01acc503d45..ac99faea3f3 100644 --- a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile @@ -5,7 +5,7 @@ ADD ./ /aiohttp WORKDIR aiohttp RUN pip3 install cython==3.0.11 gunicorn==23.0.0 && \ - pip3 install -r /aiohttp/requirements.txt + pip3 install -r /aiohttp/requirements-cpython.txt ENV CONNECTION=RAW From c4b58a4a7253e9cee58d7d09100029bf78fc8356 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:13:37 +0100 Subject: [PATCH 13/42] Update aiohttp-nginx.dockerfile --- frameworks/Python/aiohttp/aiohttp-nginx.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile index eeeb7b66dc8..1caa41ddc28 100644 --- a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile @@ -3,7 +3,7 @@ FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements.txt + pip3 install -r /aiohttp/requirements-cpython.txt RUN apt-get update && apt-get install -y nginx From 369b3b626b8b16f70d69ec7b3853dea4d43fcba3 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:13:56 +0100 Subject: [PATCH 14/42] Update aiohttp-orm.dockerfile --- frameworks/Python/aiohttp/aiohttp-orm.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile index 7ee2201a7dc..c8242592b72 100644 --- a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile @@ -3,7 +3,7 @@ FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements.txt + pip3 install -r /aiohttp/requirements-cpython.txt ADD ./ /aiohttp From a08be641ad4993f13d95b2ce555d8aee219f13d7 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:14:15 +0100 Subject: [PATCH 15/42] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index 9c109549d41..241be0f0461 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -3,7 +3,7 @@ FROM python:latest ADD ./requirements.txt /aiohttp/requirements.txt RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements.txt + pip3 install -r /aiohttp/requirements-cpython.txt ADD ./ /aiohttp From e8295129f0355dcb77ecd78462f193d4729b8394 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:17:39 +0100 Subject: [PATCH 16/42] Update views.py --- frameworks/Python/aiohttp/app/views.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/frameworks/Python/aiohttp/app/views.py b/frameworks/Python/aiohttp/app/views.py index d5dbccba677..e52d4255744 100644 --- a/frameworks/Python/aiohttp/app/views.py +++ b/frameworks/Python/aiohttp/app/views.py @@ -1,15 +1,26 @@ +import platform from operator import attrgetter, itemgetter from pathlib import Path from random import randint, sample import jinja2 from aiohttp.web import Response -from orjson import dumps from sqlalchemy import bindparam, select from sqlalchemy.orm.attributes import flag_modified from .models import Fortune, World +if platform.python_implementation() == "PyPy": + from aiohttp.web import json_response +else: + from orjson import dumps + + def json_response(payload): + return Response( + body=dumps(payload), + content_type="application/json", + ) + ADDITIONAL_FORTUNE_ORM = Fortune(id=0, message='Additional fortune added at request time.') ADDITIONAL_FORTUNE_ROW = {'id': 0, 'message': 'Additional fortune added at request time.'} READ_ROW_SQL = 'SELECT "randomnumber", "id" FROM "world" WHERE id = $1' @@ -35,13 +46,6 @@ def get_num_queries(request): return num_queries -def json_response(payload): - return Response( - body=dumps(payload), - content_type="application/json", - ) - - async def json(request): """ Test 1 From b44f68856257b17da30cae4d9798f477d18bdf72 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:21:56 +0100 Subject: [PATCH 17/42] Update aiohttp-nginx.dockerfile --- frameworks/Python/aiohttp/aiohttp-nginx.dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile index 1caa41ddc28..41813862364 100644 --- a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile @@ -1,16 +1,14 @@ FROM python:latest -ADD ./requirements.txt /aiohttp/requirements.txt - -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt - RUN apt-get update && apt-get install -y nginx ADD ./ /aiohttp WORKDIR /aiohttp +RUN pip3 install cython==3.0.11 && \ + pip3 install -r /aiohttp/requirements-cpython.txt + ENV CONNECTION=RAW EXPOSE 8080 From f9440785a2b0588dfc2ea2af3a44d3e49acd50f5 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:22:31 +0100 Subject: [PATCH 18/42] Update aiohttp-orm.dockerfile --- frameworks/Python/aiohttp/aiohttp-orm.dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile index c8242592b72..3002faa6c7a 100644 --- a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile @@ -1,14 +1,12 @@ FROM python:latest -ADD ./requirements.txt /aiohttp/requirements.txt - -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt - ADD ./ /aiohttp WORKDIR /aiohttp +RUN pip3 install cython==3.0.11 && \ + pip3 install -r /aiohttp/requirements-cpython.txt + ENV CONNECTION=ORM EXPOSE 8080 From c55253d417d623049322578019346b0ed7cac8bb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:23:10 +0100 Subject: [PATCH 19/42] Update aiohttp-pypy.dockerfile --- frameworks/Python/aiohttp/aiohttp-pypy.dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile index 9e7f5b6714a..d666f1faf22 100644 --- a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -1,14 +1,12 @@ FROM pypy:3.11 -ADD ./requirements.txt /aiohttp/requirements.txt - -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements.txt - ADD ./ /aiohttp WORKDIR /aiohttp +RUN pip3 install cython==3.0.11 && \ + pip3 install -r /aiohttp/requirements.txt + ENV CONNECTION=RAW EXPOSE 8080 From 0205399fba51490ba7123308cff7448cc06a2513 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:23:41 +0100 Subject: [PATCH 20/42] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index 241be0f0461..38ae27710c2 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -1,14 +1,12 @@ FROM python:latest -ADD ./requirements.txt /aiohttp/requirements.txt - -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt - ADD ./ /aiohttp WORKDIR /aiohttp +RUN pip3 install cython==3.0.11 && \ + pip3 install -r /aiohttp/requirements-cpython.txt + ENV CONNECTION=RAW EXPOSE 8080 From 8e4130f4051feaed47452cb0b63e7db12338b413 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:40:27 +0100 Subject: [PATCH 21/42] Update requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index e0bc71bb3b2..09a570e6627 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -2,4 +2,3 @@ aiohttp==3.11.18 asyncpg==0.30.0 jinja2==3.1.6 SQLAlchemy==2.0.40 -uvloop==0.21.0 From 6463d62d9afb95eb6fbdda9117a00b170007c10f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:40:41 +0100 Subject: [PATCH 22/42] Update requirements-cpython.txt --- frameworks/Python/aiohttp/requirements-cpython.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/Python/aiohttp/requirements-cpython.txt b/frameworks/Python/aiohttp/requirements-cpython.txt index e89ed1b9d4e..541792ee01c 100644 --- a/frameworks/Python/aiohttp/requirements-cpython.txt +++ b/frameworks/Python/aiohttp/requirements-cpython.txt @@ -1,3 +1,4 @@ -r requirements.txt orjson==3.10.16 +uvloop==0.21.0 From 535bf1f9694511dc252370c75c39227fb9ca199e Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:43:28 +0100 Subject: [PATCH 23/42] Update app.py --- frameworks/Python/aiohttp/app/app.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frameworks/Python/aiohttp/app/app.py b/frameworks/Python/aiohttp/app/app.py index ae8b74c1414..40d33382e10 100644 --- a/frameworks/Python/aiohttp/app/app.py +++ b/frameworks/Python/aiohttp/app/app.py @@ -1,11 +1,15 @@ -import uvloop -from aiohttp import web import argparse +import platform + +from aiohttp import web + from .main import create_app if __name__ == '__main__': - uvloop.install() + if platform.python_implementation() != "PyPy": + import uvloop + uvloop.install() parser = argparse.ArgumentParser() parser.add_argument('--socket', type=str, required=True) args = parser.parse_args() From 5b9d99f60174fb34f253ec3f3dd8ee52bbebbb08 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:46:14 +0100 Subject: [PATCH 24/42] Update config.toml --- frameworks/Python/aiohttp/config.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frameworks/Python/aiohttp/config.toml b/frameworks/Python/aiohttp/config.toml index 10e19834f0b..47a6c33bb28 100644 --- a/frameworks/Python/aiohttp/config.toml +++ b/frameworks/Python/aiohttp/config.toml @@ -21,10 +21,6 @@ versus = "None" [pypy] urls.plaintext = "/plaintext" urls.json = "/json" -urls.db = "/db" -urls.query = "/queries/" -urls.update = "/updates/" -urls.fortune = "/fortunes" approach = "Realistic" classification = "Micro" database = "Postgres" From d17351757cb5f7ed72a12cf32890094e4e4d67e7 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:49:39 +0100 Subject: [PATCH 25/42] Update main.py --- frameworks/Python/aiohttp/app/main.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frameworks/Python/aiohttp/app/main.py b/frameworks/Python/aiohttp/app/main.py index ef2b2fd4f8b..cc8f4a52a5b 100644 --- a/frameworks/Python/aiohttp/app/main.py +++ b/frameworks/Python/aiohttp/app/main.py @@ -1,7 +1,7 @@ -import os import multiprocessing +import os +import platform -import asyncpg from aiohttp import web from sqlalchemy.engine.url import URL from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine @@ -20,6 +20,9 @@ updates_raw, ) +if platform.python_implementation() != "PyPy": + import asyncpg + CONNECTION_ORM = os.getenv('CONNECTION', 'ORM').upper() == 'ORM' @@ -84,6 +87,7 @@ def setup_routes(app): def create_app(): app = web.Application() - app.cleanup_ctx.append(db_ctx) + if platform.python_implementation() != "PyPy": + app.cleanup_ctx.append(db_ctx) setup_routes(app) return app From 9c8f8754d4f5b220c1c6137f27b50fb670d88aec Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:50:16 +0100 Subject: [PATCH 26/42] Update requirements.txt --- frameworks/Python/aiohttp/requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index 09a570e6627..0142f9212d2 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -1,4 +1,3 @@ aiohttp==3.11.18 -asyncpg==0.30.0 jinja2==3.1.6 SQLAlchemy==2.0.40 From b3042ee59f8ad8d24b8cc28d87b6c61d9a3cc17b Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:50:32 +0100 Subject: [PATCH 27/42] Update requirements-cpython.txt --- frameworks/Python/aiohttp/requirements-cpython.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/Python/aiohttp/requirements-cpython.txt b/frameworks/Python/aiohttp/requirements-cpython.txt index 541792ee01c..8b9eb2ef69d 100644 --- a/frameworks/Python/aiohttp/requirements-cpython.txt +++ b/frameworks/Python/aiohttp/requirements-cpython.txt @@ -1,4 +1,5 @@ -r requirements.txt +asyncpg==0.30.0 orjson==3.10.16 uvloop==0.21.0 From b1c551fe45631c2972e5dc5c0d4d81fc63091799 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 18 May 2025 23:59:59 +0100 Subject: [PATCH 28/42] Update main.py --- frameworks/Python/aiohttp/app/main.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/Python/aiohttp/app/main.py b/frameworks/Python/aiohttp/app/main.py index cc8f4a52a5b..f334f2ca8a2 100644 --- a/frameworks/Python/aiohttp/app/main.py +++ b/frameworks/Python/aiohttp/app/main.py @@ -23,6 +23,12 @@ if platform.python_implementation() != "PyPy": import asyncpg + class NoResetConnection(asyncpg.Connection): + __slots__ = () + + def get_reset_query(self): + return "" + CONNECTION_ORM = os.getenv('CONNECTION', 'ORM').upper() == 'ORM' @@ -40,12 +46,6 @@ def pg_dsn(dialect=None) -> str: ) return url.render_as_string(hide_password=False) -class NoResetConnection(asyncpg.Connection): - __slots__ = () - - def get_reset_query(self): - return '' - async def db_ctx(app: web.Application): # number of gunicorn workers = multiprocessing.cpu_count() as per gunicorn_conf.py # max_connections = 2000 as per toolset/setup/linux/databases/postgresql/postgresql.conf:64 From 0126ac92f11cccba3bc99b99aa41c71c2af55a34 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 00:56:35 +0100 Subject: [PATCH 29/42] Update server.py --- frameworks/Python/aiohttp/app/server.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/Python/aiohttp/app/server.py b/frameworks/Python/aiohttp/app/server.py index d28000daaee..c1f48b3d4be 100644 --- a/frameworks/Python/aiohttp/app/server.py +++ b/frameworks/Python/aiohttp/app/server.py @@ -1,9 +1,11 @@ +import multiprocessing import os +import platform import socket -import multiprocessing + from aiohttp import web + from .main import create_app -import uvloop SERVERS_COUNT = multiprocessing.cpu_count() BACKLOG = 2048 @@ -12,7 +14,9 @@ def start_server(sock, cpu_id): if hasattr(os, "sched_setaffinity"): os.sched_setaffinity(0, {cpu_id}) - uvloop.install() + if platform.python_implementation() != "PyPy": + import uvloop + uvloop.install() app = create_app() web.run_app(app, sock=sock, backlog=BACKLOG, access_log=None) @@ -43,4 +47,4 @@ def create_reusable_socket(host='0.0.0.0', port=8080): workers.append(worker) for worker in workers: - worker.join() \ No newline at end of file + worker.join() From 080fed1b00fdb814f495cfab9be91abd70daa36a Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 01:49:49 +0100 Subject: [PATCH 30/42] Update benchmark_config.json --- frameworks/Python/aiohttp/benchmark_config.json | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frameworks/Python/aiohttp/benchmark_config.json b/frameworks/Python/aiohttp/benchmark_config.json index 8465fbb4da1..487ab2fc7cc 100644 --- a/frameworks/Python/aiohttp/benchmark_config.json +++ b/frameworks/Python/aiohttp/benchmark_config.json @@ -25,10 +25,6 @@ }, "pypy": { "json_url": "/json", - "db_url": "/db", - "query_url": "/queries/", - "fortune_url": "/fortunes", - "update_url": "/updates/", "plaintext_url": "/plaintext", "port": 8080, "approach": "Realistic", From 82341743c0ef3dfc5552bb24d506ca0d3e587406 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 01:59:51 +0100 Subject: [PATCH 31/42] Update aiohttp-gunicorn.dockerfile --- frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile index ac99faea3f3..c3e7497a616 100644 --- a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile @@ -4,8 +4,7 @@ ADD ./ /aiohttp WORKDIR aiohttp -RUN pip3 install cython==3.0.11 gunicorn==23.0.0 && \ - pip3 install -r /aiohttp/requirements-cpython.txt +RUN pip3 install -r /aiohttp/requirements-cpython.txt ENV CONNECTION=RAW From 7f44af6f569ae51517d36fa47f5dac5c82742e9a Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 02:00:30 +0100 Subject: [PATCH 32/42] Update aiohttp-nginx.dockerfile --- frameworks/Python/aiohttp/aiohttp-nginx.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile index 41813862364..109494a8220 100644 --- a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile @@ -6,8 +6,7 @@ ADD ./ /aiohttp WORKDIR /aiohttp -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt +RUN pip3 install -r /aiohttp/requirements-cpython.txt ENV CONNECTION=RAW From c2a197de1c94e97ea746bc279038802e1d7f6a20 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 02:01:00 +0100 Subject: [PATCH 33/42] Update aiohttp-orm.dockerfile --- frameworks/Python/aiohttp/aiohttp-orm.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile index 3002faa6c7a..d9e8b326c2c 100644 --- a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile @@ -4,8 +4,7 @@ ADD ./ /aiohttp WORKDIR /aiohttp -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt +RUN pip3 install -r /aiohttp/requirements-cpython.txt ENV CONNECTION=ORM From 556f3d726ee7e95dbe0aa2715dc8c27d1db58fca Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 02:01:32 +0100 Subject: [PATCH 34/42] Update aiohttp-pypy.dockerfile --- frameworks/Python/aiohttp/aiohttp-pypy.dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile index d666f1faf22..97c423618e3 100644 --- a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -1,11 +1,10 @@ -FROM pypy:3.11 +FROM pypy:latest ADD ./ /aiohttp WORKDIR /aiohttp -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements.txt +RUN pip3 install -r /aiohttp/requirements.txt ENV CONNECTION=RAW From fa699641f85e95cfc3f3046ac308a2a68cfda5f8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 02:01:56 +0100 Subject: [PATCH 35/42] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index 38ae27710c2..ecb0cd81fd5 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -4,8 +4,7 @@ ADD ./ /aiohttp WORKDIR /aiohttp -RUN pip3 install cython==3.0.11 && \ - pip3 install -r /aiohttp/requirements-cpython.txt +RUN pip3 install -r /aiohttp/requirements-cpython.txt ENV CONNECTION=RAW From 20c8e6f9127542c29c14f2f3ae385a4d951676f4 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Mon, 19 May 2025 02:03:45 +0100 Subject: [PATCH 36/42] Update requirements-cpython.txt --- frameworks/Python/aiohttp/requirements-cpython.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/frameworks/Python/aiohttp/requirements-cpython.txt b/frameworks/Python/aiohttp/requirements-cpython.txt index 8b9eb2ef69d..f49e01d17d2 100644 --- a/frameworks/Python/aiohttp/requirements-cpython.txt +++ b/frameworks/Python/aiohttp/requirements-cpython.txt @@ -1,5 +1,6 @@ -r requirements.txt asyncpg==0.30.0 +gunicorn==23.0.0 orjson==3.10.16 uvloop==0.21.0 From c90154d79bf69e6282b0a1087ced91306e45b214 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:56:21 +0100 Subject: [PATCH 37/42] Update aiohttp-gunicorn.dockerfile --- frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile index c3e7497a616..71c8048b2af 100644 --- a/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile @@ -1,4 +1,4 @@ -FROM python:latest +FROM python:3.13 ADD ./ /aiohttp From c47a3e17b505483de26d7a55d16932e6f753626c Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:56:41 +0100 Subject: [PATCH 38/42] Update aiohttp-nginx.dockerfile --- frameworks/Python/aiohttp/aiohttp-nginx.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile index 109494a8220..2c96a25f9b9 100644 --- a/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-nginx.dockerfile @@ -1,4 +1,4 @@ -FROM python:latest +FROM python:3.13 RUN apt-get update && apt-get install -y nginx From 1c5b3591362938376b02b18051f438e1b07fdc62 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:56:58 +0100 Subject: [PATCH 39/42] Update aiohttp-orm.dockerfile --- frameworks/Python/aiohttp/aiohttp-orm.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile index d9e8b326c2c..c63f3e1689e 100644 --- a/frameworks/Python/aiohttp/aiohttp-orm.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-orm.dockerfile @@ -1,4 +1,4 @@ -FROM python:latest +FROM python:3.13 ADD ./ /aiohttp From 62271f89f166a7f0c5f1532297218ce19d531ece Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:57:18 +0100 Subject: [PATCH 40/42] Update aiohttp-pypy.dockerfile --- frameworks/Python/aiohttp/aiohttp-pypy.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile index 97c423618e3..517db4d11b9 100644 --- a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -1,4 +1,4 @@ -FROM pypy:latest +FROM pypy:3.13 ADD ./ /aiohttp From 9256786fe468d842b8012b5afb252b3c19416be8 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:57:35 +0100 Subject: [PATCH 41/42] Update aiohttp.dockerfile --- frameworks/Python/aiohttp/aiohttp.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index ecb0cd81fd5..3edfb605a1c 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -1,4 +1,4 @@ -FROM python:latest +FROM python:3.13 ADD ./ /aiohttp From 1db72b6b38c94be2c2b96245403f9549f2fde2fb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 20 May 2025 18:57:51 +0100 Subject: [PATCH 42/42] Update aiohttp-pypy.dockerfile --- frameworks/Python/aiohttp/aiohttp-pypy.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile index 517db4d11b9..bc7770b7e7d 100644 --- a/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pypy.dockerfile @@ -1,4 +1,4 @@ -FROM pypy:3.13 +FROM pypy:3.11 ADD ./ /aiohttp