Comment by TekMol

2 days ago

Should replication really be a concern of the DB layer?

Replication means writing queries which alter the data to multiple machines, right?

Shouldn't that be done by a software one level up? Which takes in the queries via some network protocol and then sends them to all machines.

That would sound more logical to me.

Historically, yes. Databases were software that were concerned with both storage and networking.

It's fine to want to separate those out, but it's not easy to do so and there are reasons they've been coupled for decades.

  • What makes it hard?

    Having a single DB that takes write queries via a proxy which spreads them out to multiple read-only-DBs sounds easy at first.

    • When do you consider the write/transaction to be completed?

      What do you do about out-of-sync read replicas?

      ACID gets real hard real fast when introducing replication.

      2 replies →