Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8ab3849
Aiohttp: minor optimisation
Dreamsorcerer May 18, 2025
690f7c6
Create aiohttp-pypy.dockerfile
Dreamsorcerer May 18, 2025
0cbe6e5
Update benchmark_config.json
Dreamsorcerer May 18, 2025
94f3f70
Update config.toml
Dreamsorcerer May 18, 2025
6d05a9a
Update aiohttp-pypy.dockerfile
Dreamsorcerer May 18, 2025
195ee97
Update aiohttp-gunicorn.dockerfile
Dreamsorcerer May 18, 2025
69cf225
Update aiohttp-nginx.dockerfile
Dreamsorcerer May 18, 2025
9df516c
Update aiohttp-orm.dockerfile
Dreamsorcerer May 18, 2025
3d6f056
Update aiohttp.dockerfile
Dreamsorcerer May 18, 2025
084db56
Update requirements.txt
Dreamsorcerer May 18, 2025
6658cc2
Create requirements-cpython.txt
Dreamsorcerer May 18, 2025
31be4e6
Update aiohttp-gunicorn.dockerfile
Dreamsorcerer May 18, 2025
c4b58a4
Update aiohttp-nginx.dockerfile
Dreamsorcerer May 18, 2025
369b3b6
Update aiohttp-orm.dockerfile
Dreamsorcerer May 18, 2025
a08be64
Update aiohttp.dockerfile
Dreamsorcerer May 18, 2025
e829512
Update views.py
Dreamsorcerer May 18, 2025
b44f688
Update aiohttp-nginx.dockerfile
Dreamsorcerer May 18, 2025
f944078
Update aiohttp-orm.dockerfile
Dreamsorcerer May 18, 2025
c55253d
Update aiohttp-pypy.dockerfile
Dreamsorcerer May 18, 2025
0205399
Update aiohttp.dockerfile
Dreamsorcerer May 18, 2025
8e4130f
Update requirements.txt
Dreamsorcerer May 18, 2025
6463d62
Update requirements-cpython.txt
Dreamsorcerer May 18, 2025
535bf1f
Update app.py
Dreamsorcerer May 18, 2025
5b9d99f
Update config.toml
Dreamsorcerer May 18, 2025
d173517
Update main.py
Dreamsorcerer May 18, 2025
9c8f875
Update requirements.txt
Dreamsorcerer May 18, 2025
b3042ee
Update requirements-cpython.txt
Dreamsorcerer May 18, 2025
b1c551f
Update main.py
Dreamsorcerer May 18, 2025
0126ac9
Update server.py
Dreamsorcerer May 18, 2025
080fed1
Update benchmark_config.json
Dreamsorcerer May 19, 2025
8234174
Update aiohttp-gunicorn.dockerfile
Dreamsorcerer May 19, 2025
7f44af6
Update aiohttp-nginx.dockerfile
Dreamsorcerer May 19, 2025
c2a197d
Update aiohttp-orm.dockerfile
Dreamsorcerer May 19, 2025
556f3d7
Update aiohttp-pypy.dockerfile
Dreamsorcerer May 19, 2025
fa69964
Update aiohttp.dockerfile
Dreamsorcerer May 19, 2025
20c8e6f
Update requirements-cpython.txt
Dreamsorcerer May 19, 2025
c90154d
Update aiohttp-gunicorn.dockerfile
Dreamsorcerer May 20, 2025
c47a3e1
Update aiohttp-nginx.dockerfile
Dreamsorcerer May 20, 2025
1c5b359
Update aiohttp-orm.dockerfile
Dreamsorcerer May 20, 2025
62271f8
Update aiohttp-pypy.dockerfile
Dreamsorcerer May 20, 2025
9256786
Update aiohttp.dockerfile
Dreamsorcerer May 20, 2025
1db72b6
Update aiohttp-pypy.dockerfile
Dreamsorcerer May 20, 2025
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
6 changes: 3 additions & 3 deletions frameworks/Python/aiohttp/aiohttp-gunicorn.dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM python:3.13
FROM python:latest
Copy link
Contributor

@joanhey joanhey May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FROM python:3 it's better.
If python use SEM versioning is not problem.
But latest is NOT so !!!
If you will be here for some years, and fix the problems it's OK, but now this line create a problem in the future.
Thank you !!

Copy link
Contributor Author

@Dreamsorcerer Dreamsorcerer May 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it'll make any difference. Any changes for a v4 are no more likely to break the small amount of code here than a minor release would. Ideally we'd be able to have Dependabot bump the pinned version automatically...

Copy link
Member

@msmith-techempower msmith-techempower May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm okay with going with latest and if it breaks something we'll see it pretty plainly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, thinking on this for more than one second, it would make it harder for people to understand what version was run on any given continuous benchmark run from day to day. Imagine some breaking change from 3.13 to 3.14 (as a contrived example) but this dockerfile says latest - might be hard without some guesswork what's going on. Agreeing with @joanhey that this should be returned to sem. ver.


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

EXPOSE 8080

CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py
CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py
12 changes: 5 additions & 7 deletions frameworks/Python/aiohttp/aiohttp-nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
FROM python:3.13

ADD ./requirements.txt /aiohttp/requirements.txt

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements.txt
FROM python:latest

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

RUN chmod +x /aiohttp/nginx-entrypoint.sh

ENTRYPOINT ["/aiohttp/nginx-entrypoint.sh"]
ENTRYPOINT ["/aiohttp/nginx-entrypoint.sh"]
12 changes: 5 additions & 7 deletions frameworks/Python/aiohttp/aiohttp-orm.dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM python:3.13

ADD ./requirements.txt /aiohttp/requirements.txt

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements.txt
FROM python:latest

ADD ./ /aiohttp

WORKDIR /aiohttp

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements-cpython.txt

ENV CONNECTION=ORM

EXPOSE 8080

CMD python3 -O -m app.server
CMD python3 -O -m app.server
14 changes: 14 additions & 0 deletions frameworks/Python/aiohttp/aiohttp-pypy.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM pypy:3.11

ADD ./ /aiohttp

WORKDIR /aiohttp

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements.txt

ENV CONNECTION=RAW

EXPOSE 8080

CMD python3 -O -m app.server
12 changes: 5 additions & 7 deletions frameworks/Python/aiohttp/aiohttp.dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
FROM python:3.13

ADD ./requirements.txt /aiohttp/requirements.txt

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements.txt
FROM python:latest

ADD ./ /aiohttp

WORKDIR /aiohttp

RUN pip3 install cython==3.0.11 && \
pip3 install -r /aiohttp/requirements-cpython.txt

ENV CONNECTION=RAW

EXPOSE 8080

CMD python3 -O -m app.server
CMD python3 -O -m app.server
24 changes: 14 additions & 10 deletions frameworks/Python/aiohttp/app/views.py
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -25,8 +36,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
Expand All @@ -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
Expand Down
26 changes: 25 additions & 1 deletion frameworks/Python/aiohttp/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions frameworks/Python/aiohttp/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions frameworks/Python/aiohttp/requirements-cpython.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-r requirements.txt

orjson==3.10.16
uvloop==0.21.0
2 changes: 0 additions & 2 deletions frameworks/Python/aiohttp/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ aiohttp==3.11.18
asyncpg==0.30.0
jinja2==3.1.6
SQLAlchemy==2.0.40
orjson==3.10.16
uvloop==0.21.0
Loading