from fastapi import FastAPI
from typing import Optional| #!/usr/bin/env python3 | |
| # Harrison Erd | |
| # Nov 14, 2018 | |
| # blackjack game | |
| from os import system, name | |
| from random import choice, choices, seed | |
| Test Results Summary | |
| JsonDB | |
| 1,000,000 records: | |
| Insertion: 1.57s | |
| Retrieval: 0.73s | |
| Dump: 1.24s | |
| Total: 3.55s | |
| 10,000,000 records: |
| import threading | |
| from concurrent.futures import ThreadPoolExecutor | |
| class AsyncPickleDB: | |
| def __init__(self, db_instance, max_workers=5): | |
| """ | |
| Initialize the AsyncPickleDB with threading and thread pool executor. | |
| Args: | |
| db_instance (PickleDB): An instance of PickleDB to wrap. |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| # Copyright 2019 Harrison Erd | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright notice, |
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| KenobiDB is a small document-based DB, supporting simple usage including | |
| insertion, removal, and basic search. | |
| Written by Harrison Erd (https://patx.github.io/) | |
| https://patx.github.io/kenobi/ | |
| """ | |
| # Copyright Harrison Erd | |
| # |
This benchmark compares the performance of various ASGI web frameworks when serving a simple "Hello, World!" response under high concurrency. The test setup includes running each framework with Uvicorn (4 workers) where applicable and using wrk to simulate concurrent requests.
Each framework was tested using the following command:
wrk -t4 -c1000 -d30s http://127.0.0.1:8000/I created minimal apps for each framework, all returning {"Hello": "World"} as JSON. They ran on Uvicorn with a single worker for baseline performance. Tests hit http://127.0.0.1:8000 with wrk (15s, 4 threads, 64 connections).
from blacksheep import Application, get, json
app = Application()MicroPie is built around streaming-first multipart handling, with no heavyweight form parsers.
This design keeps memory usage low and avoids the double-copy overhead seen in other frameworks.
We benchmarked a 13.4 GiB file upload against FastAPI, Litestar, and Starlette on the same machine.
| Framework | Upload Handler Summary | Multipart Parser | Elapsed (13.4 GiB) | Throughput |