Python driver benchmarks - #55
Open
patrycja-ziemkiewicz wants to merge 19 commits into
Open
patrycja-ziemkiewicz wants to merge 19 commits into
patrycja-ziemkiewicz wants to merge 19 commits into
Conversation
patrycja-ziemkiewicz
force-pushed
the
python-driver-benchmarks
branch
2 times, most recently
from
March 19, 2026 14:56
01c17af to
09080d8
Compare
adespawn
added a commit
to adespawn/scylla-rust-driver
that referenced
this pull request
Mar 19, 2026
When creating nodejs-rs driver, we have created a set of benchmarks, that we have used to compare the performance of the nodejs-rs driver with the node.js cassandra-driver and the scylla rust driver. This meant, that we had some benchmark code for rust driver inside nodejs driver repository. With two other wrappers creating benchmarks*, that are heavily based, on the benchmarks from nodejs ZPP, we have decided with @wprzytula to move the code for the rust part of the benchmarks to the rust driver repository, so that it can be used by all three wrappers and maintained in one place. * C# driver: scylladb/csharp-rs-driver#100 * Python driver: scylladb/python-rs-driver#55
4 tasks
adespawn
added a commit
to adespawn/scylla-rust-driver
that referenced
this pull request
Mar 19, 2026
When creating nodejs-rs driver, we have created a set of benchmarks, that we have used to compare the performance of the nodejs-rs driver with the node.js cassandra-driver and the scylla rust driver. This meant, that we had some benchmark code for rust driver inside nodejs driver repository. With two other wrappers creating benchmarks*, that are heavily based, on the benchmarks from nodejs ZPP, we have decided with @wprzytula to move the code for the rust part of the benchmarks to the rust driver repository, so that it can be used by all three wrappers and maintained in one place. * C# driver: scylladb/csharp-rs-driver#100 * Python driver: scylladb/python-rs-driver#55
patrycja-ziemkiewicz
force-pushed
the
python-driver-benchmarks
branch
5 times, most recently
from
March 24, 2026 12:25
1415afb to
c254469
Compare
patrycja-ziemkiewicz
force-pushed
the
python-driver-benchmarks
branch
2 times, most recently
from
April 30, 2026 13:38
b326ab3 to
62e4c14
Compare
patrycja-ziemkiewicz
marked this pull request as ready for review
April 30, 2026 14:15
patrycja-ziemkiewicz
requested review from
Lorak-mmk,
Copilot,
jakub-graczyk,
pasinskik,
paulinaczajkowska and
wprzytula
April 30, 2026 14:15
There was a problem hiding this comment.
Pull request overview
Adds an SDB (ScyllaDB Drivers Benchmarker) benchmark suite for the Python-RS driver, including single-threaded and concurrent scenarios plus documentation/config to run and plot results.
Changes:
- Introduces benchmark scenario scripts for insert, select (small/large), (de)serialization, batch, and paging.
- Adds concurrent variants of key scenarios (insert/select/(de)serialization/paging).
- Adds SDB configuration (
config.yml) and a README with instructions for running/plotting.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| benchmark/common.py | Shared DB setup/teardown helpers and data generators for all benchmark scenarios. |
| benchmark/insert.py | Insert throughput benchmark using prepared statements. |
| benchmark/ser.py | Serialization-focused benchmark inserting complex rows. |
| benchmark/deser.py | Deserialization-focused benchmark selecting complex rows. |
| benchmark/batch.py | Batch execution benchmark using logged batches. |
| benchmark/paging.py | Manual paging benchmark using iter_current_page() + fetch_next_page(). |
| benchmark/select_runner.py | Shared select benchmark runner used by small/large select wrappers. |
| benchmark/small_select.py | Wrapper to run select benchmark with a small row count. |
| benchmark/large_select.py | Wrapper to run select benchmark with a large row count. |
| benchmark/concurrent_insert.py | Concurrent insert benchmark using asyncio tasks. |
| benchmark/concurrent_select.py | Concurrent select benchmark using asyncio tasks. |
| benchmark/concurrent_ser.py | Concurrent serialization benchmark using asyncio tasks. |
| benchmark/concurrent_deser.py | Concurrent deserialization benchmark using asyncio tasks. |
| benchmark/concurrent_paging.py | Concurrent paging benchmark using asyncio tasks. |
| benchmark/config.yml | SDB benchmark definitions and backend run commands for this repo. |
| benchmark/README.md | Instructions for building SDB, running benchmarks, and plotting results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
patrycja-ziemkiewicz
force-pushed
the
python-driver-benchmarks
branch
from
April 30, 2026 14:36
62e4c14 to
dfbdafa
Compare
Lorak-mmk
requested changes
May 4, 2026
jakub-graczyk
approved these changes
May 7, 2026
|
|
||
|
|
||
| async def test(session: Session, cnt: int, num_of_rows: int): | ||
| prepared = await session.prepare(SIMPLE_SELECT_QUERY) |
Contributor
There was a problem hiding this comment.
For consistency prepare outside test(), same in complex
Comment on lines
+10
to
+12
| dependencies = [ | ||
| "scylla-driver>=3.29.10", | ||
| ] |
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=get_simple_data(), |
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=get_simple_data(), |
Comment on lines
+12
to
+24
| async def test(session: Session, prepared: PreparedStatement, cnt: int, num_of_rows: int): | ||
| for _ in range(cnt): | ||
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=None, | ||
| paging_state=None, | ||
| ) | ||
| ) | ||
| result = await fut | ||
| assert len(result) == num_of_rows # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] | ||
|
|
||
|
|
Comment on lines
+12
to
+24
| async def test(session: Session, prepared: PreparedStatement, cnt: int, num_of_rows: int): | ||
| for _ in range(cnt): | ||
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=None, | ||
| paging_state=None, | ||
| ) | ||
| ) | ||
| result = await fut | ||
| assert len(result) == num_of_rows # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] | ||
|
|
||
|
|
Comment on lines
+2
to
+10
| import sys | ||
|
|
||
| from common import ( | ||
| SIMPLE_SELECT_QUERY, | ||
| ) | ||
| from python_rs_helpers import connect | ||
| from scylla.session import Session | ||
|
|
||
|
|
Comment on lines
+2
to
+11
| import sys | ||
|
|
||
| from cassandra.cluster import Session # pyright: ignore[reportMissingTypeStubs] | ||
| from cassandra.query import PreparedStatement # pyright: ignore[reportMissingTypeStubs] | ||
| from common import ( | ||
| SIMPLE_SELECT_QUERY, | ||
| ) | ||
| from python_helpers import PAGE_SIZE, connect, to_asyncio | ||
|
|
||
|
|
Comment on lines
+4
to
+8
| from common import ( | ||
| SIMPLE_INSERT_QUERY, | ||
| get_simple_data, | ||
| ) | ||
| from python_rs_helpers import init_simple_table, init_with_inserts |
| from scylla.session import Session | ||
| from scylla.statement import PreparedStatement, Statement | ||
|
|
||
| STEP = 3971 |
| ) | ||
| from python_helpers import connect, to_asyncio | ||
|
|
||
| STEP = 3971 |
patrycja-ziemkiewicz
force-pushed
the
python-driver-benchmarks
branch
2 times, most recently
from
July 9, 2026 14:47
6231818 to
0b157a1
Compare
Comment on lines
9
to
+12
| dynamic = ["version"] | ||
| dependencies = [ | ||
| "scylla-driver>=3.29.10", | ||
| ] |
Comment on lines
+77
to
+81
| sdb -d test.db plot \ | ||
| -b config.yml \ | ||
| -o concurrent-result.png \ | ||
| --series Python-RS-concurrent/ \ | ||
| series |
Comment on lines
+55
to
+57
| tasks = [session.execute(prepared, get_data(), paged=False) for _ in range(num_of_rows)] | ||
|
|
||
| await asyncio.gather(*tasks) |
Comment on lines
+12
to
+23
| async def test(session: Session, prepared: PreparedStatement, cnt: int, num_of_rows: int): | ||
| for _ in range(cnt): | ||
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=None, | ||
| paging_state=None, | ||
| ) | ||
| ) | ||
| result = await fut | ||
| assert len(result) == num_of_rows # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] | ||
|
|
Comment on lines
+12
to
+23
| async def test(session: Session, prepared: PreparedStatement, cnt: int, num_of_rows: int): | ||
| for _ in range(cnt): | ||
| fut = to_asyncio( | ||
| session.execute_async( # pyright: ignore[reportUnknownMemberType] | ||
| query=prepared, | ||
| parameters=None, | ||
| paging_state=None, | ||
| ) | ||
| ) | ||
| result = await fut | ||
| assert len(result) == num_of_rows # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] | ||
|
|
To accurately compare old Python driver to Python-Rs driver we will interact with the old driver exclusively in an asynchronous manner using asyncio. For that we need to translate `ResponseFuture` callbacks to asyncio future. This translation approach is sensible and provides at least somewhat usable interface for interaction with Python driver with minimal overhead required to make sure scheduled `RequestFuture` runs to completion.
footnote: To be consistent with asyncio usage (and actual asynchronous execution instead of awaitng immidiately in "concurrent" test scenarios) we are intentionally not using the blocking `.result()` but the asyncio compatible awaitable protocol with `to_asyncio()`.
wprzytula
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR add benchmark scenarios for the python-rs driver
Example plots generated by the benchmarker:

