Professional Documents
Culture Documents
What is NoSQL?
➔ Flexible Schema:
– No specific schema
– Easy to make changes
➔ Non relational database:
– No relations and tables
– So data not fixed
➔ Faster queries:
– Data not stored in tables
– So no joins and faster to query
Features
➔ Horizontal scaling:
– Also called scale out
– Bring additional nodes to share load
– Better distribution of data and load
➔ Distributed:
– Works in a distributed manner
– Allows auto scaling
➔ Simple API
Types of NoSQL Databases
KEY-VALUE:
Consistency:
The data should remain consistent even after the execution of an operation. This means once data is written, any
future read request should contain that data. For example, after updating the order status, all the clients should be
able to see the same data.
Availability:
The database should always be available and responsive. It should not have any downtime.
Partition Tolerance:
Partition Tolerance means that the system should continue to function even if the communication among the
servers is not stable. For example, the servers can be partitioned into multiple groups which may not communicate
with each other. Here, if part of the database is unavailable, other parts are always unaffected.
Sharding
- Shard means “a small part of a whole”
- Sharding involves breaking up one’s data into two or
more smaller chunks, called logical shards.
- The logical shards are then distributed across separate
database nodes, referred to as physical shards, which
can hold multiple logical shards.
- Shard key determines how to partition the dataset.
- Benefits
- Smaller, faster
- Easy to manage
- Reduces the cost of transaction
- Failure at one shard doesn’t affect the other
- Scale efficiently
- Improve response time
Sharding architectures
KEY BASED SHARDING: