simpleidserver / EFCore.Cassandra

Entity Framework Core provider for Cassandra
Apache License 2.0
35 stars 16 forks source link

Cluster builder detailed configuration #15

Closed pluskal closed 3 years ago

pluskal commented 3 years ago

Is there a way to access Cassandra.Builder or modify low-level CassandraCSharpDriver's connection properties?

It would be beneficial for #12 and further benchmarking (https://github.com/simpleidserver/EFCore.Cassandra/pull/14) to play with it.

Benchmarks in #14 are still about 40 times slower in comparison with the direct use of CassandraCSharpDriver on my testing machine. It seems to me that EF should not cause this much overhead but needs to be something with the configuration.

E.g., in other benchmarks, I use the following Cluster configuration to eliminate drivers/Cassandra protocols safeguards.

var clusterBuilder = Cluster
                .Builder()
                .AddContactPoints("localhost")
                .WithQueryOptions(new QueryOptions().SetConsistencyLevel(ConsistencyLevel.LocalOne))
                .WithReconnectionPolicy(new ConstantReconnectionPolicy(1000))
                .WithRetryPolicy(new DefaultRetryPolicy())
                .WithLoadBalancingPolicy(new TokenAwarePolicy(Policies.DefaultPolicies.LoadBalancingPolicy))
                .WithDefaultKeyspace(GetType().Name)
                .WithPoolingOptions(
                PoolingOptions.Create()
                    .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Remote, 1_000_000)
                    .SetMaxSimultaneousRequestsPerConnectionTreshold(HostDistance.Local, 1_000_000)
                    .SetMaxConnectionsPerHost(HostDistance.Local, 1_000_000)
                    .SetMaxConnectionsPerHost(HostDistance.Remote, 1_000_000)
                    .SetMaxRequestsPerConnection(1_000_000)
            );
simpleidserver commented 3 years ago

The project EFCore.Cassandra.Benchmarks has been updated to configure the Cluster. Please fetch the latest changes from the master branch.