diff --git a/frameworks/Python/vibora/README.md b/frameworks/Python/vibora/README.md deleted file mode 100644 index 647792661a2..00000000000 --- a/frameworks/Python/vibora/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# [Vibora](https://github.com/vibora-io/vibora) Benchmark Test - -The information below is specific to Vibora. For further guidance, -review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). -Also note that there is additional information that's provided in -the [Python README](../). - -This is the Python Vibora portion of a [benchmarking tests suite](../../) -comparing a variety of frameworks. - -All test implementations are located within a single file -([app.py](app.py)). - -## Description - -Vibora, Vibora + psycopg2 - -### Database - -Postgres - -## Test URLs -### JSON Encoding - -http://localhost:8080/json - -### Single Row Random Query - -http://localhost:8080/db - -### Plaintext - -http://localhost:8080/plaintext - - - -The following tests cannot be currently run due to an issue with the framework -[Details Here] = https://github.com/vibora-io/vibora/issues/223 - -### Update random rows - -http://localhost:8080/updates/?queries= - -### Variable Row Query Test - -http://localhost:8080/db?queries= diff --git a/frameworks/Python/vibora/app.py b/frameworks/Python/vibora/app.py deleted file mode 100644 index 243aa4365e1..00000000000 --- a/frameworks/Python/vibora/app.py +++ /dev/null @@ -1,115 +0,0 @@ -import multiprocessing -import os -from random import randint -from operator import itemgetter - -from vibora import Vibora, Request, JsonResponse, Response -from vibora.hooks import Events - -from db import Pool -DEFAULT_POOL_SIZE = 1000//multiprocessing.cpu_count() - -READ_ROW_SQL = 'SELECT * FROM "world" WHERE id={0}' -WRITE_ROW_SQL = 'UPDATE "world" SET "randomnumber"={0} WHERE id={1} RETURNING id, randomNumber' -READ_ALL_FORTUNES = 'SELECT * FROM "fortune"' -ADDITIONAL_ROW = [0, 'Additional fortune added at request time.'] -sort_fortunes_key = itemgetter(1) - -app = Vibora(template_dirs=['templates']) - - -@app.handle(Events.BEFORE_SERVER_START) -async def init_db(app: Vibora): - app.components.add(await Pool("postgresql://%s:%s@%s:5432/%s" % (os.getenv("PGUSER", "benchmarkdbuser"), os.getenv("PSPASS", "benchmarkdbpass"), os.getenv("PGADDR", "tfb-database"), os.getenv("PGDB", "hello_world")), max_size=int(os.getenv("PGPOOLSIZE", DEFAULT_POOL_SIZE)))) - - -@app.handle(Events.BEFORE_SERVER_STOP) -async def close_db(app: Vibora): - await asyncio.wait_for(app.components.get(Pool).close(), timeout=10) - - -def getQueriesTotal(params): - try: - queries = params['queries'][0] - query_count = int(queries) - except: - return 1 - - if query_count < 1: - return 1 - if query_count > 500: - return 500 - return query_count - - -async def fetchWorld(pool): - async with pool.acquire() as conn: - return await conn.fetchrow(READ_ROW_SQL.format(randint(1, 10000))) - - -async def updateWorld(world_id, pool): - async with pool.acquire() as conn: - return await conn.fetchrow(WRITE_ROW_SQL.format(randint(1, 10000), world_id)) - - -async def fetchMultipleWorlds(total, pool): - worlds = [] - for x in range(total): - res = await fetchWorld(pool) - worlds.append({'id': res[0], 'randomNumber': res[1]}) - return worlds - - -async def updateMultipleWorlds(total, pool): - worlds = [] - for x in range(total): - res = await fetchWorld(pool) - updated = await updateWorld(res[0], pool) - worlds.append({'id': updated[0], 'randomNumber': updated[1]}) - return worlds - - -async def fetchFortunes(pool): - async with pool.acquire() as conn: - return await conn.fetch(READ_ALL_FORTUNES) - - -@app.route('/fortunes') -async def fortunes(pool: Pool): - fortunes = await fetchFortunes(pool) - fortunes.append(ADDITIONAL_ROW) - fortunes.sort(key=sort_fortunes_key) - return await app.render('index.html', fortunes=fortunes) - - -@app.route('/db') -async def single_query(request: Request, pool: Pool): - res = await fetchWorld(pool) - return JsonResponse({'id': res[0], 'randomNumber': res[1]}, headers={'Server': 'Vibora'}) - - -@app.route('/plaintext') -async def plaintext(): - return Response(b'Hello, World!', headers={'Server': 'Vibora', 'Content-Type': 'text/plain'}) - - -@app.route('/json') -async def json(): - return JsonResponse({'message': 'Hello, World!'}, headers={'Server': 'Vibora'}) - - -@app.route('/queries') -async def multiple_queries(request: Request, pool: Pool): - total_queries = getQueriesTotal(request.args) - worlds = await fetchMultipleWorlds(total_queries, pool) - return JsonResponse(worlds, headers={'Server': 'Vibora', 'Content-Type': 'application/json', 'Content-Length': str(total_queries)}) - - -@app.route('/updates') -async def update_queries(request: Request, pool: Pool): - total_queries = getQueriesTotal(request.args) - worlds = await updateMultipleWorlds(total_queries, pool) - return JsonResponse(worlds, headers={'Server': 'Vibora', 'Content-Type': 'application/json', 'Content-Length': str(total_queries)}) - -if __name__ == '__main__': - app.run(host="0.0.0.0", port=8000, workers=multiprocessing.cpu_count()) diff --git a/frameworks/Python/vibora/benchmark_config.json b/frameworks/Python/vibora/benchmark_config.json deleted file mode 100644 index 3876196498a..00000000000 --- a/frameworks/Python/vibora/benchmark_config.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "framework": "vibora", - "tests": [{ - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "db_url": "/db", - "port": 8000, - "approach": "Realistic", - "classification": "Platform", - "framework": "vibora", - "language": "Python", - "flavor": "Python3", - "platform": "None", - "webserver": "None", - "os": "Linux", - "orm": "Full", - "database_os": "Linux", - "database": "Postgres", - "display_name": "Vibora", - "notes": "" - } - }] -} diff --git a/frameworks/Python/vibora/config.toml b/frameworks/Python/vibora/config.toml deleted file mode 100644 index 03952ecdb41..00000000000 --- a/frameworks/Python/vibora/config.toml +++ /dev/null @@ -1,16 +0,0 @@ -[framework] -name = "vibora" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -approach = "Realistic" -classification = "Platform" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "None" -webserver = "None" -versus = "None" diff --git a/frameworks/Python/vibora/db.py b/frameworks/Python/vibora/db.py deleted file mode 100644 index 2f3fe5560e2..00000000000 --- a/frameworks/Python/vibora/db.py +++ /dev/null @@ -1,36 +0,0 @@ -import asyncio -from contextlib import asynccontextmanager -import asyncpg - - -class Connection(asyncpg.Connection): - async def reset(self, *, timeout=None): - pass - - -class Pool: - def __init__(self, connect_url, max_size=10, connection_class=None): - self._connect_url = connect_url - self._connection_class = connection_class or Connection - self._queue = asyncio.LifoQueue(max_size) - - def __await__(self): - return self._async_init__().__await__() - - async def _async_init__(self): - for _ in range(self._queue.maxsize): - self._queue.put_nowait(await asyncpg.connect(self._connect_url, connection_class=self._connection_class)) - return self - - @asynccontextmanager - async def acquire(self): - conn = await self._queue.get() - try: - yield conn - finally: - self._queue.put_nowait(conn) - - async def close(self): - for _ in range(self._queue.maxsize): - conn = await self._queue.get() - await conn.close() diff --git a/frameworks/Python/vibora/requirements.txt b/frameworks/Python/vibora/requirements.txt deleted file mode 100644 index 88fbcd0ba4b..00000000000 --- a/frameworks/Python/vibora/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -asyncpg==0.26.0 -git+https://github.com/IterableTrucks/vibora.git@a24bbf417a84df3a25f7e8901613a1c50ccfe63f#egg=vibora[fast] diff --git a/frameworks/Python/vibora/templates/index.html b/frameworks/Python/vibora/templates/index.html deleted file mode 100644 index 55c472c8ee1..00000000000 --- a/frameworks/Python/vibora/templates/index.html +++ /dev/null @@ -1,21 +0,0 @@ - - -
- -| id | -message | -
|---|---|
| {{ fortune[0] }} | -{{ fortune[1] }} | -