From 5893b8830106f66d8ff7fbcfed6827add0a8fb0b Mon Sep 17 00:00:00 2001 From: xannaxks Date: Tue, 15 Jul 2025 23:16:50 +0600 Subject: [PATCH 1/3] Fastapi added --- Python/FastAPI/Dockerfile | 20 ++++++ Python/FastAPI/create_models.py | 10 +++ Python/FastAPI/db.py | 17 +++++ Python/FastAPI/dependencies.py | 8 +++ Python/FastAPI/main.py | 119 ++++++++++++++++++++++++++------ Python/FastAPI/models.py | 13 ++++ Python/FastAPI/repositories.py | 26 +++++++ Python/FastAPI/requirements.txt | 43 ++++++++++++ Python/FastAPI/schemas.py | 7 ++ 9 files changed, 241 insertions(+), 22 deletions(-) create mode 100644 Python/FastAPI/Dockerfile create mode 100644 Python/FastAPI/create_models.py create mode 100644 Python/FastAPI/db.py create mode 100644 Python/FastAPI/dependencies.py create mode 100644 Python/FastAPI/models.py create mode 100644 Python/FastAPI/repositories.py create mode 100644 Python/FastAPI/requirements.txt create mode 100644 Python/FastAPI/schemas.py diff --git a/Python/FastAPI/Dockerfile b/Python/FastAPI/Dockerfile new file mode 100644 index 0000000..7a13dfa --- /dev/null +++ b/Python/FastAPI/Dockerfile @@ -0,0 +1,20 @@ +# Use official Python image +FROM python:slim + +# Set work directory +WORKDIR /app + +# Update system packages +RUN apt-get update && apt-get upgrade -y + +# Copy dependencies first +COPY requirements.txt . + +# Install Python dependencies +RUN pip install --upgrade pip && pip install -r requirements.txt + +# Copy the rest of your app +COPY . . + +# Run create_models.py before starting the app +CMD ["sh", "-c", "python -m create_models && uvicorn main:app --host 0.0.0.0 --port 8100 --reload"] diff --git a/Python/FastAPI/create_models.py b/Python/FastAPI/create_models.py new file mode 100644 index 0000000..73b8097 --- /dev/null +++ b/Python/FastAPI/create_models.py @@ -0,0 +1,10 @@ +from models import Base +from db import engine +import asyncio + +async def create_tables(): + async with engine.begin() as conn: + await conn.run_sync(Base.metadata.create_all) + +if __name__ == "__main__": + asyncio.run(create_tables()) \ No newline at end of file diff --git a/Python/FastAPI/db.py b/Python/FastAPI/db.py new file mode 100644 index 0000000..d708563 --- /dev/null +++ b/Python/FastAPI/db.py @@ -0,0 +1,17 @@ +from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession +from sqlalchemy.orm import sessionmaker +import asyncio + +engine = create_async_engine("postgresql+asyncpg://resttest:resttest@postgres:5432/resttest", echo=True) + +AsyncSessionClient = sessionmaker( + bind = engine, + class_ = AsyncSession +) + +async def get_db(): + async with AsyncSessionClient() as session: + try: + yield session + finally: + await session.close() \ No newline at end of file diff --git a/Python/FastAPI/dependencies.py b/Python/FastAPI/dependencies.py new file mode 100644 index 0000000..9687383 --- /dev/null +++ b/Python/FastAPI/dependencies.py @@ -0,0 +1,8 @@ +from db import get_db, AsyncSession +from models import User +from sqlalchemy import select +from fastapi import Depends +from repositories import UserRepository + +async def get_user_repository(db: AsyncSession = Depends(get_db)) -> UserRepository: + return UserRepository(db_session=db) \ No newline at end of file diff --git a/Python/FastAPI/main.py b/Python/FastAPI/main.py index bc55e79..450ffa4 100644 --- a/Python/FastAPI/main.py +++ b/Python/FastAPI/main.py @@ -1,28 +1,103 @@ import asyncio import time -from fastapi import FastAPI -from hypercorn.asyncio import serve -from hypercorn.config import Config +import json +from fastapi import HTTPException, status +from fastapi import FastAPI, Path, Body, Depends +from redis.asyncio import Redis +from repositories import UserRepository +from dependencies import get_user_repository +from db import get_db +from schemas import UserSchema +from models import User +from redis.exceptions import RedisError +from contextlib import asynccontextmanager -app = FastAPI() +redis_client: Redis | None = None -@app.get("/test/get-users") -async def get_users()-> list[dict[str, str | int]]: +@asynccontextmanager +async def lifespan(app: FastAPI): + global redis_client + redis_client = Redis(host="redis", port=6379) + try: + await redis_client.ping() + print("Connected to Redis") + except Exception as e: + print(f'Redis connection failed: {e}') + yield + await redis_client.close() + await redis_client.connection_pool.disconnect() + +app = FastAPI(lifespan=lifespan) + +@app.get("/health/") +async def health(): + start = time.perf_counter() + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return { + "status": "ok" + } + +@app.get("/user/json/") +async def user_json(): + start = time.perf_counter() + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return { + "username": "Alice", + "email": "alice@example.com" + } + +@app.get("/user/db/{id}/") +async def user_db_id( + id: int = Path(), + user_repository: UserRepository = Depends(get_user_repository) +): + start = time.perf_counter() + user = await user_repository.get_by_id(id) + if not user: + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + raise HTTPException(status=status.HTTP_404_NOT_FOUND, detail="user not found") + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return user + +@app.post("/user/db/") +async def user_db( + user: UserSchema = Body(), + user_repository: UserRepository = Depends(get_user_repository) +): + start = time.perf_counter() + item = await user_repository.create( + User(username=user.username, email=user.email) + ) + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return item + +@app.get("/user/cache/{id}/") +async def user_cache_id( + id: int = Path() +): start = time.perf_counter() - users = [{ - "id": user, - "username": f"user{user}", - "email": f"user{user}@gmail.com", - "password": f"password{user}", - } for user in range(10000)] - print(f"Execution time: {(time.perf_counter() - start) *1000:3f}ms") - return users - -async def run(): - config = Config() - config.bind = ["0.0.0.0:8100"] - await serve(app, config=config) - -if __name__ == "__main__": - asyncio.run(run()) + try: + cached = await redis_client.get(id) + if cached: + print(type(cached)) + data = json.loads(cached.decode('utf-8')) + print(type(data)) + user_schema = UserSchema(username=data.get('username'), email=data.get('email')) + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return user_schema + db = await get_db().__anext__() + user_repository = await get_user_repository(db) + user = await user_repository.get_by_id(id) + if not user: + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="user not found") + user_schema = UserSchema(username=user.username, email=user.email) + user_json = user_schema.model_dump_json() + await redis_client.set(id, user_json, ex=300) + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return user_schema + except RedisError as e: + print(f'Redis error: {e}') + print(f'Execution time: {(time.perf_counter() - start) *1000:3f}ms') + return None \ No newline at end of file diff --git a/Python/FastAPI/models.py b/Python/FastAPI/models.py new file mode 100644 index 0000000..f304bc6 --- /dev/null +++ b/Python/FastAPI/models.py @@ -0,0 +1,13 @@ +from sqlalchemy.orm import DeclarativeBase +from sqlalchemy.orm import mapped_column, Mapped +from sqlalchemy import Integer, String + +class Base(DeclarativeBase): + pass + +class User(Base): + __tablename__ = "users" + + id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) + username: Mapped[str] = mapped_column(String, unique=True, nullable=False) + email: Mapped[str] = mapped_column(String, unique=True, nullable=False) \ No newline at end of file diff --git a/Python/FastAPI/repositories.py b/Python/FastAPI/repositories.py new file mode 100644 index 0000000..867a231 --- /dev/null +++ b/Python/FastAPI/repositories.py @@ -0,0 +1,26 @@ +from sqlalchemy.ext.asyncio import AsyncSession +from models import User +from sqlalchemy import select +from fastapi import HTTPException, status + +class UserRepository: + def __init__(self, db_session: AsyncSession): + self.db_session = db_session + + async def create(self, item: User) -> User: + if await self.get_by_username(item.username): + raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="username is not free") + self.db_session.add(item) + await self.db_session.commit() + await self.db_session.refresh(item) + return item + + async def get_by_id(self, id: int) -> User: + user = await self.db_session.get(User, id) + return user + + async def get_by_username(self, username: str) -> User | None: + stmt = select(User).where(username==username) + user = await self.db_session.execute(stmt) + return User + \ No newline at end of file diff --git a/Python/FastAPI/requirements.txt b/Python/FastAPI/requirements.txt new file mode 100644 index 0000000..ca25daf --- /dev/null +++ b/Python/FastAPI/requirements.txt @@ -0,0 +1,43 @@ +annotated-types==0.7.0 +anyio==4.9.0 +asyncpg==0.30.0 +certifi==2025.7.14 +click==8.2.1 +colorama==0.4.6 +dnspython==2.7.0 +email_validator==2.2.0 +fastapi==0.116.1 +fastapi-cli==0.0.8 +fastapi-cloud-cli==0.1.4 +greenlet==3.2.3 +h11==0.16.0 +httpcore==1.0.9 +httptools==0.6.4 +httpx==0.28.1 +idna==3.10 +Jinja2==3.1.6 +markdown-it-py==3.0.0 +MarkupSafe==3.0.2 +mdurl==0.1.2 +pydantic==2.11.7 +pydantic_core==2.33.2 +Pygments==2.19.2 +python-dotenv==1.1.1 +python-multipart==0.0.20 +PyYAML==6.0.2 +redis==6.2.0 +rich==14.0.0 +rich-toolkit==0.14.8 +rignore==0.6.2 +sentry-sdk==2.33.0 +shellingham==1.5.4 +sniffio==1.3.1 +SQLAlchemy==2.0.41 +starlette==0.47.1 +typer==0.16.0 +typing-inspection==0.4.1 +typing_extensions==4.14.1 +urllib3==2.5.0 +uvicorn==0.35.0 +watchfiles==1.1.0 +websockets==15.0.1 diff --git a/Python/FastAPI/schemas.py b/Python/FastAPI/schemas.py new file mode 100644 index 0000000..b5ece27 --- /dev/null +++ b/Python/FastAPI/schemas.py @@ -0,0 +1,7 @@ +from pydantic import BaseModel +class UserSchema(BaseModel): + username: str + email: str + + class Config: + orm_mode = True \ No newline at end of file From 5a823a0da74a1b8ec8dd7607d4432bb54e17ebd7 Mon Sep 17 00:00:00 2001 From: xannaxks Date: Thu, 17 Jul 2025 17:36:31 +0600 Subject: [PATCH 2/3] FastAPI added --- Python/FastAPI/Dockerfile | 4 +- Python/FastAPI/repositories.py | 32 ++++-- Python/FastAPI/wait-for-it.sh | 182 +++++++++++++++++++++++++++++++++ docker-compose.yml | 38 ++++--- wrk-scripts/wrk_to_json.lua | 8 +- 5 files changed, 238 insertions(+), 26 deletions(-) create mode 100644 Python/FastAPI/wait-for-it.sh diff --git a/Python/FastAPI/Dockerfile b/Python/FastAPI/Dockerfile index 7a13dfa..e0584f9 100644 --- a/Python/FastAPI/Dockerfile +++ b/Python/FastAPI/Dockerfile @@ -17,4 +17,6 @@ RUN pip install --upgrade pip && pip install -r requirements.txt COPY . . # Run create_models.py before starting the app -CMD ["sh", "-c", "python -m create_models && uvicorn main:app --host 0.0.0.0 --port 8100 --reload"] +RUN chmod +x wait-for-it.sh +CMD ["sh", "-c", "./wait-for-it.sh postgres:5432 -- python create_models.py && uvicorn main:app --host 0.0.0.0 --port 8100"] +# CMD ["/bin/bash"] \ No newline at end of file diff --git a/Python/FastAPI/repositories.py b/Python/FastAPI/repositories.py index 867a231..a13758a 100644 --- a/Python/FastAPI/repositories.py +++ b/Python/FastAPI/repositories.py @@ -2,25 +2,39 @@ from models import User from sqlalchemy import select from fastapi import HTTPException, status +from sqlalchemy.sql.selectable import Select class UserRepository: def __init__(self, db_session: AsyncSession): self.db_session = db_session async def create(self, item: User) -> User: - if await self.get_by_username(item.username): - raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="username is not free") - self.db_session.add(item) - await self.db_session.commit() - await self.db_session.refresh(item) - return item + obj = await self.get_by_username(item.username) + if obj is None: + obj = await self.get_by_email(item.email) + if obj is None: + self.db_session.add(item) + await self.db_session.commit() + await self.db_session.refresh(item) + return item + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="email is not free") + print(obj.username, obj.email, obj.id, obj) + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="username is not free") async def get_by_id(self, id: int) -> User: user = await self.db_session.get(User, id) return user + async def execute_stmt(self, stmt: Select) -> User | None: + result = await self.db_session.execute(stmt) + user = result.scalar_one_or_none() + return user + + async def get_by_email(self, email: str) -> User | None: + stmt = select(User).where(User.email == email) + return await self.execute_stmt(stmt) + async def get_by_username(self, username: str) -> User | None: - stmt = select(User).where(username==username) - user = await self.db_session.execute(stmt) - return User + stmt = select(User).where(User.username == username) + return await self.execute_stmt(stmt) \ No newline at end of file diff --git a/Python/FastAPI/wait-for-it.sh b/Python/FastAPI/wait-for-it.sh new file mode 100644 index 0000000..d990e0d --- /dev/null +++ b/Python/FastAPI/wait-for-it.sh @@ -0,0 +1,182 @@ +#!/usr/bin/env bash +# Use this script to test if a given TCP host/port are available + +WAITFORIT_cmdname=${0##*/} + +echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } + +usage() +{ + cat << USAGE >&2 +Usage: + $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args] + -h HOST | --host=HOST Host or IP under test + -p PORT | --port=PORT TCP port under test + Alternatively, you specify the host and port as host:port + -s | --strict Only execute subcommand if the test succeeds + -q | --quiet Don't output any status messages + -t TIMEOUT | --timeout=TIMEOUT + Timeout in seconds, zero for no timeout + -- COMMAND ARGS Execute command with args after the test finishes +USAGE + exit 1 +} + +wait_for() +{ + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + else + echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout" + fi + WAITFORIT_start_ts=$(date +%s) + while : + do + if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then + nc -z $WAITFORIT_HOST $WAITFORIT_PORT + WAITFORIT_result=$? + else + (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1 + WAITFORIT_result=$? + fi + if [[ $WAITFORIT_result -eq 0 ]]; then + WAITFORIT_end_ts=$(date +%s) + echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds" + break + fi + sleep 1 + done + return $WAITFORIT_result +} + +wait_for_wrapper() +{ + # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 + if [[ $WAITFORIT_QUIET -eq 1 ]]; then + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + else + timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT & + fi + WAITFORIT_PID=$! + trap "kill -INT -$WAITFORIT_PID" INT + wait $WAITFORIT_PID + WAITFORIT_RESULT=$? + if [[ $WAITFORIT_RESULT -ne 0 ]]; then + echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT" + fi + return $WAITFORIT_RESULT +} + +# process arguments +while [[ $# -gt 0 ]] +do + case "$1" in + *:* ) + WAITFORIT_hostport=(${1//:/ }) + WAITFORIT_HOST=${WAITFORIT_hostport[0]} + WAITFORIT_PORT=${WAITFORIT_hostport[1]} + shift 1 + ;; + --child) + WAITFORIT_CHILD=1 + shift 1 + ;; + -q | --quiet) + WAITFORIT_QUIET=1 + shift 1 + ;; + -s | --strict) + WAITFORIT_STRICT=1 + shift 1 + ;; + -h) + WAITFORIT_HOST="$2" + if [[ $WAITFORIT_HOST == "" ]]; then break; fi + shift 2 + ;; + --host=*) + WAITFORIT_HOST="${1#*=}" + shift 1 + ;; + -p) + WAITFORIT_PORT="$2" + if [[ $WAITFORIT_PORT == "" ]]; then break; fi + shift 2 + ;; + --port=*) + WAITFORIT_PORT="${1#*=}" + shift 1 + ;; + -t) + WAITFORIT_TIMEOUT="$2" + if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi + shift 2 + ;; + --timeout=*) + WAITFORIT_TIMEOUT="${1#*=}" + shift 1 + ;; + --) + shift + WAITFORIT_CLI=("$@") + break + ;; + --help) + usage + ;; + *) + echoerr "Unknown argument: $1" + usage + ;; + esac +done + +if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then + echoerr "Error: you need to provide a host and port to test." + usage +fi + +WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-15} +WAITFORIT_STRICT=${WAITFORIT_STRICT:-0} +WAITFORIT_CHILD=${WAITFORIT_CHILD:-0} +WAITFORIT_QUIET=${WAITFORIT_QUIET:-0} + +# Check to see if timeout is from busybox? +WAITFORIT_TIMEOUT_PATH=$(type -p timeout) +WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) + +WAITFORIT_BUSYTIMEFLAG="" +if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then + WAITFORIT_ISBUSY=1 + # Check if busybox timeout uses -t flag + # (recent Alpine versions don't support -t anymore) + if timeout &>/dev/stdout | grep -q -e '-t '; then + WAITFORIT_BUSYTIMEFLAG="-t" + fi +else + WAITFORIT_ISBUSY=0 +fi + +if [[ $WAITFORIT_CHILD -gt 0 ]]; then + wait_for + WAITFORIT_RESULT=$? + exit $WAITFORIT_RESULT +else + if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then + wait_for_wrapper + WAITFORIT_RESULT=$? + else + wait_for + WAITFORIT_RESULT=$? + fi +fi + +if [[ $WAITFORIT_CLI != "" ]]; then + if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then + echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess" + exit $WAITFORIT_RESULT + fi + exec "${WAITFORIT_CLI[@]}" +else + exit $WAITFORIT_RESULT +fi diff --git a/docker-compose.yml b/docker-compose.yml index b065b89..865d415 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,8 @@ services: context: Go/chi dockerfile: Dockerfile container_name: gochi-app -# ports: -# - "8080:8080" + ports: + - "8080:8080" env_file: - Go/chi/.env depends_on: @@ -19,8 +19,8 @@ services: context: Rust/axum dockerfile: Dockerfile container_name: rustaxum-app -# ports: -# - "8081:8080" + ports: + - "8081:8080" env_file: - Rust/axum/.env depends_on: @@ -34,8 +34,8 @@ services: context: Zig/zap dockerfile: Dockerfile container_name: zigzap-app -# ports: -# - "8082:8080" + ports: + - "8082:8080" depends_on: - postgres - redis @@ -47,8 +47,8 @@ services: context: C++/crow dockerfile: Dockerfile container_name: cppcrow-app -# ports: -# - "8083:8080" + ports: + - "8083:8080" depends_on: - postgres - redis @@ -60,8 +60,8 @@ services: context: JavaScript-TypeScript/bun dockerfile: Dockerfile container_name: tsbun-app -# ports: -# - "8084:8080" + ports: + - "8084:8080" depends_on: - postgres - redis @@ -69,7 +69,7 @@ services: - backend postgres: - image: postgres:alpine + image: postgres container_name: postgres environment: POSTGRES_DB: resttest @@ -84,7 +84,7 @@ services: - backend redis: - image: redis:alpine + image: redis container_name: redis ports: - "6379:6379" @@ -93,6 +93,19 @@ services: networks: - backend + fastapi: + build: + context: Python/FastAPI + dockerfile: Dockerfile + networks: + - backend + container_name: FastAPI + ports: + - "8100:8100" + depends_on: + - postgres + - redis + wrk: image: williamyeh/wrk container_name: wrk @@ -107,6 +120,7 @@ services: - zigzap-app - cppcrow-app - tsbun-app + - fastapi networks: - backend diff --git a/wrk-scripts/wrk_to_json.lua b/wrk-scripts/wrk_to_json.lua index 511c352..e473347 100644 --- a/wrk-scripts/wrk_to_json.lua +++ b/wrk-scripts/wrk_to_json.lua @@ -1,8 +1,8 @@ -local app_name = os.getenv("APP_NAME") or "def_app" -local endpoint = os.getenv("ENDPOINT") or "ep" +local app_name = os.getenv("APP_NAME") or "fastapi_app" +local endpoint = os.getenv("ENDPOINT") or "user-cache" done = function(summary, latency, requests) - local filename = string.format("/tmp/results/%s_benchmark_%s.json", app_name, endpoint) + local filename = string.format("pythonfastapi_benchmark_user-cache.json", app_name, endpoint) local file = io.open(filename, "w") file:write("{\n") @@ -31,4 +31,4 @@ done = function(summary, latency, requests) file:close() io.write(string.format("\nResults saved to %s\n", filename)) -end \ No newline at end of file +end From e2da6df6bcd041963bc9c05e9a02d46a78b8a174 Mon Sep 17 00:00:00 2001 From: xannaxks Date: Thu, 17 Jul 2025 17:37:28 +0600 Subject: [PATCH 3/3] FastAPI added --- wrk-scripts/python-fastapi.sh | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 wrk-scripts/python-fastapi.sh diff --git a/wrk-scripts/python-fastapi.sh b/wrk-scripts/python-fastapi.sh new file mode 100644 index 0000000..59e473a --- /dev/null +++ b/wrk-scripts/python-fastapi.sh @@ -0,0 +1,4 @@ +export APP_NAME="fastapi-app" +export ENDPOINT="user-json" +echo "Serialization test" +wrk -s /scripts/wrk_to_json.lua -t10 -c20000 -d60s http://FastAPI:8080/user/json/