SystemSettings

class aerospike_sdk.policy.system_settings.SystemSettings[source]

Bases: object

Cluster-wide settings that apply to an entire cluster instance.

These settings cannot vary per Behavior – they are inherently global to the connection pool and cluster maintenance.

Settings may also come from an SDK configuration file (the AEROSPIKE_SDK_CONFIG_URL environment variable). File-provided values take precedence over values set here, field by field: a field the file does not provide falls through to this object, then to the hard default.

Example:

settings = SystemSettings(
    max_connections_per_node=200,
    max_socket_idle_time=timedelta(seconds=30),
)
cluster = await (
    ClusterDefinition("localhost", 3000)
    .with_system_settings(settings)
    .connect()
)

wait_for_connection_to_complete bounds how long the pool may spend establishing one connection (TCP connect, TLS, authentication). It lives here rather than on a Behavior because the pool does the connecting and the pool is client-scoped: commands never open connections inline, so there is no per-operation moment for a connect bound to govern. Unset, it falls back to the client policy’s total timeout.

tend_timeout bounds each cluster-tend info call, the first contact with a seed included; login_timeout bounds the login exchange on every new connection when the cluster has security enabled. Both are client-wide for the same reason, so they live here rather than on the cluster definition. Unset, the hard defaults are one second and five seconds. Neither has a key in the configuration file.

Connection-pool sizing is the group most worth setting explicitly. Left unset, the hard defaults are min_connections_per_node=0, max_connections_per_node=256, and conn_pools_per_node=1. The maximum is a fail-fast cap rather than a queue, so a client whose concurrency outgrows it becomes pool-bound – throughput flattens and latency climbs while the cluster still has headroom. Size it to total client concurrency, not to concurrency divided by node count, since bursts do not spread evenly across nodes.

See also

TransactionSettings: The SDK-runtime transaction group. with_system_settings()

min_connections_per_node: int | None = None
max_connections_per_node: int | None = None
conn_pools_per_node: int | None = None
wait_for_connection_to_complete: timedelta | None = None
tend_timeout: timedelta | None = None
login_timeout: timedelta | None = None
max_socket_idle_time: timedelta | None = None
tend_interval: timedelta | None = None
num_tend_intervals_in_error_window: int | None = None
max_errors_in_error_window: int | None = None
transactions: TransactionSettings = TransactionSettings(implicit_batch_write_transactions=None, sleep_between_attempts=None, number_of_attempts=None)
metrics: MetricsSettings = MetricsSettings(enabled=None, latency_unit=None, latency_columns=None, latency_shift=None, export_interval=None, exporter=None, report_dir=None, report_size_limit=None, sampler_range=None, sampler_threshold=None, labels=None, operational_enabled=None, usage_enabled=None)
apply_to(policy)[source]

Apply non-None fields to policy, returning the same object.

The transactions group is SDK-runtime configuration and is deliberately not applied; it is read at operation time.

Return type:

ClientPolicy

__init__(*, min_connections_per_node=None, max_connections_per_node=None, conn_pools_per_node=None, wait_for_connection_to_complete=None, tend_timeout=None, login_timeout=None, max_socket_idle_time=None, tend_interval=None, num_tend_intervals_in_error_window=None, max_errors_in_error_window=None, transactions=TransactionSettings(implicit_batch_write_transactions=None, sleep_between_attempts=None, number_of_attempts=None), metrics=MetricsSettings(enabled=None, latency_unit=None, latency_columns=None, latency_shift=None, export_interval=None, exporter=None, report_dir=None, report_size_limit=None, sampler_range=None, sampler_threshold=None, labels=None, operational_enabled=None, usage_enabled=None))

TransactionSettings

class aerospike_sdk.policy.system_settings.TransactionSettings[source]

Bases: object

SDK-runtime transaction behavior, read at operation time.

Unlike the connection and refresh groups on SystemSettings, these fields do not map onto ClientPolicy; they configure how the SDK itself drives multi-record transactions. None means “not set” — the value falls through to the next configuration layer (see SystemSettings for layering), ending at the hard defaults: implicit_batch_write_transactions True, number_of_attempts 10, sleep_between_attempts 20 ms.

implicit_batch_write_transactions controls whether a multi-key write batch on a strong-consistency namespace (MRT-capable cluster, no explicit transaction active) is wrapped in an implicit multi-record transaction so its writes commit atomically. number_of_attempts and sleep_between_attempts drive the retry loop for those implicit transactions, and for do_in_transaction(), when an attempt ends in a transient conflict. number_of_attempts counts the first try. A version mismatch retries immediately; a blocked record or failed commit sleeps sleep_between_attempts +/- 50% (jittered, so the mean is unchanged) first.

Example:

settings = SystemSettings(
    transactions=TransactionSettings(
        implicit_batch_write_transactions=False,
    ),
)
cluster = await (
    ClusterDefinition("localhost", 3000)
    .with_system_settings(settings)
    .connect()
)

See also

SystemSettings: Carrier for these settings.

implicit_batch_write_transactions: bool | None = None
sleep_between_attempts: timedelta | None = None
number_of_attempts: int | None = None
__init__(*, implicit_batch_write_transactions=None, sleep_between_attempts=None, number_of_attempts=None)