3 Bda Chapter3 Answer

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

What is a key-value store?

What are the benefits of using a key-value


store?
A key-value store is a type of NoSQL database that uses a simple key-value
pair mechanism to store data.
In this model, each data item is associated with a unique key, which acts as an
identifier.
This allows for efficient retrieval and storage of data, as users can quickly access
values using their corresponding keys.
Benefits of Using a Key-Value Store
1. Simplicity and Flexibility:
o The key-value store provides a straightforward data model, making
it easy to understand and use. Users can store various types of data
(strings, JSON, binary) without a predefined schema.
o There's no rigid structure, the schema can evolve without the need
for extensive migrations.
2. High Performance:
o Key-value stores are optimized for quick access to data. Lookups,
insertions, and deletions can be performed in constant time (O(1))
due to the hashing mechanism used to store the keys.
o Key-value stores efficiently handle a large number of requests and
scale horizontally by distributing data across multiple nodes, which
is ideal for high-traffic applications.
3. Distributed Architecture:
o Many key-value stores are designed with replication and partitioning
in mind, ensuring that data remains available even in the event of
hardware failures.
o Data can be distributed across multiple servers, which helps in
balancing the load and improving access speed.
4. High Availability:
o Key-value stores replicate data across different nodes, providing
redundancy and ensuring continuous availability.
o Key-value stores support eventual consistency, which means, all
copies of the data will converge to the same value, allowing for high
availability and partition tolerance.
5. Use Cases:
o Key-value stores are commonly used for storing user sessions and
cache data due to their speed and simplicity.
o Applications requiring rapid read and write operations, such as real-
time analytics, benefit from key-value stores' performance.
Explain master-slave versus peer-to-peer in details.
Master-Slave Architecture
In the master-slave architecture, a single node acts as the master node, while
multipe nodes acts as the slaves node. The master node is responsible for
managing and coordinating tasks, while the slave nodes handle data storage and
processing tasks under the guidance of the master nodes.

Structure
 Master Node: The central control unit that:
o Manages data distribution and coordination.
o Executes read/write requests.
o Enforces consistency across the system.
o Can serve as a bottleneck for processing.

 Slave Nodes: Subordinate nodes that:


o Replicate data from the master node.
o Handle read requests and some data processing.
o Send updates back to the master node for consistency.
Use Cases
 Database Replication: Common in relational databases where one
master node handles writes operation and multiple slaves nodes handle
reads operation.
 Content Delivery Networks (CDNs): Distribute static content, where
the master nodes updates data, and slaves nodes cache content for faster
access.
Peer-to-Peer (P2P) Architecture
In a peer-to-peer architecture, all nodes (peers) are equal and can act as both
clients and servers. Each node can directly communicate with any other node in
the network, facilitating decentralized data sharing and processing.
Structure
 Peer Nodes:
o Every node in the network has equal responsibility and capability.
o Nodes can share resources, such as storage and processing power,
without requiring a central authority.
o Each node can both send and receive data, contributing to the
overall functionality of the network.
Use Cases
 File Sharing Systems: Protocols like BitTorrent rely on P2P architecture
to distribute large files efficiently.
 Blockchain Technology: Cryptocurrencies like Bitcoin use P2P
architecture for decentralized transaction validation and record-keeping.
 Collaborative Applications: Applications that require real-time
collaboration can benefit from a P2P architecture.
Describes the four ways by which big data problem are handled by
NoSQL?
1. Scalability
 NoSQL databases are built to scale out by adding more servers to the
database cluster, rather than scaling up by adding more powerful
hardware to a single server. This allows organizations to handle large
volumes of data without performance degradation.
 NoSQL databases use sharding (partitioning data across multiple servers)
to distribute the load, ensuring that no single server becomes a
bottleneck. Each shard operates independently, allowing for efficient data
processing.
2. Flexibility
 Many NoSQL databases allow for a schema-less design, meaning that the
data can be stored in various formats (JSON, XML, etc.) without predefined
schemas. Schema-less Design is flexible for managing diverse data types.
 NoSQL databases can easily accommodate changes in data structure,
allowing organizations to evolve their data models as needed without
significant overhead.
3. High Availability and Fault Tolerance
 NoSQL databases provide built-in replication, where data is copied across
multiple nodes. Replication ensures that if one node fails, another node
can take over, minimizing downtime and data loss.
 NoSQL databases is essential for big data applications that require
continuous access to data, even in the face of hardware or network
failures.
4. Optimized for Diverse Data Types
 NoSQL databases can store and manage various data types, including
structured, semi-structured, and unstructured data. This is important in big
data environments where data comes from different sources (transactional
data, machine data, and social data, etc.).
 Different types of NoSQL databases are optimized for specific use cases,
allowing organizations to choose the best model based on their data
requirements.
List and explain the core business drivers behind the NoSQL movement

There are 4 major business drivers for SQL as:


1. Volume
2. Velocity
3. Variability
4. Agility.
5. Volume:
o Organizations today generate massive amounts of data from
various sources (social media, IoT devices, transactions, etc.).
o NoSQL databases are designed to handle large volumes of
structured and unstructured data efficiently, allowing businesses to
store and analyze data at scale without the limitations of traditional
relational databases.
6. Velocity:
o The speed at which data is generated and needs to be processed
has increased dramatically.
o NoSQL databases can provide high throughput for read and write
operations, enabling real-time data processing. This is essential for
applications that require immediate insights, such as fraud
detection or dynamic pricing.
7. Variability:
o The types of data organizations work with are increasingly varied,
including text, images, video, and more.
o NoSQL databases offer flexible schemas, allowing for the storage of
different data formats without requiring a predefined schema. This
adaptability helps businesses respond to changing data
requirements quickly.
8. Agility:
o The need for faster development cycles has led to a focus on agile
methodologies in software development.
o NoSQL databases facilitate this agility by allowing developers to
iterate quickly, making changes to data structures and models
without significant overhead.
Difference between Relational database and NoSQL:
Relational Database NoSQL

It gives only read scalability. It gives both read and write


scalability.

It manages structured data. It manages all type of data.

It supports complex It supports simple transactions.


transactions.

It has single point of failure. It has no single point of failure.

Transactions written in one Transactions written in many


location. locations.
Deployed in vertical fashion. Deployed in Horizontal fashion.
SQL NoSQL

RELATIONAL DATABASE MANAGEMENT Non-relational or distributed


SYSTEM (RDBMS) database system.

These databases have fixed or static They have a dynamic schema


or predefined schema

These databases are not suited for These databases are best suited for
hierarchical data storage. hierarchical data storage.

These databases are best suited for These databases are not suited for
complex queries complex queries.

Vertically Scalable Horizontally scalable

Follows ACID property Follows CAP property

You might also like