Centralised and Distributed Databases

A centralised database keeps all data at one site; a distributed database spreads it across several. The choice changes availability, performance, complexity and how hard consistency becomes.

Concept

A centralised database stores the entire database at a single site, managed by one DBMS. A distributed database stores parts of it at several sites connected by a network, managed so that users can treat it as one database.

The distinguishing question is not how many machines exist, but how many independent copies of the management responsibility exist. Two servers replicating one database are still logically one system; two sites each owning different data are distributed.

Centralised

    Chennai        Madurai        Coimbatore
       |              |               |
       +--------------+---------------+
                      |
              +-------v--------+
              |  ONE database  |
              |  ONE DBMS      |
              +----------------+
  • Advantages — one copy of every fact, so consistency is straightforward; simple administration, backup and security; no distributed transaction problem; cheaper to run.
  • Disadvantages — a single point of failure; every remote user pays the network distance; the single site is a capacity ceiling; a local outage stops everyone.

Distributed

    SITE A                SITE B               SITE C
  +-----------+        +-----------+        +-----------+
  | DBMS      |        | DBMS      |        | DBMS      |
  | south     |<======>| north     |<======>| west      |
  | customers |        | customers |        | customers |
  +-----------+        +-----------+        +-----------+

  A user asks one question. The system decides which sites
  hold the answer, gathers the parts and returns one result.
  Ideally the user never learns there was more than one site.
  • Advantages — data sits near the users who need it; one site failing need not stop the others; capacity grows by adding sites; matches organisations that are themselves distributed.
  • Disadvantages — far more complex; keeping copies consistent is hard; transactions spanning sites need a commit protocol; queries may move large amounts of data; security must be enforced everywhere.

Comparison

PointCentralisedDistributed
Location of dataOne siteSeveral sites
ConsistencyNaturally maintainedRequires protocols and effort
AvailabilitySite failure stops everythingOther sites can continue
Local performancePoor for distant usersGood where data is placed well
AdministrationSimpleComplex, often per site
TransactionsOrdinary commitTwo phase commit across sites
CostLowerHigher in software, network and skill
ScalabilityLimited by the one siteGrows by adding sites

Transparency: the promise a distributed system makes

A distributed database aims to hide its distribution. The kinds of transparency are worth naming, because they reappear in Phase 15.

TransparencyWhat is hidden
LocationWhich site holds the data.
FragmentationThat a table is split across sites.
ReplicationThat several copies exist.
ConcurrencyThat other transactions are running elsewhere.
FailureThat a site is currently unreachable.

Homogeneous and heterogeneous

  • Homogeneous — every site runs the same DBMS product with the same schema approach. Cooperation is easy.
  • Heterogeneous — sites run different products, sometimes different data models. Requires translation, and is far harder. Often the result of a merger rather than a design decision.

Example

A bank with branches in three cities

CENTRALISED
  all accounts in Chennai. A Coimbatore customer withdrawal
  crosses the network for every read and write. If the
  Chennai link fails, Coimbatore cannot serve anyone.

DISTRIBUTED
  each branch stores its own customers locally. Local
  withdrawals are fast and survive a link failure.
  A transfer BETWEEN branches now spans two sites and needs
  two phase commit, so the difficulty moved rather than
  disappeared.

Common mistakes

  • Calling replication a distributed database. Replicating one database for availability is not the same as splitting ownership of data across sites.
  • Assuming distributed is faster. It is faster for local access and slower for anything that spans sites.
  • Ignoring the transaction cost. The moment a transaction touches two sites, a commit protocol is required and it can block.
  • Forgetting heterogeneity. Most real distributed systems become heterogeneous through mergers and acquisitions.

Exam and interview questions

  1. Differentiate centralised and distributed databases on at least six points.
  2. List the five kinds of transparency a distributed database aims for.
  3. Distinguish homogeneous and heterogeneous distributed systems.
  4. Why does a distributed database need a commit protocol that a centralised one does not?
  5. Give one case where a centralised database is the better engineering choice.

Practice

  1. For a national railway reservation system, argue for one architecture in five sentences.
  2. Name which transparency is broken when a user must know which site to connect to.
  3. List three failures a distributed system survives and one it handles worse than a centralised one.

Conclusion

Centralised keeps everything in one place and buys simplicity at the cost of availability and distance. Distributed places data near its users and buys that with genuine complexity in consistency, transactions and administration.

Useful resources

Hand picked references for this topic
Written by Lorens Mishra

Default administrator account created by the installer.

Continue reading

All DBMS notes →

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.