Decoupled configuration
For the complete documentation index see: llms.txt
All documentation pages available in markdown.
The Developer SDK separates connection configuration from operational behavior, giving operators and developers independent control.
Why decoupled configuration?
Traditional clients mix connection settings with operation policies, making it hard to:
- Change timeouts without code changes
- Use different configurations per environment
- Let operators tune behavior without developer involvement
The Developer SDK solves this with three layers:
┌─────────────────────────────────────────┐│ Application Code ││ (uses Session, calls operations) │├─────────────────────────────────────────┤│ Behaviors ││ (operational policies, developer-set) │├─────────────────────────────────────────┤│ Cluster Configuration ││ (connection details, operator-set) │└─────────────────────────────────────────┘Cluster configuration (operators)
Connection details that operators control:
import com.aerospike.client.sdk.Cluster;import com.aerospike.client.sdk.ClusterDefinition;
// From environment variablesCluster cluster = new ClusterDefinition( System.getenv("AEROSPIKE_HOST"), 3000) .withNativeCredentials( System.getenv("AEROSPIKE_USER"), System.getenv("AEROSPIKE_PASSWORD")) .connect();📖 API reference:
ClusterDefinition.connect()|ClusterDefinition.withNativeCredentials(...)
import os
from aerospike_sdk import ClusterDefinition
# From environment variablescluster = await ClusterDefinition( os.environ["AEROSPIKE_HOST"], 3000,).with_native_credentials( os.environ.get("AEROSPIKE_USER"), os.environ.get("AEROSPIKE_PASSWORD"),).connect()📖 API reference:
ClusterDefinition
Behaviors (developers)
Operational policies that developers control:
import java.time.Duration;import com.aerospike.client.sdk.policy.Behavior.Selectors;
// Developer chooses behavior for their use caseBehavior readFast = Behavior.DEFAULT.deriveWithChanges("READ_FAST", builder -> builder .on(Selectors.reads(), ops -> ops .waitForCallToComplete(Duration.ofMillis(50)) .abandonCallAfter(Duration.ofMillis(200)) .maximumNumberOfCallAttempts(4)));
Session readHeavy = cluster.createSession(readFast);Session writeHeavy = cluster.createSession(Behavior.DEFAULT);Session balanced = cluster.createSession(Behavior.DEFAULT);📖 API reference:
Cluster.createSession(Behavior)
# Developer chooses behavior for their use caseread_heavy = cluster.create_session(Behavior.READ_FAST)write_heavy = cluster.create_session(Behavior.DEFAULT)balanced = cluster.create_session(Behavior.DEFAULT)📖 API reference:
Behavior.DEFAULT
External configuration files
Set the AEROSPIKE_SDK_CONFIG_URL environment variable to the path of a YAML file before you connect. Both SDKs read the same file format at connect() with snake_case keys and reload it when it changes. The behaviors section defines named behaviors. The system section holds the following client-wide profiles: connection pool, circuit breaker, tend interval, transaction and metrics settings. Connection details such as hosts and TLS are in ClusterDefinition.
behaviors: read-heavy: all_operations: abandon_call_after: 200ms wait_for_call_to_complete: 50ms maximum_number_of_call_attempts: 4system: DEFAULT: # applies to every cluster connections: maximum_connections_per_node: 200 transactions: number_of_attempts: 3 sleep_between_attempts: 250ms production: # applies to a cluster named production transactions: number_of_attempts: 5Look up a behavior from the file by name with Behavior.getBehavior("read-heavy") in Java or get_behavior_or_default("read-heavy") from aerospike_sdk.policy in Python. Both return DEFAULT when the name is not defined.
Configuration precedence
System settings resolve per field, highest first. A field one layer doesn’t set falls through to the next.
- The config file’s profile for the cluster:
system.<cluster-name>, for the name set withclusterName(...)in Java orcluster_name(...)in Python - The config file’s
DEFAULTprofile - Code: settings passed with
withSystemSettings(...)in Java orwith_system_settings(...)in Python - Built-in defaults
With the file above, a cluster named production makes 5 transaction attempts, 250 ms apart.