struct CassExecProfile
An execution profile object provides a mechanism to group together a set of configuration options and reuse them across different statement executions. This feature is useful when dealing with different query workloads.
Functions
CassExecProfile *
cass_execution_profile_new
( )Creates a new execution profile.
Frees a execution profile instance.
CassError
cass_execution_profile_set_request_timeout
(CassExecProfile *
profile, cass_uint64_t
timeout_ms )
Sets the timeout waiting for a response from a node.
Default: Disabled (uses the cluster request timeout)
CassError
cass_execution_profile_set_consistency
(CassExecProfile *
profile, CassConsistency
consistency )
Sets the consistency level.
Default: Disabled (uses the default consistency)
CassError
cass_execution_profile_set_serial_consistency
(CassExecProfile *
profile, CassConsistency
serial_consistency )
Sets the serial consistency level.
Default: Disabled (uses the default serial consistency)
Configures the execution profile to use round-robin load balancing.
The driver discovers all nodes in a cluster and cycles through them per request. All are considered ‘local’.
Note: Profile-based load balancing policy is disabled by default; cluster load balancing policy is used when profile does not contain a policy.
CassError
cass_execution_profile_set_load_balance_dc_aware
(CassExecProfile *
profile, const char *
local_dc, unsigned
used_hosts_per_remote_dc, cass_bool_t
allow_remote_dcs_for_local_cl )
Configures the execution profile to use DC-aware load balancing. For each query, all live nodes in a primary ‘local’ DC are tried first, followed by any node from other DCs.
Note: Profile-based load balancing policy is disabled by default; cluster load balancing policy is used when profile does not contain a policy.
Deprecated:
The remote DC settings for DC-aware are not suitable for most scenarios that require DC failover. There is also unhandled gap between replication factor number of nodes failing and the full cluster failing. Only the remote DC settings are being deprecated.
CassError
cass_execution_profile_set_load_balance_dc_aware_n
(CassExecProfile *
profile, const char *
local_dc, size_t
local_dc_length, unsigned
used_hosts_per_remote_dc, cass_bool_t
allow_remote_dcs_for_local_cl )
Same as CassExecProfile::cass_execution_profile_set_load_balance_dc_aware
, but with lengths for string parameters.
Deprecated:
The remote DC settings for DC-aware are not suitable for most scenarios that require DC failover. There is also unhandled gap between replication factor number of nodes failing and the full cluster failing. Only the remote DC settings are being deprecated.
CassError
cass_execution_profile_set_token_aware_routing
(CassExecProfile *
profile, cass_bool_t
enabled )
Configures the execution profile to use token-aware request routing or not.
Important: Token-aware routing depends on keyspace metadata. For this reason enabling token-aware routing will also enable retrieving and updating keyspace schema metadata.
Default: cass_true (enabled).
This routing policy composes the base routing policy, routing requests first to replicas on nodes considered ‘local’ by the base load balancing policy.
Note: Execution profiles use the cluster-level load balancing policy unless enabled. This setting is not applicable unless a load balancing policy is enabled on the execution profile.
CassError
cass_execution_profile_set_token_aware_routing_shuffle_replicas
(CassExecProfile *
profile, cass_bool_t
enabled )
Configures the execution profile’s token-aware routing to randomly shuffle replicas. This can reduce the effectiveness of server-side caching, but it can better distribute load over replicas for a given partition key.
Note: Token-aware routing must be enabled and a load balancing policy must be enabled on the execution profile for the setting to be applicable.
Default: cass_true (enabled).
CassError
cass_execution_profile_set_latency_aware_routing
(CassExecProfile *
profile, cass_bool_t
enabled )
Configures the execution profile to use latency-aware request routing or not.
Note: Execution profiles use the cluster-level load balancing policy unless enabled. This setting is not applicable unless a load balancing policy is enabled on the execution profile.
Default: cass_false (disabled).
This routing policy is a top-level routing policy. It uses the base routing policy to determine locality (dc-aware) and/or placement (token-aware) before considering the latency.
CassError
cass_execution_profile_set_latency_aware_routing_settings
(CassExecProfile *
profile, cass_double_t
exclusion_threshold, cass_uint64_t
scale_ms, cass_uint64_t
retry_period_ms, cass_uint64_t
update_rate_ms, cass_uint64_t
min_measured )
Configures the execution profile’s settings for latency-aware request routing.
Note: Execution profiles use the cluster-level load balancing policy unless enabled. This setting is not applicable unless a load balancing policy is enabled on the execution profile.
Defaults:
- exclusion_threshold: 2.0
- scale_ms: 100 milliseconds
- retry_period_ms: 10,000 milliseconds (10 seconds)
- update_rate_ms: 100 milliseconds
- min_measured: 50
CassError
cass_execution_profile_set_whitelist_filtering
(CassExecProfile *
profile, const char *
hosts )
Sets/Appends whitelist hosts for the execution profile. The first call sets the whitelist hosts and any subsequent calls appends additional hosts. Passing an empty string will clear and disable the whitelist. White space is striped from the hosts.
This policy filters requests to all other policies, only allowing requests to the hosts contained in the whitelist. Any host not in the whitelist will be ignored and a connection will not be established. This policy is useful for ensuring that the driver will only connect to a predefined set of hosts.
Examples: “127.0.0.1” “127.0.0.1,127.0.0.2”
Note: Execution profiles use the cluster-level load balancing policy unless enabled. This setting is not applicable unless a load balancing policy is enabled on the execution profile.
CassError
cass_execution_profile_set_whitelist_filtering_n
(CassExecProfile *
profile, const char *
hosts, size_t
hosts_length )
Same as CassExecProfile::cass_execution_profile_set_whitelist_filtering
, but with lengths for string parameters.
CassError
cass_execution_profile_set_blacklist_filtering
(CassExecProfile *
profile, const char *
hosts )
Sets/Appends blacklist hosts for the execution profile. The first call sets the blacklist hosts and any subsequent calls appends additional hosts. Passing an empty string will clear and disable the blacklist. White space is striped from the hosts.
This policy filters requests to all other policies, only allowing requests to the hosts not contained in the blacklist. Any host in the blacklist will be ignored and a connection will not be established. This policy is useful for ensuring that the driver will not connect to a predefined set of hosts.
Examples: “127.0.0.1” “127.0.0.1,127.0.0.2”
Note: Execution profiles use the cluster-level load balancing policy unless enabled. This setting is not applicable unless a load balancing policy is enabled on the execution profile.
CassError
cass_execution_profile_set_blacklist_filtering_n
(CassExecProfile *
profile, const char *
hosts, size_t
hosts_length )
Same as CassExecProfile::cass_execution_profile_set_blacklist_filtering
, but with lengths for string parameters.
CassError
cass_execution_profile_set_whitelist_dc_filtering
(CassExecProfile *
profile, const char *
dcs )
Same as CassExecProfile::cass_execution_profile_set_whitelist_filtering
, but whitelist all hosts of a dc.
Examples: “dc1”, “dc1,dc2”
CassError
cass_execution_profile_set_whitelist_dc_filtering_n
(CassExecProfile *
profile, const char *
dcs, size_t
dcs_length )
Same as CassExecProfile::cass_execution_profile_set_whitelist_dc_filtering
, but with lengths for string parameters.
CassError
cass_execution_profile_set_blacklist_dc_filtering
(CassExecProfile *
profile, const char *
dcs )
Same as CassExecProfile::cass_execution_profile_set_blacklist_filtering
, but blacklist all hosts of a dc.
Examples: “dc1”, “dc1,dc2”
CassError
cass_execution_profile_set_blacklist_dc_filtering_n
(CassExecProfile *
profile, const char *
dcs, size_t
dcs_length )
Same as CassExecProfile::cass_execution_profile_set_blacklist_dc_filtering
, but with lengths for string parameters.
CassError
cass_execution_profile_set_retry_policy
(CassExecProfile *
profile, CassRetryPolicy *
retry_policy )
Sets the execution profile’s retry policy.
Note: Profile-based retry policy is disabled by default; cluster retry policy is used when profile does not contain a policy unless the retry policy was explicitly set on the batch/statement request.
CassError
cass_execution_profile_set_constant_speculative_execution_policy
(CassExecProfile *
profile, cass_int64_t
constant_delay_ms, int
max_speculative_executions )
Enable constant speculative executions with the supplied settings for the execution profile.
Note: Profile-based speculative execution policy is disabled by default; cluster speculative execution policy is used when profile does not contain a policy.
Disable speculative executions for the execution profile.
Note: Profile-based speculative execution policy is disabled by default; cluster speculative execution policy is used when profile does not contain a policy.