Skip to content

Decoupled configuration

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 variables
Cluster cluster = new ClusterDefinition(
System.getenv("AEROSPIKE_HOST"),
3000)
.withNativeCredentials(
System.getenv("AEROSPIKE_USER"),
System.getenv("AEROSPIKE_PASSWORD"))
.connect();

Behaviors (developers)

Operational policies that developers control:

// Developer chooses behavior for their use case
Behavior readHeavyBehavior = Behavior.DEFAULT.deriveWithChanges("READ_HEAVY", b -> {});
Behavior writeHeavyBehavior = Behavior.DEFAULT.deriveWithChanges("WRITE_HEAVY", b -> {});
Session readHeavy = cluster.createSession(readHeavyBehavior);
Session writeHeavy = cluster.createSession(writeHeavyBehavior);
Session balanced = cluster.createSession(Behavior.DEFAULT);

External configuration files

Load configuration from YAML or properties files:

aerospike-config.yaml
cluster:
hosts:
- host: prod-aerospike-1.example.com
port: 3000
- host: prod-aerospike-2.example.com
port: 3000
tls:
enabled: true
cert_file: /etc/ssl/aerospike.crt

Configuration precedence

  1. Code (highest) — Explicit settings in code
  2. Environment VariablesAEROSPIKE_* variables
  3. Config Files — YAML/properties files
  4. Defaults (lowest) — Built-in sensible defaults

Next steps

Feedback

Was this page helpful?

What type of feedback are you giving?

What would you like us to know?

+Capture screenshot

Can we reach out to you?