IB COMPUTER SCIENCE | A3.4.4 Distributed Databases (HL ONLY)

Lesson objective

Describe distributed database features, including partitioning, replication, consistency, concurrency, ACID, global queries, transparency, security and scalability.

Learn

A3.4.4 | DISTRIBUTED DATABASES (HL ONLY)

01 | ONE LOGICAL DATABASE, SEVERAL NETWORKED NODES

A shop has branches in the north and south, plus a website used from several regions. Keeping every operation on one machine may create a bottleneck or a single point of failure. The organisation considers spreading its database work across networked servers.

A distributed database stores or manages logically related data across multiple connected nodes while providing coordinated database access. A node can be a server or another participating database instance.

The database may be split into parts, copied between nodes, or both. The application can still be offered one logical database interface rather than manually assembling unrelated files.

This HL lesson describes the main features and their trade-offs. Distribution can improve capacity, locality and resilience, but communication delays and failures make coordination more difficult.

02 | FOLLOW THE REQUEST THROUGH THE SYSTEM

The application submits a request through a database interface. A coordinator or routing layer uses metadata to find the relevant partitions and replicas, sends work to the appropriate nodes, and combines responses where needed. Exact architectures vary.

APPLICATION

Submits one logical query or transaction.

DATABASE ROUTING / COORDINATION

Locates data, coordinates work and assembles the result.

NODE A

North partition and selected replica data.

NODE B

South partition and selected replica data.

NODE C

Additional replicas or processing capacity.

The diagram is conceptual, not a required deployment. A real system may distribute the coordinator role, use different replica groups or assign different responsibilities to nodes.

Several clients connecting to one database server do not by themselves make its data distributed across multiple database nodes. Likewise, a cloud database is not necessarily distributed merely because it is accessed over the internet.

03 | DATA PARTITIONING SPLITS THE DATA

Data partitioning divides a dataset into portions. In a distributed design, those portions can be placed on different nodes to spread storage and work.

For example, North stock records can be stored in a North partition and South stock records in a South partition. A query for one branch may reach only its relevant partition, while a national report needs both.

Logical partition Example records Possible placement
North Robot kit: 5; Safety glasses: 7 Node A
South Robot kit: 3; Safety glasses: 4 Node B

Horizontal partitioning separates rows, often by range, hash or business key. Distributed horizontal partitions are commonly called shards. Vertical partitioning separates columns with suitable keys to relate them, though it is not the same as row sharding.

A poor partition key can create a hotspot, where one partition receives much more work than others. Splitting data does not guarantee balanced load or efficient cross-partition queries.

04 | REPLICATION COPIES THE SAME LOGICAL DATA

Replication maintains copies of the same logical data on multiple nodes. If the North partition is copied to another server, both hold replicas of those North records.

Replicas can support availability, recovery from some node failures and additional read capacity where the design permits. A nearby replica may reduce some network travel for reads.

The copies must be maintained according to the replication policy. Writes create communication and coordination work, and a replica can lag or become unavailable. Not every replica is necessarily allowed to accept writes.

Replication is not a substitute for backups. A mistaken deletion can be replicated, and failures affecting several copies may still occur. Recovery design must consider the relevant failure scenarios.

05 | PARTITIONING AND REPLICATION ARE DIFFERENT

Question Partitioning Replication
What happens to the logical records? Different portions are assigned to partitions. Copies of the same records are maintained.
Primary benefit to consider Spread dataset size or processing work. Provide redundancy or additional permitted read access.
Main challenge Routing, balancing and combining work across partitions. Keeping copies coordinated and handling lag/failover.
National Robot kit total 5 North + 3 South = 8. Do not add another 5 just because North has a replica.

A system can partition a table and replicate each partition. In that case, one set of logical records has both a partition location and several physical copies.

A global query must count each logical fact once. Reading a primary and its replica as if they held different branch records would double-count the data.

06 | DATA CONSISTENCY NEEDS A STATED GUARANTEE

Data consistency in a replicated system concerns whether reads and copies reflect updates according to the system’s defined guarantees. If one copy says five kits and another says four, a user must know which answer is appropriate for the operation.

A catalogue page might tolerate a short delay. Reserving the final item generally needs a design that prevents conflicting successful reservations, rather than independently trusting stale copies.

Strong consistency is often used broadly for guarantees making operations behave like a current single logical copy, but exact guarantees and read modes matter. Eventual consistency means replicas are expected to converge if updates stop and communication and reconciliation proceed.

Do not confuse these meanings with the C in ACID, which concerns preservation of defined integrity rules by correct transactions. Replication freshness and valid business-state transitions are related but distinct issues.

07 | REPLICATION TIMING CHANGES THE TRADE-OFF

Illustrative policy When a write is acknowledged Trade-off
Synchronous coordination Wait for the required participating replicas or quorum under the protocol. Stronger coordinated acknowledgement can increase latency or block progress when requirements cannot be met.
Asynchronous propagation A write can be acknowledged before all follower copies receive it. Can reduce waiting, but some reads may be stale and failure can threaten updates not yet replicated.

Synchronous does not universally mean “every copy everywhere must reply”. Many systems require a quorum, such as a majority of a defined replica group. Policies differ across products and operations.

During a network partition, groups of nodes cannot communicate normally. A system may reject or delay some operations to preserve a chosen consistency guarantee, or permit specified operations with reconciliation risks. It cannot ignore the missing communication.

Do not claim distribution always sacrifices ACID: some distributed databases provide strong transactional guarantees. The guarantees and their performance costs must be described for the actual design.

08 | WATCH A REPLICA FALL BEHIND

The model has one logical stock value with a leader and a follower. Reserve one kit at the leader, inspect the follower, then propagate the latest state. Disconnect the replication link or take the leader offline to see the limits.

The two policies are deliberately simple. “Wait for both” requires the two copies for each new write; “asynchronous” allows a leader write before follower propagation. They are not a full consensus protocol or a guarantee about every real synchronous system.

The model has no leader election or automatic failover. A remaining copy does not by itself establish that it is safe to accept writes. Changing the policy affects future writes; it does not automatically catch up an already stale follower.

This is temporary in-page state, not real durable storage. Reading the follower is explicitly a follower read and can show older data in this model; the demonstration does not claim it is a strongly consistent read.

09 | CONCURRENCY CONTROL PROTECTS SHARED WORK

Concurrency control coordinates operations that overlap in time. Two shoppers must not both reserve the last kit because they each read an earlier availability value.

Controls can include locks, version checks, conditional writes and appropriate transaction isolation. A conflicting operation may wait, fail or need a retry instead of silently overwriting another change.

Distribution adds delay between participants, so coordination can be more expensive and failures more ambiguous. The system also needs rules for which node can authoritatively accept a write.

A stale read followed by an unconditional update is not made safe merely by adding more replicas. Replication spreads information; concurrency control governs conflicting operations.

10 | ACID STILL APPLIES ACROSS NODES

Property Distributed transaction example
Atomicity A transfer between branch accounts must not leave only its debit committed.
Consistency Correct transaction logic and constraints preserve the defined total and valid balances.
Isolation Concurrent transfers or reservations obey the selected protection against interference.
Durability Confirmed committed work remains recoverable through the failures covered by the design.

If related records are on different nodes, transaction coordination must preserve the required outcome across the participants. Partial communication or node failure must not be mistaken for successful complete execution.

These guarantees depend on the DBMS, transaction scope, configuration and application logic. Two unrelated local commits are not automatically one global atomic transaction.

ACID does not mean every replica must visibly change at exactly the same instant or that every read mode has identical freshness. Explain the particular transaction and visibility guarantees.

11 | DISTRIBUTED COMMIT NEEDS COORDINATION

A branch transfer might debit an account on Node A and credit an account on Node B. Committing the two local changes independently risks a half-transfer if one side fails.

One conceptual approach is two-phase commit: a coordinator first asks participants to prepare, then communicates the global commit or abort decision. Prepared participants need enough state to follow the eventual decision correctly.

This is an illustrative extension, not a required algorithm for every distributed database. Two-phase commit can block in some failures; other architectures use additional replicated coordination or different transaction mechanisms.

Transaction commit and replica consensus solve related but different problems. Do not assume that an arbitrary majority vote automatically makes every multi-partition transaction atomic.

12 | GLOBAL QUERY PROCESSING COMBINES LOGICAL PARTS

Global query processing plans and executes one query whose relevant data is spread across nodes. It locates partitions, sends appropriate work, and combines results while respecting the query’s meaning.

For the branch stock example, each node can return its local sum and the coordinator can add those sums: Robot kit 5 + 3 = 8; Safety glasses 7 + 4 = 11. Replica copies must not be counted as extra logical records.

SELECT ProductName, SUM(Available) AS TotalAvailable
FROM BranchStock
GROUP BY ProductName
ORDER BY ProductName;

This is a logical SQL query. The distribution metadata and execution system decide how to obtain the pieces; the SQL text alone does not define the physical node layout.

Pushing suitable filters or partial aggregates to nodes can reduce network transfer. Cross-node joins can be costly, and some aggregates need care: a global mean needs the relevant counts and totals, not an unweighted average of different-sized local means.

13 | A MISSING NODE IS NOT A ZERO

Logical source Robot kit available Safety glasses available
North partition 5 7
South partition 3 4
Complete global result 8 11

If the South partition cannot be reached and no suitable accessible replica can supply it, the complete national result is not simply North’s total. “Unknown South” is different from “South has zero stock”.

The system may fail the query, wait, use an allowed replica or explicitly return a partial result, depending on its design and request. It must not silently label missing data as a complete answer.

Even when all nodes respond, a cross-node report needs a suitable consistency or snapshot rule if the records can change during the query. Successful network replies alone do not establish that all values represent the same logical point in time.

14 | DISTRIBUTION TRANSPARENCY HIDES IMPLEMENTATION DETAILS

Distribution transparency lets users interact with a logical database without manually managing how its data is fragmented, replicated and coordinated across nodes.

For example, the application asks for BranchStock, rather than sending a different query to every server and deciding which replica to trust itself. Metadata and database services handle the appropriate work.

Transparency reduces application complexity, but it is not a promise that distribution has no effects. Latency, failed requests, retries, consistency choices and deployment restrictions can remain visible to the developer.

15 | LOCATION TRANSPARENCY HIDES WHERE DATA LIVES

Location transparency is the specific ability to reference data by logical names without embedding its physical server or location in every query.

If a partition moves from Node A to Node C, the logical query can remain the same while routing metadata is updated. This supports maintenance and redistribution with less application rewriting.

It is one aspect of the broader distribution-transparency idea. It does not mean that physical location is irrelevant to network delay, access rules, recovery planning or operational decisions.

16 | FAULT TOLERANCE NEEDS SUITABLE SURVIVING RESOURCES

Fault tolerance is the ability to continue providing defined services despite specified failures. Replicas, failure detection, recovery logs and supported failover can contribute.

A three-voter majority-based replica group may continue an eligible operation with two available communicating voters, while one isolated voter cannot safely claim the same majority. This is an illustration, not a rule for every database architecture.

Failure detection is uncertain in a network: a silent node may have failed or merely be delayed or disconnected. An unsafe failover can create competing leaders and conflicting work.

State the failure model and service guarantee. Distribution does not mean zero downtime, and replicas in the same failure domain may all be affected by one incident.

17 | SCALABILITY HAS BOTTLENECKS

Scalability is the ability to handle growth in data or workload with appropriate additional resources. Partitioning can spread storage and some processing; permitted replicas can spread some reads.

Adding nodes can help when the work is divisible and balanced. It can also add communication, coordination and rebalancing work. One heavily used key, a slow network link or a central coordinator can limit the benefit.

Distinguish throughput, work completed per period, from latency, time for one operation. More nodes may raise throughput without reducing the latency of a coordinated global transaction.

Do not claim that doubling the nodes always doubles performance or that every added replica increases write capacity.

18 | DATA SECURITY MUST COVER THE WHOLE SYSTEM

Data security includes authenticating users and nodes, authorising operations, protecting network communication, protecting stored data and controlling administrative access. More nodes and connections create more places to configure and monitor.

A user should not gain extra data access merely by contacting a different node directly. Replicas, logs, backups and temporary query results also need appropriate protection.

Apply least privilege, suitable encryption and key management, auditing and consistent policy enforcement across relevant components. Partitioning data by branch is not automatically an access-control boundary.

Security and consistency are different features: encrypted communication protects transmission, but it does not by itself resolve stale replicas or conflicting reservations.

19 | NETWORKS SHAPE DATABASE BEHAVIOUR

A local read may be quick, while a transaction needing several geographically separated participants may spend substantial time communicating. Bandwidth affects movement of large result sets; latency affects coordination round trips.

Packet loss, node failure and network partitions can require retry, timeout or recovery. A client losing the commit reply may not know whether the server committed. Blindly replaying the operation can duplicate its effect.

A correct application may use a unique operation identity and a supported retry strategy to resolve such uncertainty. Database guarantees, network behaviour and application logic must work together.

These constraints explain the benefit of locating related work together where appropriate, without claiming that all global data access is necessarily slow.

20 | PUT THE FEATURES TOGETHER

The shop partitions branch stock for manageable storage and locality, replicates those partitions for defined resilience, and offers logical queries through a coordinated interface. Concurrency controls protect reservations and distributed transactions preserve required cross-node rules.

Global reporting combines logical records once, while location transparency shields applications from some placement changes. Security policies must apply across nodes, and scaling requires balanced workload and a capable network.

The design still needs explicit freshness, failure, recovery and performance requirements. Describing the features means stating what each contributes and what conditions its benefit depends on.

21 | CHECK THE FEATURE

Choose the feature that best matches each requirement. Your first checked response counts; restart for another attempt.

22 | WRITE A PRECISE DESCRIPTION

Start with the feature’s meaning, then describe its operation in the example. For instance: “Partitioning places different branch records on different nodes, spreading storage and local work. A global stock query must combine the relevant partitions without counting replica copies as extra records.”

For ACID, identify the business unit and its required successful and failed outcomes across participants. For replication, state the update/read policy rather than assuming all copies are always instantly identical.

Avoid absolute claims: another replica does not always permit safe failover, a missing partition is not zero, location transparency does not remove network latency, and distributed databases can support ACID under an appropriate design.

Further reading: one implementation of replicated data and distributed transaction considerations.

MATCH THE DISTRIBUTED FEATURE TO ITS ROLE

Terminology

Terminology

Distributed database

Logically related data coordinated across multiple networked database nodes.

Node

A participating server or database instance in the distributed system.

Partitioning

Dividing a dataset into logical portions that can be placed separately.

Shard

A distributed horizontal partition containing a portion of the rows.

Partition key

The value or expression used to assign records to partitions.

Hotspot

A key, partition or resource receiving disproportionate workload.

Replication

Maintaining copies of the same logical data on multiple nodes.

Replica

A copy of a defined logical dataset or partition.

Leader

A node with defined authority for operations in a particular coordination design.

Follower

A replica following an authoritative update stream in a leader-based design.

Synchronous coordination

Waiting for the required participants or quorum before acknowledging an operation.

Asynchronous propagation

Allowing acknowledgement before all intended follower copies receive the change.

Replication lag

Delay between an update and its application at a replica.

Data consistency

Reads and copies obey the system’s stated update/visibility guarantees.

Eventual consistency

Replicas converge if updates stop and required propagation/reconciliation proceeds.

Concurrency control

Mechanisms coordinating conflicting or overlapping operations.

ACID

Atomicity, consistency, isolation and durability for reliable transactions.

Distributed transaction

A transaction involving data or participants on multiple nodes.

Two-phase commit

A coordination approach separating participant preparation from a global commit/abort decision.

Quorum

A required set or number of participating votes under a defined protocol.

Global query processing

Planning, executing and combining a query over distributed logical data.

Distribution transparency

Hiding selected fragmentation, replication and coordination details behind a logical database interface.

Location transparency

Referencing data logically without hard-coding its physical node or site.

Fault tolerance

Providing defined services despite failures within the design’s assumptions.

Failover

Moving a service role to suitable surviving resources under a supported procedure.

Network partition

A communication failure separating groups of nodes.

Scalability

Ability to handle workload or data growth with appropriate resources and design.

Throughput

Amount of work completed per unit time.

Latency

Time taken for one operation or response.

Data security

Protection through appropriate authentication, authorisation, encryption and related controls.

Questions

Questions

CHECK YOUR UNDERSTANDING

Select all correct choices. Each exact set earns one point.

1. Which distinguish partitioning and replication?
2. Which describe replica timing?
3. Which matter for consistency?
4. Which describe concurrency control?
5. Which describe distributed ACID?
6. Which describe global queries?
7. Which distinguish transparency?
8. Which describe fault tolerance?
9. Which describe scaling?
10. Which describe security and recovery limits?

EXPLAIN AND COMPARE

Write your answers before revealing each sample.

1. Describe a distributed database.

2. Describe partitioning and replication using branch stock.

3. Describe why consistency is needed for replicated stock.

4. Describe synchronous versus asynchronous propagation.

5. Describe concurrency control in a last-item reservation.

6. Describe the role of ACID in a cross-node transfer.

7. Describe global query processing and one difficulty.

8. Describe why a missing South partition is not zero stock.

9. Describe distribution transparency and location transparency.

10. Describe fault tolerance and its limits.

11. Describe scalability and one bottleneck.

12. Describe security requirements across distributed nodes.

DESCRIBE IT | A MULTI-BRANCH SHOP

Describe how the shop can partition and replicate stock while offering a logical database interface. Include concurrency control, consistency, ACID, global query processing, distribution and location transparency, fault tolerance, security and scalability. Explain what must happen if a required partition or replica cannot be reached, rather than silently treating missing data as zero.

Flashcards

Flashcards

Click to flip. Select the ideas you need to revisit.

0 cards selected for revision.

Selections are kept while this page is open.

Workbook

Workbook

COMING SOON

The workbook for A3.4.4 Distributed Databases (HL ONLY) is coming soon. Complete the matching task and written questions in your exercise book.