Skip to main content
Version: 3.16

ScalarDB Core Configurations

This page describes the available configurations for ScalarDB Core.

tip

If you are using ScalarDB Cluster, please refer to ScalarDB Cluster Configurations instead.

General configurations​

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

NameDescriptionDefault
scalar.db.transaction_managerTransaction manager of ScalarDB. Specify consensus-commit to use Consensus Commit or single-crud-operation to run non-transactional storage operations. Note that the configurations under the scalar.db.consensus_commit prefix are ignored if you use single-crud-operation.consensus-commit
scalar.db.consensus_commit.isolation_levelIsolation level used for Consensus Commit. Either SNAPSHOT, SERIALIZABLE, or READ_COMMITTED can be specified.SNAPSHOT
scalar.db.consensus_commit.coordinator.namespaceNamespace name of Coordinator tables used for Consensus Commit.coordinator

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. This number refers to the total number of threads across transactions in a ScalarDB Cluster node or a ScalarDB process.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
scalar.db.consensus_commit.one_phase_commit.enabledWhether or not the one-phase commit optimization is enabled.false
scalar.db.consensus_commit.coordinator.write_omission_on_read_only.enabledWhether or not the Coordinator write omission optimization is enabled for read-only transactions. This optimization is useful for read-only transactions that do not modify any data, as it avoids unnecessary writes to the Coordinator tables.true
scalar.db.consensus_commit.coordinator.group_commit.enabledWhether or not committing the transaction state is executed in batch mode. This feature can't be used with a two-phase commit interface.false
scalar.db.consensus_commit.coordinator.group_commit.slot_capacityMaximum number of slots in a group for the group commit feature. A large value improves the efficiency of group commit, but may also increase latency and the likelihood of transaction conflicts.[^1]20
scalar.db.consensus_commit.coordinator.group_commit.group_size_fix_timeout_millisTimeout to fix the size of slots in a group. A large value improves the efficiency of group commit, but may also increase latency and the likelihood of transaction conflicts.[^1]40
scalar.db.consensus_commit.coordinator.group_commit.delayed_slot_move_timeout_millisTimeout to move delayed slots from a group to another isolated group to prevent the original group from being affected by delayed transactions. A large value improves the efficiency of group commit, but may also increase the latency and the likelihood of transaction conflicts.[^1]1200
scalar.db.consensus_commit.coordinator.group_commit.old_group_abort_timeout_millisTimeout to abort an old ongoing group. A small value reduces resource consumption through aggressive aborts, but may also increase the likelihood of unnecessary aborts for long-running transactions.60000
scalar.db.consensus_commit.coordinator.group_commit.timeout_check_interval_millisInterval for checking the group commit–related timeouts.20
scalar.db.consensus_commit.coordinator.group_commit.metrics_monitor_log_enabledWhether or not the metrics of the group commit are logged periodically.false

ScalarDB has a storage (database) abstraction layer that supports multiple storage implementations. 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 JDBC databases:

NameDescriptionDefault
scalar.db.storagejdbc must be specified.-
scalar.db.contact_pointsJDBC connection URL.
scalar.db.usernameUsername to access the database.
scalar.db.passwordPassword to access the database.
scalar.db.jdbc.connection_pool.min_idleMinimum number of idle connections in the connection pool.20
scalar.db.jdbc.connection_pool.max_idleMaximum number of connections that can remain idle in the connection pool.50
scalar.db.jdbc.connection_pool.max_totalMaximum total number of idle and borrowed connections that can be active at the same time for the connection pool. Use a negative value for no limit.100
scalar.db.jdbc.prepared_statements_pool.enabledSetting this property to true enables prepared-statement pooling.false
scalar.db.jdbc.prepared_statements_pool.max_openMaximum number of open statements that can be allocated from the statement pool at the same time. Use a negative value for no limit.-1
scalar.db.jdbc.isolation_levelIsolation level for JDBC. READ_UNCOMMITTED, READ_COMMITTED, REPEATABLE_READ, or SERIALIZABLE can be specified.Underlying-database specific
scalar.db.jdbc.table_metadata.schemaSchema name for the table metadata used for ScalarDB.scalardb
scalar.db.jdbc.table_metadata.connection_pool.min_idleMinimum number of idle connections in the connection pool for the table metadata.5
scalar.db.jdbc.table_metadata.connection_pool.max_idleMaximum number of connections that can remain idle in the connection pool for the table metadata.10
scalar.db.jdbc.table_metadata.connection_pool.max_totalMaximum total number of idle and borrowed connections that can be active at the same time for the connection pool for the table metadata. Use a negative value for no limit.25
scalar.db.jdbc.admin.connection_pool.min_idleMinimum number of idle connections in the connection pool for admin.5
scalar.db.jdbc.admin.connection_pool.max_idleMaximum number of connections that can remain idle in the connection pool for admin.10
scalar.db.jdbc.admin.connection_pool.max_totalMaximum total number of idle and borrowed connections that can be active at the same time for the connection pool for admin. Use a negative value for no limit.25
scalar.db.jdbc.mysql.variable_key_column_sizeColumn size for TEXT and BLOB columns in MySQL when they are used as a primary key or secondary key. Minimum 64 bytes.128
scalar.db.jdbc.oracle.variable_key_column_sizeColumn size for TEXT and BLOB columns in Oracle when they are used as a primary key or secondary key. Minimum 64 bytes.128
scalar.db.jdbc.oracle.time_column.default_date_componentValue of the date component used for storing TIME data in Oracle. Since Oracle has no data type to only store a time without a date component, ScalarDB stores TIME data with the same date component value for ease of comparison and sorting.1970-01-01
scalar.db.jdbc.db2.variable_key_column_sizeColumn size for TEXT and BLOB columns in IBM Db2 when they are used as a primary key or secondary key. Minimum 64 bytes.128
scalar.db.jdbc.db2.time_column.default_date_componentValue of the date component used for storing TIME data in IBM Db2. Since the IBM Db2 TIMESTAMP type is used to store ScalarDB TIME type data because it provides fractional-second precision, ScalarDB stores TIME data with the same date component value for ease of comparison and sorting.1970-01-01
note

SQLite3

If you're using SQLite3 as a JDBC database, you must set scalar.db.contact_points as follows:

scalar.db.contact_points=jdbc:sqlite:<SQLITE_DB_FILE_PATH>?busy_timeout=10000

Unlike other JDBC databases, SQLite3 doesn't fully support concurrent access. To avoid frequent errors caused internally by SQLITE_BUSY, setting a busy_timeout parameter is recommended.

YugabyteDB

If you're using YugabyteDB as a JDBC database, you can specify multiple endpoints in scalar.db.contact_points as follows:

scalar.db.contact_points=jdbc:yugabytedb://127.0.0.1:5433\\,127.0.0.2:5433\\,127.0.0.3:5433/?load-balance=true

Multiple endpoints should be separated by escaped commas.

For information on YugabyteDB's smart driver and load balancing, see YugabyteDB smart drivers for YSQL.

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.

Cross-partition scan configurations​

By enabling the cross-partition scan option as described 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 ordering option 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, transactions could be executed at read-committed snapshot isolation (SNAPSHOT), which is a lower isolation level, even if you enable cross-partition scan with the SERIALIZABLE isolation level. When using non-JDBC databases, use cross-partition scan only if consistency does not matter for your transactions.

NameDescriptionDefault
scalar.db.cross_partition_scan.enabledEnable cross-partition scan.true
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
Scan fetch size​

You can configure the fetch size for storage scan operations by using the following property:

NameDescriptionDefault
scalar.db.scan_fetch_sizeSpecifies the number of records to fetch in a single batch during a storage scan operation. A larger value can improve performance for a large result set by reducing round trips to the storage, but it also increases memory usage. A smaller value uses less memory but may increase latency.10

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. If you specify -1, the cache will never expire.60
scalar.db.active_transaction_management.expiration_time_millisScalarDB maintains in-progress transactions, which can be resumed by using a transaction ID. This process expires transactions that have been idle for an extended period to prevent resource leaks. This setting specifies the expiration time of this transaction management feature in milliseconds.-1 (no expiration)
scalar.db.consensus_commit.include_metadata.enabledWhen using Consensus Commit, if this is 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
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 example - 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>