ACID VS BASE
ACID VS BASE
ACID and BASE are acronyms for different database properties representing
how the database behaves during online transaction processing.
ACID
Atomicity
Atomicity ensures that all steps in a single database transaction are either
fully-completed or reverted to their original state.
For example, in a reservation system, both tasks—booking seats and
updating customer details—must be completed in a single transaction.
You cannot have seats reserved for an incomplete customer profile. No
changes are made to the data if any part of the transaction fails.
Consistency
Isolation
Durability
Durability ensures that the database maintains all committed records, even if the
system experiences failure. It guarantees that when ACID transactions are
committed, all changes are permanent and unimpacted by subsequent system
failures.
For example, in a messaging application, when a user sends a message and
receives a confirmation of successful delivery, the durability property ensures
that the message is never lost. This remains true even if the application or server
encounters a failure.
BASE
BASE stands for basically available, soft state, and eventually consistent. The
acronym highlights that BASE is opposite of ACID, like their chemical
equivalents.
Basically available
Soft state
Soft state refers to the notion that data can have transient or temporary
states that may change over time, even without external triggers or inputs.
It describes the record’s transitional state when several applications
update it simultaneously. The record’s value is eventually finalized only
after all transactions complete.
For example, if users edit a social media post, the change may not be
visible to other users immediately. However, later on, the post updates by
itself (reflecting the older change) even though no user triggered it.
Eventually consistent
Scale
Alternately, you can scale the BASE database model horizontally because it
doesn’t need to maintain strict consistency. Adding multiple nodes across the
database cluster allows the BASE model to improve its data availability, which
is the principle driving the database architecture.
Flexibility
ACID databases are less flexible when handling data. It must guarantee
immediate consistency, an ACID database may restrict access to some
applications if it experiences network or power outages. Similarly, applications
must wait for their turn to update data if other software modules are processing
a particular record.
Conversely, BASE databases are more flexible. Rather than imposing strict
restrictions, BASE allows applications to modify records when they are
available.
Performance
Synchronization
Consistency
Strict consistency Eventual consistency
model