Skip to main content
Version: 3.12

ScalarDB Configurations

This page describes the available configurations for ScalarDB.

ScalarDB client configurations

ScalarDB provides its own transaction protocol called Consensus Commit. You can use the Consensus Commit protocol directly through the ScalarDB client library or through ScalarDB Cluster (redirects to the Enterprise docs site), which is a component that is available only in the ScalarDB Enterprise edition.

Use Consensus Commit directly

Consensus Commit is the default transaction manager type in ScalarDB. To use the Consensus Commit transaction manager, add the following to the ScalarDB properties file:

scalar.db.transaction_manager=consensus-commit
note

If you don't specify the scalar.db.transaction_manager property, consensus-commit will be the default value.

Basic configurations

The following basic configurations are available for the Consensus Commit transaction manager:

NameDescriptionDefault
scalar.db.transaction_managerconsensus-commit should be specified.-
scalar.db.consensus_commit.isolation_levelIsolation level used for Consensus Commit. Either SNAPSHOT or SERIALIZABLE can be specified.SNAPSHOT
scalar.db.consensus_commit.serializable_strategySerializable strategy used for Consensus Commit. Either EXTRA_READ or EXTRA_WRITE can be specified. If SNAPSHOT is specified in the property scalar.db.consensus_commit.isolation_level, this configuration will be ignored.EXTRA_READ
scalar.db.consensus_commit.coordinator.namespaceNamespace name of Coordinator tables.coordinator
scalar.db.consensus_commit.include_metadata.enabledIf set to true, Get and Scan operations results will contain transaction metadata. To see the transaction metadata columns details for a given table, you can use the DistributedTransactionAdmin.getTableMetadata() method, which will return the table metadata augmented with the transaction metadata columns. Using this configuration can be useful to investigate transaction-related issues.false

The following performance-related configurations are available for the Consensus Commit transaction manager:

NameDescriptionDefault
scalar.db.consensus_commit.parallel_executor_countNumber of executors (threads) for parallel execution.128
scalar.db.consensus_commit.parallel_preparation.enabledWhether or not the preparation phase is executed in parallel.true
scalar.db.consensus_commit.parallel_validation.enabledWhether or not the validation phase (in EXTRA_READ) is executed in parallel.The value of scalar.db.consensus_commit.parallel_commit.enabled
scalar.db.consensus_commit.parallel_commit.enabledWhether or not the commit phase is executed in parallel.true
scalar.db.consensus_commit.parallel_rollback.enabledWhether or not the rollback phase is executed in parallel.The value of scalar.db.consensus_commit.parallel_commit.enabled
scalar.db.consensus_commit.async_commit.enabledWhether or not the commit phase is executed asynchronously.false
scalar.db.consensus_commit.async_rollback.enabledWhether or not the rollback phase is executed asynchronously.The value of scalar.db.consensus_commit.async_commit.enabled
scalar.db.consensus_commit.parallel_implicit_pre_read.enabledWhether or not implicit pre-read is executed in parallel.true

Underlying storage or database configurations

Consensus Commit has a storage abstraction layer and supports multiple underlying storages. You can specify the storage implementation by using the scalar.db.storage property.

Select a database to see the configurations available for each storage.

The following configurations are available for Cassandra:

NameDescriptionDefault
scalar.db.storagecassandra must be specified.-
scalar.db.contact_pointsComma-separated contact points.
scalar.db.contact_portPort number for all the contact points.
scalar.db.usernameUsername to access the database.
scalar.db.passwordPassword to access the database.
scalar.db.cassandra.metadata.keyspaceKeyspace name for the namespace and table metadata used for ScalarDB.scalardb
Multi-storage support

ScalarDB supports using multiple storage implementations simultaneously. You can use multiple storages by specifying multi-storage as the value for the scalar.db.storage property.

For details about using multiple storages, see Multi-Storage Transactions.

Use Consensus Commit through ScalarDB Cluster

ScalarDB Cluster (redirects to the Enterprise docs site) is a component that provides a gRPC interface to ScalarDB.

For details about client configurations, see the ScalarDB Cluster client configurations (redirects to the Enterprise docs site).

Cross-partition scan configurations

By enabling the cross-partition scan option below, the Scan operation can retrieve all records across partitions. In addition, you can specify arbitrary conditions and orderings in the cross-partition Scan operation by enabling cross_partition_scan.filtering and cross_partition_scan.ordering, respectively. Currently, the cross-partition scan with filtering and ordering is available only for JDBC databases. To enable filtering and ordering, scalar.db.cross_partition_scan.enabled must be set to true.

For details on how to use cross-partition scan, see Scan operation.

warning

For non-JDBC databases, we do not recommend enabling cross-partition scan with the SERIALIAZABLE isolation level because transactions could be executed at a lower isolation level (that is, SNAPSHOT). When using non-JDBC databases, use cross-partition scan at your own risk only if consistency does not matter for your transactions.

NameDescriptionDefault
scalar.db.cross_partition_scan.enabledEnable cross-partition scan.false
scalar.db.cross_partition_scan.filtering.enabledEnable filtering in cross-partition scan.false
scalar.db.cross_partition_scan.ordering.enabledEnable ordering in cross-partition scan.false

Other ScalarDB configurations

The following are additional configurations available for ScalarDB:

NameDescriptionDefault
scalar.db.metadata.cache_expiration_time_secsScalarDB has a metadata cache to reduce the number of requests to the database. This setting specifies the expiration time of the cache in seconds.-1 (no expiration)
scalar.db.active_transaction_management.expiration_time_millisScalarDB maintains ongoing transactions, which can be resumed by using a transaction ID. This setting specifies the expiration time of this transaction management feature in milliseconds.-1 (no expiration)
scalar.db.default_namespace_nameThe given namespace name will be used by operations that do not already specify a namespace.

Placeholder usage

You can use placeholders in the values, and they are replaced with environment variables (${env:<ENVIRONMENT_VARIABLE_NAME>}) or system properties (${sys:<SYSTEM_PROPERTY_NAME>}). You can also specify default values in placeholders like ${sys:<SYSTEM_PROPERTY_NAME>:-<DEFAULT_VALUE>}.

The following is an example of a configuration that uses placeholders:

scalar.db.username=${env:<SCALAR_DB_USERNAME>:-admin}
scalar.db.password=${env:<SCALAR_DB_PASSWORD>}

In this example configuration, ScalarDB reads the username and password from environment variables. If the environment variable SCALAR_DB_USERNAME does not exist, ScalarDB uses the default value admin.

Configuration examples

This section provides some configuration examples.

Configuration example #1 - App and database

In this example configuration, the app (ScalarDB library with Consensus Commit) connects to an underlying storage or database (in this case, Cassandra) directly.

warning

This configuration exists only for development purposes and isn’t suitable for a production environment. This is because the app needs to implement the Scalar Admin interface to take transactionally consistent backups for ScalarDB, which requires additional configurations.

The following is an example of the configuration for connecting the app to the underlying database through ScalarDB:

# Transaction manager implementation.
scalar.db.transaction_manager=consensus-commit

# Storage implementation.
scalar.db.storage=cassandra

# Comma-separated contact points.
scalar.db.contact_points=<CASSANDRA_HOST>

# Credential information to access the database.
scalar.db.username=<USERNAME>
scalar.db.password=<PASSWORD>

Configuration example #2 - App, ScalarDB Cluster, and database

In this example configuration, the app (ScalarDB library with gRPC) connects to an underlying storage or database (in this case, Cassandra) through ScalarDB Cluster, which is a component that is available only in the ScalarDB Enterprise edition.

note

This configuration is acceptable for production use because ScalarDB Cluster implements the Scalar Admin interface, which enables you to take transactionally consistent backups for ScalarDB by pausing ScalarDB Cluster.

The following is an example of the configuration for connecting the app to the underlying database through ScalarDB Cluster:

# Transaction manager implementation.
scalar.db.transaction_manager=cluster

# Contact point of the cluster.
scalar.db.contact_points=indirect:<SCALARDB_CLUSTER_CONTACT_POINT>

For details about client configurations, see the ScalarDB Cluster client configurations (redirects to the Enterprise docs site).