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.
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]
The CAP Theorem
2081 Ā· 5 marks
What is the CAP theorem? Explain. [5]
Show solved answerHide 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
| Property | Description |
|---|---|
| Consistency | Every read receives the most recent write or an error. All nodes in the system see the same data at the same time. |
| Availability | Every request receives a response (not necessarily the most recent data). The system remains operational at all times. |
| Partition Tolerance | The 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:
-
CA Systems (Consistency + Availability): Sacrifice partition tolerance. Work well in single-node or non-distributed environments. Example: Traditional RDBMS.
-
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.
-
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.
2079 Ā· 5 marks
Write short notes on a. CAP Theorem b. Deductive database [5]
BigData
2081 Ā· 5 marks
What is Big Data? What are its 3 Vās? [5]
Show solved answerHide 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
| V | Description | Example |
|---|---|---|
| Volume | Huge amount of data | Petabytes of social media data |
| Velocity | Speed of data generation | Real-time stock transactions |
| Variety | Different types of data | Text, 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.
2080 Ā· 5 marks
Write short notes on: a) Big data b) Information retrieval [5]
MapReduce
2081 Ā· 5 marks
Write short notes on: a) Map Reduce b) Multimedia database [5]
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]
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 answerHide 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
| Feature | Centralized Database | Distributed Database |
|---|---|---|
| Availability | Single point of failure | Continues if one node fails |
| Reliability | Vulnerable to hardware failure | Redundancy ensures data safety |
| Scalability | Limited by single machine | New nodes added without disruption |
| Performance | Bottleneck at central server | Load distributed across nodes |
| Data Location | Single physical location | Multiple 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.
Data Fragmentation, Replication and Allocation Techniques for Distributed Database Design
2080 Ā· 5 marks
Define fragmentation. Explain horizontal fragmentation with an example. [5]
2079 Ā· 5 marks
Why fragmentation is carried out? Difference between horizontal and vertical fragmentation. [5]
Introduction to NOSQL Systems
2080 Ā· 5 marks
What are the characteristics of NOSQL Systems? [5]
2079 Ā· 5 marks
Why NOSQL system is essential? What are the different characteristics of this system? [5]
Make Unit 4 stick
Practice CSC475 with flashcards & quizzes