{"id":22631408,"url":"https://github.com/sinisaos/async-orm-benchmarks","last_synced_at":"2025-03-29T04:19:31.938Z","repository":{"id":266019054,"uuid":"896744040","full_name":"sinisaos/async-orm-benchmarks","owner":"sinisaos","description":"Python async ORMs, query builders, and database drivers benchmarks for PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-01-03T09:59:48.000Z","size":73,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-03T14:12:41.465Z","etag":null,"topics":["async","benchmark","orms","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinisaos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-12-01T07:23:22.000Z","updated_at":"2025-01-08T06:08:07.000Z","dependencies_parsed_at":"2024-12-24T21:32:54.349Z","dependency_job_id":null,"html_url":"https://github.com/sinisaos/async-orm-benchmarks","commit_stats":null,"previous_names":["sinisaos/async-orm-benchmarks"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinisaos%2Fasync-orm-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinisaos%2Fasync-orm-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinisaos%2Fasync-orm-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinisaos%2Fasync-orm-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinisaos","download_url":"https://codeload.github.com/sinisaos/async-orm-benchmarks/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246136194,"owners_count":20729133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","benchmark","orms","python"],"created_at":"2024-12-09T02:08:50.238Z","updated_at":"2025-03-29T04:19:31.917Z","avatar_url":"https://github.com/sinisaos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python async ORMs, query builders and drivers benchmarks.\n\n---------------------------------------------------------\n\n## Instalation\n\nClone repository in fresh virtualenv.\n\n```bash\ngit clone https://github.com/sinisaos/async-orm-benchmarks.git\n```\n\n## Install requirements\n\n\n```bash\ncd async-orm-benchmarks/\npip install -r requirements.txt\n```\n\n## Create database\n\n\n```bash\nsudo -i -u yourpostgresusername psql\nCREATE DATABASE perfdb;\n\\q;\n```\n\n## Create database tables and load data\n\n\n```bash\n./scripts/load_data.sh\n```\n\n## Usage\n\nIn the first terminal, start the `ORM` or `driver` server from the menu.\n\n```bash\n./scripts/start_server.sh\n```\n\nIn the second terminal, run the benchmark (from the menu) for the server started in the first terminal.\n\n```bash\n./scripts/start_benchmark.sh\n```\n\n## Endpoints\n\nThis benchmarks attempts to simulate a realistic comparison of asynch ORMs and drivers. \nAs in this [example case](https://github.com/edgedb/imdbench), we simulate the latency between the server and the database to get more realistic benchmarks.\n\nOn Linux, this latency can be simulated with `tc` tool like this:\n\n```bash\nsudo tc qdisc replace dev lo root netem delay 1ms\n```\n\nOnce we finish our benchmark, it is important to delete the rule which we have set.\n\n```bash\nsudo tc qdisc delete dev lo root\n```\n----------------------\nThere are three types of tables. \n\nA small table with only two columns,\n\n\u003cdetails\u003e\n\u003csummary\u003eMultiple columns response\u003c/summary\u003e\n\n```json\n[\n   {\n      \"id\":1,\n      \"name\":\"Tag 1\"\n   },\n   {\n      \"id\":2,\n      \"name\":\"Tag 2\"\n   },\n   {\n      \"id\":3,\n      \"name\":\"Tag 3\"\n   },\n   {\n      \"id\":4,\n      \"name\":\"Tag 4\"\n   },\n   {\n      \"id\":5,\n      \"name\":\"Tag 5\"\n   },\n   {\n      \"id\":6,\n      \"name\":\"Tag 6\"\n   },\n   {\n      \"id\":7,\n      \"name\":\"Tag 7\"\n   },\n   \"...\"\n]\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSingle column response\u003c/summary\u003e\n\n```json\n{\n    \"id\":1,\n    \"name\":\"Tag 1\"\n}\n```\n\u003c/details\u003e\n\n----------------------\nA large table with many columns \n\n\n\u003cdetails\u003e\n\u003csummary\u003eMultiple columns response\u003c/summary\u003e\n\n```json\n[\n   {\n      \"id\":1,\n      \"float_col_1\":2.2,\n      \"smallint_col_1\":2,\n      \"integer_col_1\":2000000,\n      \"bigint_col_1\":99999999,\n      \"varchar_col_1\":\"value1\",\n      \"text_col_1\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_1\":2.2,\n      \"json_col_1\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_2\":2.2,\n      \"smallint_col_2\":2,\n      \"integer_col_2\":2000000,\n      \"bigint_col_2\":99999999,\n      \"varchar_col_2\":\"value1\",\n      \"text_col_2\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_2\":2.2,\n      \"json_col_2\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_3\":2.2,\n      \"smallint_col_3\":2,\n      \"integer_col_3\":2000000,\n      \"bigint_col_3\":99999999,\n      \"varchar_col_3\":\"value1\",\n      \"text_col_3\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_3\":2.2,\n      \"json_col_3\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      }\n   },\n   {\n      \"id\":2,\n      \"float_col_1\":2.2,\n      \"smallint_col_1\":2,\n      \"integer_col_1\":2000000,\n      \"bigint_col_1\":99999999,\n      \"varchar_col_1\":\"value1\",\n      \"text_col_1\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_1\":2.2,\n      \"json_col_1\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_2\":2.2,\n      \"smallint_col_2\":2,\n      \"integer_col_2\":2000000,\n      \"bigint_col_2\":99999999,\n      \"varchar_col_2\":\"value1\",\n      \"text_col_2\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_2\":2.2,\n      \"json_col_2\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_3\":2.2,\n      \"smallint_col_3\":2,\n      \"integer_col_3\":2000000,\n      \"bigint_col_3\":99999999,\n      \"varchar_col_3\":\"value1\",\n      \"text_col_3\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_3\":2.2,\n      \"json_col_3\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      }\n   },\n   {\n      \"id\":3,\n      \"float_col_1\":2.2,\n      \"smallint_col_1\":2,\n      \"integer_col_1\":2000000,\n      \"bigint_col_1\":99999999,\n      \"varchar_col_1\":\"value1\",\n      \"text_col_1\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_1\":2.2,\n      \"json_col_1\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_2\":2.2,\n      \"smallint_col_2\":2,\n      \"integer_col_2\":2000000,\n      \"bigint_col_2\":99999999,\n      \"varchar_col_2\":\"value1\",\n      \"text_col_2\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_2\":2.2,\n      \"json_col_2\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_3\":2.2,\n      \"smallint_col_3\":2,\n      \"integer_col_3\":2000000,\n      \"bigint_col_3\":99999999,\n      \"varchar_col_3\":\"value1\",\n      \"text_col_3\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_3\":2.2,\n      \"json_col_3\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      }\n   },\n   {\n      \"id\":4,\n      \"float_col_1\":2.2,\n      \"smallint_col_1\":2,\n      \"integer_col_1\":2000000,\n      \"bigint_col_1\":99999999,\n      \"varchar_col_1\":\"value1\",\n      \"text_col_1\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_1\":2.2,\n      \"json_col_1\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_2\":2.2,\n      \"smallint_col_2\":2,\n      \"integer_col_2\":2000000,\n      \"bigint_col_2\":99999999,\n      \"varchar_col_2\":\"value1\",\n      \"text_col_2\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_2\":2.2,\n      \"json_col_2\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      },\n      \"float_col_3\":2.2,\n      \"smallint_col_3\":2,\n      \"integer_col_3\":2000000,\n      \"bigint_col_3\":99999999,\n      \"varchar_col_3\":\"value1\",\n      \"text_col_3\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n      \"numeric_col_3\":2.2,\n      \"json_col_3\":{\n         \"a\":1,\n         \"b\":\"b\",\n         \"c\":[\n            2\n         ],\n         \"d\":{\n            \"e\":3\n         },\n         \"f\":true\n      }\n   },\n   ...\n]\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSingle column response\u003c/summary\u003e\n\n```json\n{\n    \"id\":1,\n    \"float_col_1\":2.2,\n    \"smallint_col_1\":2,\n    \"integer_col_1\":2000000,\n    \"bigint_col_1\":99999999,\n    \"varchar_col_1\":\"value1\",\n    \"text_col_1\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n    \"numeric_col_1\":2.2,\n    \"json_col_1\":{\n        \"a\":1,\n        \"b\":\"b\",\n        \"c\":[\n        2\n        ],\n        \"d\":{\n        \"e\":3\n        },\n        \"f\":true\n    },\n    \"float_col_2\":2.2,\n    \"smallint_col_2\":2,\n    \"integer_col_2\":2000000,\n    \"bigint_col_2\":99999999,\n    \"varchar_col_2\":\"value1\",\n    \"text_col_2\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n    \"numeric_col_2\":2.2,\n    \"json_col_2\":{\n        \"a\":1,\n        \"b\":\"b\",\n        \"c\":[\n        2\n        ],\n        \"d\":{\n        \"e\":3\n        },\n        \"f\":true\n    },\n    \"float_col_3\":2.2,\n    \"smallint_col_3\":2,\n    \"integer_col_3\":2000000,\n    \"bigint_col_3\":99999999,\n    \"varchar_col_3\":\"value1\",\n    \"text_col_3\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.\",\n    \"numeric_col_3\":2.2,\n    \"json_col_3\":{\n        \"a\":1,\n        \"b\":\"b\",\n        \"c\":[\n        2\n        ],\n        \"d\":{\n        \"e\":3\n        },\n        \"f\":true\n    }\n}\n```\n\u003c/details\u003e\n\n----------------------\n\nand a related table that has multiple related tables (both `foreign key` and `many to many` relationships).\n\n\u003cdetails\u003e\n\u003csummary\u003eMultiple columns response\u003c/summary\u003e\n\n```json\n[\n   {\n      \"id\":1,\n      \"title\":\"Question 1\",\n      \"content\":\"Question 1\",\n      \"created_at\":\"2024-12-02T05:30:23.101781+00:00\",\n      \"updated_at\":\"2024-12-02T05:30:23.101801+00:00\",\n      \"views\":30529,\n      \"likes\":10,\n      \"user_id\":1,\n      \"question_user\":{\n         \"id\":1,\n         \"email\":\"piccolo@example.com\",\n         \"username\":\"piccolo\",\n         \"superuser\":true\n      },\n      \"question_tags\":[\n         {\n            \"id\":14,\n            \"name\":\"Tag 14\"\n         },\n         {\n            \"id\":16,\n            \"name\":\"Tag 16\"\n         },\n         {\n            \"id\":22,\n            \"name\":\"Tag 22\"\n         }\n      ]\n   },\n   {\n      \"id\":2,\n      \"title\":\"Question 2\",\n      \"content\":\"Question 2\",\n      \"created_at\":\"2024-12-02T05:30:23.160412+00:00\",\n      \"updated_at\":\"2024-12-02T05:30:23.160421+00:00\",\n      \"views\":10,\n      \"likes\":10,\n      \"user_id\":1,\n      \"question_user\":{\n         \"id\":1,\n         \"email\":\"piccolo@example.com\",\n         \"username\":\"piccolo\",\n         \"superuser\":true\n      },\n      \"question_tags\":[\n         {\n            \"id\":16,\n            \"name\":\"Tag 16\"\n         },\n         {\n            \"id\":20,\n            \"name\":\"Tag 20\"\n         },\n         {\n            \"id\":21,\n            \"name\":\"Tag 21\"\n         }\n      ]\n   },\n   {\n      \"id\":3,\n      \"title\":\"Question 3\",\n      \"content\":\"Question 3\",\n      \"created_at\":\"2024-12-02T05:30:23.216031+00:00\",\n      \"updated_at\":\"2024-12-02T05:30:23.216048+00:00\",\n      \"views\":10,\n      \"likes\":10,\n      \"user_id\":1,\n      \"question_user\":{\n         \"id\":1,\n         \"email\":\"piccolo@example.com\",\n         \"username\":\"piccolo\",\n         \"superuser\":true\n      },\n      \"question_tags\":[\n         {\n            \"id\":11,\n            \"name\":\"Tag 11\"\n         },\n         {\n            \"id\":18,\n            \"name\":\"Tag 18\"\n         },\n         {\n            \"id\":19,\n            \"name\":\"Tag 19\"\n         }\n      ]\n   },\n   {\n      \"id\":4,\n      \"title\":\"Question 4\",\n      \"content\":\"Question 4\",\n      \"created_at\":\"2024-12-02T05:30:23.272343+00:00\",\n      \"updated_at\":\"2024-12-02T05:30:23.272352+00:00\",\n      \"views\":10,\n      \"likes\":10,\n      \"user_id\":1,\n      \"question_user\":{\n         \"id\":1,\n         \"email\":\"piccolo@example.com\",\n         \"username\":\"piccolo\",\n         \"superuser\":true\n      },\n      \"question_tags\":[\n         {\n            \"id\":4,\n            \"name\":\"Tag 4\"\n         },\n         {\n            \"id\":18,\n            \"name\":\"Tag 18\"\n         },\n         {\n            \"id\":22,\n            \"name\":\"Tag 22\"\n         }\n      ]\n   },\n   {\n      \"id\":5,\n      \"title\":\"Question 5\",\n      \"content\":\"Question 5\",\n      \"created_at\":\"2024-12-02T05:30:23.327549+00:00\",\n      \"updated_at\":\"2024-12-02T05:30:23.327565+00:00\",\n      \"views\":10,\n      \"likes\":10,\n      \"user_id\":1,\n      \"question_user\":{\n         \"id\":1,\n         \"email\":\"piccolo@example.com\",\n         \"username\":\"piccolo\",\n         \"superuser\":true\n      },\n      \"question_tags\":[\n         {\n            \"id\":1,\n            \"name\":\"Tag 1\"\n         },\n         {\n            \"id\":2,\n            \"name\":\"Tag 2\"\n         },\n         {\n            \"id\":9,\n            \"name\":\"Tag 9\"\n         },\n         {\n            \"id\":13,\n            \"name\":\"Tag 13\"\n         }\n      ]\n   },\n   ...\n]\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSingle column response\u003c/summary\u003e\n\n```json\n{\n   \"id\":1,\n   \"title\":\"Question 1\",\n   \"content\":\"Question 1\",\n   \"created_at\":\"2024-12-02T05:30:23.101781+00:00\",\n   \"updated_at\":\"2024-12-02T05:30:23.101801+00:00\",\n   \"views\":30529,\n   \"likes\":10,\n   \"user_id\":1,\n   \"question_user\":{\n      \"id\":1,\n      \"email\":\"piccolo@example.com\",\n      \"username\":\"piccolo\",\n      \"superuser\":true\n   },\n   \"question_tags\":[\n      {\n         \"id\":14,\n         \"name\":\"Tag 14\"\n      },\n      {\n         \"id\":16,\n         \"name\":\"Tag 16\"\n      },\n      {\n         \"id\":22,\n         \"name\":\"Tag 22\"\n      }\n   ],\n   \"question_answers\":[\n      {\n         \"id\":95,\n         \"content\":\"Answer 95\",\n         \"created_at\":\"2024-12-02T06:30:46.201394+01:00\",\n         \"updated_at\":\"2024-12-02T06:30:46.201403+01:00\",\n         \"likes\":20,\n         \"user_id\":1,\n         \"question_id\":1\n      }\n   ]\n}\n```\n\u003c/details\u003e\n\n## Results\n\nThis benchmarks uses the [Bombardier](https://github.com/codesenberg/bombardier) load test tool with `200 connections` for `10 seconds` on `uvicorn` server with single worker. The results are in [results.md](https://github.com/sinisaos/async-orm-benchmarks/blob/main/results.md) and will be different on a better machine (I'm using an old machine with only `4GB RAM` and `Intel Core i3-6006U`). You can also use [Locust](https://locust.io/) for really nice GUI testing and reporting. PRs are welcome. Thanks in advance.\n\n![chart](https://github.com/user-attachments/assets/d20f7cb1-8998-47f4-9c14-753dd55bb058)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinisaos%2Fasync-orm-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinisaos%2Fasync-orm-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinisaos%2Fasync-orm-benchmarks/lists"}