Overview
An execution profile is an immutable set of configuration options that control how queries are executed. You can create multiple profiles for different workloads and attach them to sessions or individual statements. There are two main classes of objects:- ExecutionProfile: An immutable set of execution settings
- ExecutionProfileHandle: A handle that points to an ExecutionProfile and can be remapped
Configurable Options
Execution profiles can configure the following options:- Request timeout: Client-side timeout for statement execution
- Consistency level: Default consistency for read/write operations
- Serial consistency: Default serial consistency for LWT operations
- Load balancing policy: Policy for selecting nodes to contact
- Retry policy: Policy for deciding when to retry failed requests
- Speculative execution policy: Policy for sending speculative requests
Creating a Profile
Use the builder pattern to create an execution profile:Attaching to Session
You can set a default execution profile for a session:Attaching to Statements
You can also attach profiles to individual statements:Profile Handles
Handles provide a level of indirection that enables powerful remapping capabilities:Building from Existing Profile
You can create a new profile based on an existing one:Default Values
If not specified, execution profiles use these defaults:- Consistency:
LocalQuorum - Serial consistency:
LocalSerial - Request timeout: 30 seconds
- Load balancing policy: DefaultPolicy
- Retry policy: DefaultRetryPolicy
- Speculative execution policy: None
Best Practices
- Create profiles for different workloads (e.g., latency-sensitive reads, batch writes)
- Use handles to enable dynamic workload switching
- Set reasonable timeouts to prevent hanging requests
- Choose consistency levels appropriate for your use case
- Consider using speculative execution for read-heavy latency-sensitive workloads
Next Steps
- Load Balancing - Configure how nodes are selected
- Retry Policy - Control retry behavior
- Speculative Execution - Reduce tail latencies
