{"id":29182575,"url":"https://github.com/pedroh183/asyncvssync","last_synced_at":"2026-04-18T11:02:47.233Z","repository":{"id":301951645,"uuid":"1010395754","full_name":"PedroH183/asyncVSsync","owner":"PedroH183","description":"This project contains a small FastAPI application backed by a PostgreSQL database and a pair of benchmark clients used to compare synchronous and asynchronous HTTP requests.","archived":false,"fork":false,"pushed_at":"2025-06-29T19:33:43.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-29T19:36:55.489Z","etag":null,"topics":["async","asyncio","asyncpg","fastapi","postgresql","sync"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PedroH183.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-29T01:20:58.000Z","updated_at":"2025-06-29T19:34:42.000Z","dependencies_parsed_at":"2025-06-29T19:48:33.288Z","dependency_job_id":null,"html_url":"https://github.com/PedroH183/asyncVSsync","commit_stats":null,"previous_names":["pedroh183/asyncvssync"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PedroH183/asyncVSsync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroH183%2FasyncVSsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroH183%2FasyncVSsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroH183%2FasyncVSsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroH183%2FasyncVSsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PedroH183","download_url":"https://codeload.github.com/PedroH183/asyncVSsync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroH183%2FasyncVSsync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31966217,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","asyncio","asyncpg","fastapi","postgresql","sync"],"created_at":"2025-07-01T20:06:48.227Z","updated_at":"2026-04-18T11:02:47.209Z","avatar_url":"https://github.com/PedroH183.png","language":"Python","readme":"# Async vs Sync Benchmark\n\nThis project contains a small FastAPI application backed by a PostgreSQL database and a pair of benchmark clients used to compare synchronous and asynchronous HTTP requests. It can be used to observe latency and throughput differences when making many concurrent requests.\n\n## Results\n\n### Sync\n![alt text](image.png)\n\n### Async\n![alt text](image-1.png)\n\n## Requirements\n\n- Python 3.13+\n- PostgreSQL database\n\nThe project dependencies are declared in `pyproject.toml`. Install them with `pip`:\n\n```bash\npip install -r uv.lock\n```\n\n## Environment Variables\n\nThe database connection details are provided through environment variables:\n\n- `DATABASE_URL` – connection string used by the application\n- `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST`, `DB_PORT` – used by the data population script\n\nCreate a `.env` file or export the variables in your shell before running the code.\n\n## Running the Application\n\nStart the FastAPI server with `uvicorn`:\n\n```bash\nuvicorn main:app --reload\n```\n\nThe service exposes a single endpoint:\n\n- `GET /clientes/{id}` – returns a client record from the database\n\n## Populating Sample Data\n\nUse the `generator_fake_clients.py` script to seed the database with sample clients:\n\n```bash\npython generator_fake_clients.py\n```\n\n## Benchmark Clients\n\nTwo benchmark scripts are provided:\n\n- `benchmark_client_async.py` – performs requests using `httpx.AsyncClient`\n- `benchmark_client_sync.py` – performs requests using `requests`\n\nEach script will issue 10,000 requests against the running API and print throughput and latency metrics.\n\nRun them with:\n\n```bash\npython benchmark_client_async.py\n```\n\n```bash\npython benchmark_client_sync.py\n```\n\nCompare the output numbers to evaluate the performance differences between asynchronous and synchronous requests.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedroh183%2Fasyncvssync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedroh183%2Fasyncvssync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedroh183%2Fasyncvssync/lists"}