Nosql What Does It Mean
Nosql What Does It Mean
Nosql What Does It Mean
Distribution Models:
Aggregate oriented databases make distribution of data easier,
since the distribution mechanism has to move the aggregate and
not have to worry about related data, as all the related data is
contained in the aggregate. There are two styles of distributing
data:
CAP theorem:
In a distributed system, managing consistency(C), availability(A)
and partition toleration(P) is important, Eric Brewer put forth the
CAP theorem which states that in any distributed system we can
choose only two of consistency, availability or partition tolerance.
Many NoSQL databases try to provide options where the
developer has choices where they can tune the database as per
their needs. For example if you consider Riak a distributed key-
value database. There are essentially three variables r, w, n
where
r=number of nodes that should respond to a read request
before its considered successful.
w=number of nodes that should respond to a write request
before its considered successful.
n=number of nodes where the data is replicated aka
replication factor.
In a Riak cluster with 5 nodes, we can tweak the r,w,n values to
make the system very consistent by setting r=5 and w=5 but
now we have made the cluster susceptible to network partitions
since any write will not be considered successful when any node
is not responding. We can make the same cluster highly available
for writes or reads by setting r=1 and w=1 but now consistency
can be compromised since some nodes may not have the latest
copy of the data. The CAP theorem states that if you get a
network partition, you have to trade off availability of data versus
consistency of data. Durability can also be traded off against
latency, particularly if you want to survive failures with replicated
data.
Key-Value databases
Key-value stores are the simplest NoSQL data stores to use from
an API perspective. The client can either get the value for the
key, put a value for a key, or delete a key from the data store.
The value is a blob that the data store just stores, without caring
or knowing what's inside; it's the responsibility of the application
to understand what was stored. Since key-value stores always
use primary-key access, they generally have great performance
and can be easily scaled.
Document databases
Since most of the power from the graph databases comes from
the relationships and their properties, a lot of thought and design
work is needed to model the relationships in the domain that we
are trying to work with. Adding new relationship types is easy;
changing existing nodes and their relationships is similar to data
migration, because these changes will have to be done on each
node and each relationship in the existing data.
Conclusion
All the choice provided by the rise of NoSQL databases does not
mean the demise of RDBMS databases. We are entering an era of
polyglot persistence, a technique that uses different data storage
technologies to handle varying data storage needs. Polyglot
persistence can apply across an enterprise or within a single
application.