Was this page helpful?
This policy has access to Metrics
shared with session, and triggers
speculative execution when the request to the current host is above a
given percentile.
To use this policy in Session
:
use std::{sync::Arc, time::Duration};
use scylla::{
Session,
SessionBuilder,
speculative_execution::PercentileSpeculativeExecutionPolicy,
transport::execution_profile::ExecutionProfile,
};
let policy = PercentileSpeculativeExecutionPolicy {
max_retry_count: 3,
percentile: 99.0,
};
let handle = ExecutionProfile::builder()
.speculative_execution_policy(Some(Arc::new(policy)))
.build()
.into_handle();
let session: Session = SessionBuilder::new()
.known_node("127.0.0.1:9042")
.default_execution_profile_handle(handle)
.build()
.await?;
Was this page helpful?