Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Benchmark deserialization #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
Loading
from
Open

Benchmark deserialization #198

wants to merge 7 commits into from

Conversation

Stapox35
Copy link
Contributor

@Stapox35 Stapox35 commented Apr 29, 2025

Add 4 new benchmarks:

  • concurrent deserialization

This benchmark uses executeConcurrent endpoint to insert n rows containing uuid, int, timeuuid, inet, date, time into the database. Afterwards it uses executeConcurrent endpoint to select all (n) of the inserted rows from the database n times.

JS:

node concurrent_deser.js <driver> <Number of queries>

Rust:

CNT=<Number of queries> cargo run --bin concurrent_deser_benchmark -r
  • deserialization

This benchmark executes n client.execute queries, that insert a single row containing uuid, int, timeuuid, inet, date, time waiting for the result of the previous query before executing the next one. Afterwards it executes n client.execute queries, that select all (n) of the inserted rows, waiting for the result of the previous query before executing the next one.

JS:

node deser.js <driver> <Number of queries>

Rust:

CNT=<Number of queries> cargo run --bin deser_benchmark -r
  • concurrent serialization

This benchmark uses executeConcurrent endpoint to insert n*n rows containing uuid, int, timeuuid, inet, date, time into the database.

JS:

node concurrent_ser.js <driver> <Number of queries>

Rust:

CNT=<Number of queries> cargo run --bin concurrent_ser_benchmark -r
  • serialization

This benchmark executes n*n client.execute queries, that insert a single row containing uuid, int, timeuuid, inet, date, time waiting for the result of the previous query before executing the next one.

JS:

node ser.js <driver> <Number of queries>

Rust:

CNT=<Number of queries> cargo run --bin ser_benchmark -r

@Stapox35 Stapox35 force-pushed the benchmark-serialize branch from f0ba260 to 6a93dfb Compare April 29, 2025 10:41
@Stapox35 Stapox35 marked this pull request as draft April 29, 2025 10:44
@Stapox35 Stapox35 self-assigned this Apr 29, 2025
@ZuzaOsa ZuzaOsa requested a review from Copilot April 29, 2025 11:36
Copilot

This comment was marked as abuse.

@Stapox35 Stapox35 force-pushed the benchmark-serialize branch from 540f93e to 03f999f Compare May 6, 2025 10:21
@Stapox35 Stapox35 marked this pull request as ready for review May 6, 2025 10:31
@Stapox35 Stapox35 requested review from ZuzaOsa, adespawn and wprzytula May 6, 2025 10:32
@ZuzaOsa ZuzaOsa requested a review from Copilot May 6, 2025 10:39
Copilot

This comment was marked as abuse.

ZuzaOsa
ZuzaOsa previously approved these changes May 6, 2025
@Stapox35 Stapox35 force-pushed the benchmark-serialize branch from ee940a2 to 6b118d8 Compare May 6, 2025 11:08
@Stapox35 Stapox35 changed the title Benchmark serialize Benchmark deserialization May 6, 2025
@Stapox35 Stapox35 force-pushed the benchmark-serialize branch from 0df8858 to 39998cc Compare May 6, 2025 12:54
@wprzytula
Copy link
Contributor

@Stapox35 If you already have charts drawn using code from this PR, please upload them here in a comment.

benchmark/README.md Outdated Show resolved Hide resolved
benchmark/logic/concurrent_deser.js Outdated Show resolved Hide resolved
benchmark/logic/ser.js Outdated Show resolved Hide resolved
benchmark/logic_rust/concurrent_deser.rs Outdated Show resolved Hide resolved
function createKeyspace(next) {
// Keep replication one to reduce time spent in the database
const query =
"CREATE KEYSPACE IF NOT EXISTS benchmarks WITH replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': '1' }";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌱 We should compare results with tablets turned on and off.

benchmark/runner.py Show resolved Hide resolved
@Stapox35 Stapox35 force-pushed the benchmark-serialize branch 3 times, most recently from 3e309f1 to 268b8d0 Compare May 12, 2025 21:44
@Stapox35 Stapox35 requested review from adespawn and wprzytula May 13, 2025 10:37
benchmark/logic/utils.js Outdated Show resolved Hide resolved
benchmark/logic/deser.js Outdated Show resolved Hide resolved
benchmark/logic/deser.js Outdated Show resolved Hide resolved
use std::sync::Arc;
use uuid::Uuid;

const CONCURRENCY: usize = 2000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ 🤔 Here I can see CONCURRENCY hard-coded. I don't see an equivalent constant in JS benchark code. Where is it?

Comment on lines +89 to +126
let mut handles = vec![];
let session = Arc::new(session);

for i in 0..CONCURRENCY {
let session_clone = Arc::clone(&session);
let insert_query_clone = insert_query.clone();
handles.push(tokio::spawn(async move {
insert_data(session_clone, i, n, &insert_query_clone)
.await
.unwrap();
}));
}

let results = join_all(handles).await;

for result in results {
result.unwrap();
}

let select_query = session.prepare("SELECT * FROM benchmarks.basic").await?;

let mut handles = vec![];

for i in 0..CONCURRENCY {
let session_clone = Arc::clone(&session);
let select_query_clone = select_query.clone();
handles.push(tokio::spawn(async move {
select_data(session_clone, i, n, &select_query_clone)
.await
.unwrap();
}));
}

let results = join_all(handles).await;

for result in results {
result.unwrap();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 The logic is duplicated. Please extract the common part to a higher-order function that will accept a closure/Future performing the action. Hint: I'd make the function accept impl Future<Item = Vec<Result<QueryResult, ExecutionError>>>.

benchmark/runner.py Outdated Show resolved Hide resolved
@adespawn adespawn force-pushed the benchmark-serialize branch from 044b350 to b9c72a6 Compare May 14, 2025 19:43
@ZuzaOsa ZuzaOsa requested a review from Copilot May 16, 2025 07:58
Copilot

This comment was marked as abuse.

@adespawn adespawn added this to the Benchmark day milestone May 17, 2025
@adespawn adespawn force-pushed the benchmark-serialize branch from b9c72a6 to edf2fc7 Compare May 25, 2025 18:38
adespawn
adespawn previously approved these changes May 26, 2025
Base automatically changed from second-iteration to main June 25, 2025 12:49
@adespawn adespawn dismissed stale reviews from ZuzaOsa and themself June 25, 2025 12:49

The base branch was changed.

@wprzytula
Copy link
Contributor

wprzytula commented Jun 25, 2025

I'd really like to see this merged. Can we get this mergeable soon?

@Stapox35 Stapox35 force-pushed the benchmark-serialize branch from edf2fc7 to 80200da Compare July 1, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.