DynomiteDB allows you to tune the amount of consistency in your cluster. DynomiteDB’s tunable consistency supports both eventual consistency and immediate consistency within the local data center (DC). The consistency level is set on a cluster-wide basis for both reads and writes.
Tunable consistency means that you can choose between eventual consistency which optimizes for high performance, high availability and high throughput vs. immediate consistency within the local DC which optimizes for data consistency. The downside to eventual consistency is the potential for stale reads, while the downside to immediate consistency are higher latency and lower availability.
Dynomite added support for tunable consistency in version 0.5.3.
Consistency level (CL) determines how many nodes must acknowledge a given read or write request. Consistency level is tunable on a cluster-wide basis and defaults to DC_ONE
.
DynomiteDB supports two consistency levels:
CL = DC_ONE
provides the best performance, lowest latency, highest availability and highest throughput at the expense of a few milliseconds of eventual consistency. However, if your application requires immediate consistency within the local DC then you should use CL = DC_QUORUM
.
Consistency level on write requests controls how many replicas must acknowledge that they received and wrote the key/value pair. Consistency level on read requests controls how many replicas must acknowledge the request by sending their most recent copy of the key/value pair to the coordinator.
Consistency level | Description |
---|---|
DC_ONE |
|
DC_QUORUM |
|
You can configure the consistency level (CL) for reads and writes separately. The two types of CL configuration are:
The read and write CL can be configured in two ways:
dynomite.yaml
fileYou can configure the read CL and write CL in dynomite.yaml
via the read_consistency
and write_consistency
keys. The possible values for each of the CL keys are dc_one
(the default) and dc_quorum
.
The
dynomite.yaml
is read once bydynomite
during startup.
dyn_o_mite:
...
read_consistency: dc_quorum
write_consistency: dc_quorum
You can configure the read CL without restarting dynomite
via the admin port. By default, the admin port is set to 22222
.
curl http://localhost:22222/set_consistency/read/dc_quorum
As with the read CL above, you can set the write CL using the admin port.
curl http://localhost:22222/set_consistency/write/dc_quorum
You can view the current read CL and write CL configuration via the admin port as shown below.
curl http://localhost:22222/get_consistency
The curl
command above will display the current CLs as follows:
Read Consistency: DC_QUORUM
Write Consistency: DC_QUORUM