Code Monkey home page Code Monkey logo

Comments (19)

krojew avatar krojew commented on August 15, 2024 2

I managed to get cdrs about 2x faster in that benchmark than the scylla driver. I'll push some improvements after I iron out the API.

from cdrs-tokio.

stale avatar stale commented on August 15, 2024 2

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from cdrs-tokio.

rukai avatar rukai commented on August 15, 2024 1

Alright, that makes sense.

We modified their benchmarks to run against cdrs-tokio master instead of the old cdrs-tokio version https://github.com/conorbros/rust-driver-benchmarks
We havent done a deep dive into what is causing the difference in performance though.

from cdrs-tokio.

conorbros avatar conorbros commented on August 15, 2024 1

and tested against Cassandra instead of ScyllaDB

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024 1

I will try to address some performance issues next week.

from cdrs-tokio.

Jasperav avatar Jasperav commented on August 15, 2024 1

@rukai Ah, ok now I understand what you mean. An easy workaround would be introducing owned values for Query and QueryParameters.

from cdrs-tokio.

enedil avatar enedil commented on August 15, 2024 1

In our benchmarks we had three-node cluster (on AWS), with driver application working on a separate machine, with communication over LAN. One node is really uncommon, given that both Scylla and Cassandra excel at horizontal scaling. Moreover, since you admitted that you tweaked the parameters, I think that it would be good to also modify the connection pool for the scylla rust driver to 36.
The session builder for scylla rust driver has a method pool_size (per-node). The default value is 1.

from cdrs-tokio.

enedil avatar enedil commented on August 15, 2024 1

Sure, will add such test next week. Unfortunately, I don't have access to multi-node clusters to test such configurations - if you have access to one, I would be grateful for some data.

Since a lot of work is going on with Scylla Rust Driver, we're not ready to make the benchmarks yet. However, when the time comes, we'll put crds-tokio up to a test too.

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024

cdrs-tokio is aimed to be a rust equivalent to high-level java drivers. The goal is to make it as configurable as possible, which will suit both personal and enterprise projects. scylla-rust-driver seems to be a simpler alternative, which may be appropriate for some projects, but lack features for other.

Out of curiosity - do you know which parts are slower? Since the new version is not published yet, there's still chance for optimization.

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024

Interesting - such stable numbers could indicate there's a lock somewhere blocking high concurrency. I thought I got rid of those while removing bb8.

from cdrs-tokio.

rukai avatar rukai commented on August 15, 2024

After looking at their protocol implementation I realised they use lifetimes in their protocol types to avoid a lot of allocations. This probably is the source of a lot of their speedups but lifetimes also probably mean we can't use the protocol for our project

from cdrs-tokio.

Jasperav avatar Jasperav commented on August 15, 2024

@rukai why can't you use lifetimes in your project? That doesn't make sense to me. You can query with String in the scylla-rust-driver. What are you missing?

from cdrs-tokio.

rukai avatar rukai commented on August 15, 2024

we need to pass the parsed protocol data across threads, afaik this is impossible if the types contain lifetimes.
The project itself is: https://github.com/shotover/shotover-proxy

from cdrs-tokio.

Jasperav avatar Jasperav commented on August 15, 2024

@rukai I am sure that if you have a non-compiling example code for the scylla-rust-driver, we can make it work

from cdrs-tokio.

rukai avatar rukai commented on August 15, 2024

I believe this is a fundamental part of how rust works.
Consider this example which doesnt and shouldnt compile:

struct Foo<'a> {
    foo: &'a i32,
}

fn main() {
    let value = 2i32;
    let foo = Foo { foo: &value };
    let mutex = std::sync::Mutex::new(foo);
    let arc = std::sync::Arc::new(mutex);
    std::thread::spawn(move || {
        let lock = arc.lock().unwrap();
        println!("{}", lock.foo);
    });
}

An example of a scylla type that has lifetimes that I want to send across threads is https://docs.rs/scylla/0.3.1/scylla/frame/request/query/struct.Query.html

However...
Now that i'm thinking about this again, its possible this is actually a non-issue due to the scylla types being transformed into types specific to the project before being sent over threads.
I'll have to investigate this further.

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024

I've published some performance benchmarks in README. CDRS seems to be now one of the fastest options, depending on configuration.

from cdrs-tokio.

enedil avatar enedil commented on August 15, 2024

Hey @krojew, would you mind sharing exact setup you used for making the benchmarks, with machine configurations, cluster setup, and code used for the benchmarks?

I'm asking because on the Scylla Rust driver benchmarks, it can be seen that there is a big variance of results between different drivers (even taking aside Scylla Rust driver and CDRS), while yours are all-in-all rather similar (the ratio of times doesn't exceed 2). Perhaps there's something wrong in Scyllas' benchmark setup, or in yours.

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024

@enedil I'm running the linked benchmark suite (https://github.com/conorbros/rust-driver-benchmarks) against a single cassandra node (latest image) on Ubuntu 21.10 with i9-7980xe with 32gb ram. The test code is exactly the same with the exception of additional CDRS test having a bigger connection pool (36 vs 1).

from cdrs-tokio.

krojew avatar krojew commented on August 15, 2024

Sure, will add such test next week. Unfortunately, I don't have access to multi-node clusters to test such configurations - if you have access to one, I would be grateful for some data.

from cdrs-tokio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.