Relational Databases
An experience by a young startup aficionado
"The primary online data store for an
application is the worst place to take a risk with
new technology."
Adam D' Angelo - Quora CEO
CAP Theorem
"Of three properties of shared-data systems-data
Consistency, system Availability and tolerance to
network Partitions - only two can be achieved at any
given moment in time."
- 2000 Prof. Eric Brewer, PoDC Conference Keynote
- 2002 Seth Gilbert and Nancy Lynch, ACM SIGACT News 33(2)
How Do I choose the right Database?
How do elephants make decisions?
They make the smartest decisions,
hence no sacrifices are needed.
It’s all about the Trade-offs
Source: http://blog.nahurst.com/visual-guide-to-nosql-systems
But is it really just about trade-offs?
Trade-offs and theories are naturally
confusing!!!
Hands-on experience is the best
The most improvised white-board ever!
Requirement #1:
What do we know already?
Requirement #2:
What is trending?
Source: http://db-engines.com/en/ranking_trend
That was easy!!!
Requirement #3:
What about complex queries?
AHA!!! Relationships do matter right?
Requirement #4:
What about Transactions?
● Transactions ensure that you atomically make changes to your database.
Requirement #5:
What about Consistency?
● Achieved through ACID transactions.
● Consistency is about ensuring that all clients have the same view of the data.
Requirement #6:
How about Scaling?
● Option 1: I assume we can scale as we go...
● Option2: How about implementing Layers (Memecached) on top of Relational DBs.
(Facebook, Twitter and Airbnb)
● Option 3: If scaling is urgent, how about partitioning at the application level. (FriendFeed)
Use Case:
Kuai List
● We use PostgreSQL for writing and updating listings only.
● For retrieving at desirable speeds we use Amazon Elasticache (Redis - in-memory cache)
on top of our core relational database.
● NoSQL (MongoDB) for storing listings that never change.
Scaling Challenge #1:
Host in the cloud
● We migrated our core database to Amazon RDS (with zero downtime).
● Amazon RDS makes it easy to use replication to enhance availability and reliability for
production workloads.
Consistency:
Synchronous Replication
Datacenter A
Datacenter B
Datacenter C
Datacenter D

Relational Databases - Benefits and Challenges

  • 1.
    Relational Databases An experienceby a young startup aficionado
  • 2.
    "The primary onlinedata store for an application is the worst place to take a risk with new technology." Adam D' Angelo - Quora CEO
  • 3.
    CAP Theorem "Of threeproperties of shared-data systems-data Consistency, system Availability and tolerance to network Partitions - only two can be achieved at any given moment in time." - 2000 Prof. Eric Brewer, PoDC Conference Keynote - 2002 Seth Gilbert and Nancy Lynch, ACM SIGACT News 33(2)
  • 4.
    How Do Ichoose the right Database? How do elephants make decisions? They make the smartest decisions, hence no sacrifices are needed.
  • 5.
    It’s all aboutthe Trade-offs Source: http://blog.nahurst.com/visual-guide-to-nosql-systems
  • 6.
    But is itreally just about trade-offs?
  • 7.
    Trade-offs and theoriesare naturally confusing!!!
  • 8.
    Hands-on experience isthe best The most improvised white-board ever!
  • 9.
    Requirement #1: What dowe know already?
  • 10.
    Requirement #2: What istrending? Source: http://db-engines.com/en/ranking_trend
  • 11.
  • 12.
    Requirement #3: What aboutcomplex queries? AHA!!! Relationships do matter right?
  • 13.
    Requirement #4: What aboutTransactions? ● Transactions ensure that you atomically make changes to your database.
  • 14.
    Requirement #5: What aboutConsistency? ● Achieved through ACID transactions. ● Consistency is about ensuring that all clients have the same view of the data.
  • 15.
    Requirement #6: How aboutScaling? ● Option 1: I assume we can scale as we go... ● Option2: How about implementing Layers (Memecached) on top of Relational DBs. (Facebook, Twitter and Airbnb) ● Option 3: If scaling is urgent, how about partitioning at the application level. (FriendFeed)
  • 16.
    Use Case: Kuai List ●We use PostgreSQL for writing and updating listings only. ● For retrieving at desirable speeds we use Amazon Elasticache (Redis - in-memory cache) on top of our core relational database. ● NoSQL (MongoDB) for storing listings that never change.
  • 17.
    Scaling Challenge #1: Hostin the cloud ● We migrated our core database to Amazon RDS (with zero downtime). ● Amazon RDS makes it easy to use replication to enhance availability and reliability for production workloads.
  • 18.