Skip to content

Chapter 1

  • We need multiple servers, for web/mobile traffic and Database
    • Different servers allow independent vertical scaling
Which Database to Use?
  • Relational Databases (RDBMS) or SQL Database.
    • Ex. MySQL, Oracle DB, PostgreSQL, etc.
  • Non Relational Database (NoSQL)
    • Ex. CouchDB, Cassandra, Amazon DynamoDB
    • Four Categories
      1. Key value stores
      2. Graph stores
      3. column stores
      4. Document stores
    • Join operations are not supported generally in NoSQL
When to use NoSQL Database?
  • Application requires super-low latency
  • Data is unstructured OR there is no relational data
  • Only serialisation/deserialisation of data is required(JSON, XML, YAML)
  • You are storing Massive amounts of data
Vertical Scaling (scale-up)
  • Adding more power (CPU, RAM, etc.) to your servers.
  • With low traffic, vertical scaling is a great option. The simplicity being the biggest advantage.
  • Has a hard limit and does not have failover and redundancy.
Horizontal Scaling (scale-out)
  • Adding more servers into your pool of resources.
  • More desired for large scale applications.

Database Replication

  • Solves the problem of no failover support and no redundancy
Master-Slave Replication
  • Usually, a master/slave relationship between original(master) and the copies(slaves)
  • All the data modifying commands like insert, delete, or update must be sent to the master database.
  • Reads can be performed from slaves while master will update them whenever it has fresh data.
  • Advantages
    • Better Performances
    • Reliability
      • Data is preserved even if one server goes down; since it is replicated
    • High availability
  • If master goes down, a slave is promoted to be the new master.
  • In production, promoting a new master is more complicated as the data in a slave database might not be up to date.
    • How is the data then recovered?

Cache


TAGS - #faultTolerance