4 Distributed Databases Nosql Systems And Bigdata

Advanced Database Ā· Unit 4 Ā· 12 hrs

Distributed Databases, NOSQL Systems, and BigData

Exam-focused notes for Distributed Databases, NOSQL Systems, and BigData (Advanced Database, CSC475): what the TU syllabus asks and how it has actually been tested, with 12 solved past questions from this unit.

Distributed Databases, NOSQL Systems, and BigData in short

This unit moves data outside a single machine: distributed database concepts, fragmentation, replication and distributed transactions, then the NoSQL and big-data systems that trade some of the relational model's guarantees for horizontal scale.

Distributed Databases, NOSQL Systems, and BigData: notes

Distributed Database Concepts and Advantages

A distributed database is a single logical database whose data is stored across multiple, possibly geographically dispersed, nodes connected by a network, combining data distribution (partitioning data across nodes) with data replication (keeping copies for fault tolerance) to give better scalability, fault tolerance and performance than one centralized machine. Its advantages are that it reflects an organization's naturally distributed structure, keeps operating despite a single node's failure, lets each site handle only part of the workload, grows modularly by adding sites, and integrates components from different vendors. Its costs are real too: distributed databases are more complex to build and administer, cost more to run, lack mature standards and experienced staff compared to centralized systems, and require the network itself, not just the data, to be secured.

Because no single node can see the whole database at once, a distributed system provides distribution transparency, hiding the distribution from the user's queries: fragmentation transparency means a query does not need to know a table has been split into pieces; replication transparency means it does not need to know how many copies of a fragment exist; and location transparency means it does not need to know which physical site holds the data it wants.

Distributing a write across several sites also raises the problem of committing (or aborting) a transaction atomically everywhere at once. The standard solution is the two-phase commit (2PC) protocol, run by one coordinator and several participants, in two ordered phases. In the voting (prepare) phase, the coordinator sends PREPARE to every participant; each does the work up to the commit point, writes an undo/redo log record, and replies VOTE-COMMIT if ready or VOTE-ABORT if not. In the decision (commit) phase, if every participant voted commit, the coordinator logs the global decision and sends GLOBAL-COMMIT, and each participant commits and acknowledges; if any voted abort or timed out, the coordinator sends GLOBAL-ABORT instead, and every participant rolls back. Failure handling is what makes 2PC subtle: a participant that crashes before voting is simply timed out and treated as an abort, but one that already voted commit and is waiting for the decision is blocked, unable to safely commit or abort alone until it hears from the coordinator (or, in extended protocols, another informed participant); a coordinator that crashes after logging its decision recovers by replaying that logged decision to whichever participants are still waiting.

What this unit covers

  • Distributed Database Concepts and Advantages
  • Data Fragmentation, Replication and Allocation Techniques for Distributed Database Design
  • Types of Distributed Database Systems
  • Distributed Database Architectures
  • Introduction to NOSQL Systems
  • The CAP Theorem
  • Document-based, Key-value Stores, Column-based, and Graph-based Systems
  • BigData
  • MapReduce
  • Hadoop

Distributed Database Architectures

2081 Ā· 10 marks

Explain different distributed database architectures. What is data fragmentation?[10]

A distributed database system (DDBS) is a collection of logically interrelated databases distributed over a computer network, where data is stored across multiple nodes and managed as a single unified system. --- In a homogeneous distributed database system, all participating nodes use the same D...

Open this answer on its own page →

The CAP Theorem

2081 Ā· 5 marks

What is the CAP theorem? Explain. [5]

Show solved answer

CAP Theorem

Definition

The CAP Theorem (also known as Brewer's Theorem) is a theoretical framework in distributed database systems. CAP stands for:

  • C - Consistency
  • A - Availability
  • P - Partition Tolerance

The theorem states that a distributed database system can guarantee at most two out of these three properties simultaneously - it is impossible to achieve all three at the same time.


Explanation of the Three Properties

PropertyDescription
ConsistencyEvery read receives the most recent write or an error. All nodes in the system see the same data at the same time.
AvailabilityEvery request receives a response (not necessarily the most recent data). The system remains operational at all times.
Partition ToleranceThe system continues to operate even when network partitions (communication breakdowns between nodes) occur.

Classification of Distributed Systems

Based on the CAP theorem, distributed systems are classified into three categories:

  1. CA Systems (Consistency + Availability): Sacrifice partition tolerance. Work well in single-node or non-distributed environments. Example: Traditional RDBMS.

  2. CP Systems (Consistency + Partition Tolerance): Sacrifice availability. When a partition occurs, the system may refuse to respond rather than return inconsistent data. Example: HBase, MongoDB.

  3. AP Systems (Availability + Partition Tolerance): Sacrifice consistency. The system remains available even during partitions but may return stale data. Example: Cassandra, CouchDB.


Significance in NoSQL

The CAP theorem is especially important for understanding NoSQL systems. NoSQL databases cannot provide all three guarantees together, so designers must choose which two properties are most critical for their use case. This trade-off guides the selection of the appropriate NoSQL database for a given application.

Open this answer on its own page →

2079 Ā· 5 marks

Write short notes on a. CAP Theorem b. Deductive database [5]

CAP Theorem is a theoretical framework in distributed database systems. CAP stands for: - C - Consistency - A - Availability - P - Partition Tolerance CAP Theorem states that a distributed database system can only guarantee at most two out of the following three properties at the same time. It is...

Open this answer on its own page →

BigData

2081 Ā· 5 marks

What is Big Data? What are its 3 V’s? [5]

Show solved answer

Big Data and Its 3 V's


What is Big Data?

Big Data refers to extremely large and complex datasets that cannot be processed, stored, or analyzed using traditional data management tools and conventional database systems within a reasonable amount of time.

Big Data encompasses data that is generated at high speed from a wide variety of sources such as social media platforms, sensors, transaction records, multimedia files, and IoT devices. The volume of this data is so massive that standard relational database systems (like those discussed in DBMS) are insufficient to handle it efficiently.


The 3 V's of Big Data

The 3 V's are the three defining characteristics that describe Big Data:


1. Volume

  • Refers to the enormous amount of data generated every second from various sources.
  • Data is measured in terabytes, petabytes, exabytes, and beyond.
  • Example: Facebook generates hundreds of terabytes of data daily.
  • The sheer size makes it impossible to store and process using traditional systems.

2. Velocity

  • Refers to the speed at which data is generated, collected, and processed.
  • Data streams in at an unprecedented rate and must often be processed in real-time or near real-time.
  • Example: Stock market transactions, live social media feeds, sensor data from IoT devices.
  • High velocity demands fast processing frameworks (e.g., Apache Kafka, Spark Streaming).

3. Variety

  • Refers to the different types and formats of data being generated.
  • Data can be:
    • Structured - data in tables/rows (e.g., relational databases, SQL data)
    • Semi-structured - data like XML, JSON files
    • Unstructured - data like images, videos, audio, emails, social media posts
  • Managing such diverse data types is a major challenge in Big Data.

Summary Table

VDescriptionExample
VolumeHuge amount of dataPetabytes of social media data
VelocitySpeed of data generationReal-time stock transactions
VarietyDifferent types of dataText, images, videos, logs

In modern Big Data discussions, two additional V's are often added: Veracity (accuracy/trustworthiness of data) and Value (usefulness of data), making it the 5 V's model.

Open this answer on its own page →

2080 Ā· 5 marks

Write short notes on: a) Big data b) Information retrieval [5]

--- Big Data refers to extremely large and complex datasets that cannot be managed, processed, or analyzed using traditional database management tools and techniques within a reasonable time frame. Property Description ----------------------- Volume Massive amounts of data generated from various ...

Open this answer on its own page →

MapReduce

2081 Ā· 5 marks

Write short notes on: a) Map Reduce b) Multimedia database [5]

--- MapReduce is a programming model and processing framework designed for processing and generating large datasets in a distributed computing environment. It allows parallel processing of massive amounts of data across a cluster of computers. MapReduce works in two main phases: 1. Map Phase: - T...

Open this answer on its own page →

Distributed Database Concepts and Advantages

2080 Ā· 10 marks

Why distributed database is important? What is transparency? Explain different types of transparencies in distributed databases.[10]

--- A distributed database is a collection of multiple, logically interrelated databases distributed over a computer network. It is important for the following reasons: Organizations are naturally distributed over several geographic locations. A distributed database mirrors this structure by allo...

Open this answer on its own page →

2079 Ā· 10 marks

Define distributed database. What are the benefits of using distributed databases over centralized database? Explain availability, reliability, and scalability features of distributed databases.[10]

Show solved answer

Distributed Database: Definition, Benefits, and Key Features


1. Definition of Distributed Database

A distributed database is a collection of logically interrelated data that is physically stored and managed across multiple geographically dispersed locations (nodes/sites), connected through a computer network. Although the data resides at different physical locations, it appears to the user as a single unified database.:

"Portions of a database, known as database fragments, may reside in several physical locations."

The primary goal of a distributed database is to provide scalability, fault tolerance, and improved performance compared to a centralized database. It can handle larger data volumes and support higher levels of concurrent access.


2. Benefits of Distributed Databases Over Centralized Databases

The key advantages are as follows:

i. Reflects Organizational Structure

Organizations are naturally distributed over several locations (branches, departments, regions). A distributed database mirrors this structure by allowing each location to manage its own local data while remaining part of the whole system.

ii. Improved Availability

The system is designed to continue operating even if one node fails. Because data can be replicated across multiple nodes, the failure of a single node does not bring down the entire system. This is a major advantage over a centralized database where a single point of failure can make the entire database unavailable.

iii. Improved Performance

Data exists in more than one site, so each site handles only a part of the entire database. This reduces the load on any single node and improves overall query response time. Local queries are processed locally, reducing network traffic and latency.

iv. Modular Growth (Scalability)

New sites (nodes) can be added to the network without affecting the operations of other existing sites. This allows the system to grow incrementally as organizational needs expand, which is not easily achievable in a centralized database.

v. Integration

Distributed databases allow integration of software components from different vendors to meet specific requirements. This is especially useful in heterogeneous environments where different departments may use different DBMS software.


3. Key Features: Availability, Reliability, and Scalability

A. Availability

Availability refers to the ability of the distributed database system to remain accessible and operational at all times, even in the presence of partial failures.

  • In a distributed database, data replication plays a central role in ensuring availability. Copies of data are stored on multiple nodes so that if one node fails, the data can still be accessed from another node.
  • As noted in the reference: "To improve fault tolerance and availability, copies of data may be stored on multiple nodes, which is data replication. It ensures that if one node fails, the data can still be accessed from other nodes."
  • Homogeneous distributed database systems specifically provide high availability and fault tolerance by replicating data and schema across multiple nodes.
  • Unlike a centralized database where a server crash makes the entire database unavailable, a distributed database continues to serve users through its surviving nodes.

Example: If a bank's database node in Kathmandu fails, users can still access their account data from the replicated node in Pokhara.


B. Reliability

Reliability refers to the ability of the distributed database to consistently deliver correct results and recover from failures without data loss or corruption.

  • Reliability is achieved through data replication and redundancy. Since multiple copies of data exist across different nodes, the system can recover from node failures without losing data.
  • Fault tolerance is a core design principle: homogeneous distributed systems are specifically noted to provide fault tolerance.
  • Distributed databases use mechanisms such as distributed transaction management and commit protocols (e.g., two-phase commit) to ensure that transactions are completed correctly across all nodes, maintaining data consistency and reliability.
  • Even if a network partition or node failure occurs mid-transaction, the system can roll back or complete the transaction reliably.

Comparison with Centralized DB: In a centralized database, hardware failure can lead to complete data loss if backups are not maintained. In a distributed database, the inherent redundancy ensures reliability.


C. Scalability

Scalability refers to the ability of the distributed database to handle increasing amounts of data, users, and transactions by adding more nodes without disrupting existing operations.

  • As stated in the reference: "New site can be added to hardware without affecting operations of other site." This is called modular growth.

  • A distributed database supports horizontal scalability: instead of upgrading a single powerful server (as in centralized databases), new nodes are simply added to the network.

  • Data distribution strategies such as:

    • Horizontal partitioning: Each node holds a portion of the rows of a table.
    • Vertical partitioning: Each node holds a subset of columns of a table.

    These strategies allow the workload to be distributed evenly, ensuring the system scales efficiently.

  • The reference also notes: "A distributed database can handle larger data volumes and support higher levels of concurrent access."

Comparison with Centralized DB: A centralized database has a physical limit on how much it can scale (bounded by a single machine's capacity). A distributed database scales out horizontally with minimal disruption.


Summary Table

FeatureCentralized DatabaseDistributed Database
AvailabilitySingle point of failureContinues if one node fails
ReliabilityVulnerable to hardware failureRedundancy ensures data safety
ScalabilityLimited by single machineNew nodes added without disruption
PerformanceBottleneck at central serverLoad distributed across nodes
Data LocationSingle physical locationMultiple geographic locations

In conclusion, distributed databases offer significant advantages over centralized databases in terms of availability through replication, reliability through fault tolerance and redundancy, and scalability through modular growth and data partitioning, making them ideal for large-scale, geographically distributed organizations.

Open this answer on its own page →

Data Fragmentation, Replication and Allocation Techniques for Distributed Database Design

2080 Ā· 5 marks

Define fragmentation. Explain horizontal fragmentation with an example. [5]

Fragmentation is the process of dividing a database into smaller, manageable pieces called fragments, which can be stored at different physical locations in a distributed database system. Each fragment contains a subset of the data from the original relation. Fragmentation allows portions of a da...

Open this answer on its own page →

2079 Ā· 5 marks

Why fragmentation is carried out? Difference between horizontal and vertical fragmentation. [5]

Fragmentation is the process of dividing a relation (table) into smaller subsets called fragments, which are then distributed across different nodes in a distributed database system. It is carried out for the following reasons: - Improved Performance: Data is stored closer to where it is most fre...

Open this answer on its own page →

Introduction to NOSQL Systems

2080 Ā· 5 marks

What are the characteristics of NOSQL Systems? [5]

NoSQL (Not Only SQL) systems are alternatives to traditional relational databases designed to handle large-scale, flexible, and high-performance data management. The key characteristics of NoSQL systems are as follows: --- NoSQL systems do not require a fixed schema. Data can be stored in various...

Open this answer on its own page →

2079 Ā· 5 marks

Why NOSQL system is essential? What are the different characteristics of this system? [5]

NoSQL (Not Only SQL) systems have become essential due to the limitations of traditional relational database systems (RDBMS) in handling modern data challenges. The key reasons are: 1. Handling Big Data: Modern applications (social media, e-commerce, IoT) generate massive volumes of unstructured ...

Open this answer on its own page →