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?
It's all about Trade-offs
Source: http://blog.nahurst.com/visual-guide-to-nosql-systems
But is it really just about the trade-offs?
Trade-offs and theories are confusing!!!
Allow me to share some
Hands-on experience...
Kuai List Headquarters: 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?
- It ensures that you atomically make changes to your database.
Requirement #5:
What about Consistency?
- It ensures that clients have the same view of the data
- Achieved through ACID transactions
Requirement #6:
How about Scaling?
- Option 1: I assume we can scale as we go
- Option 2: How about implementing Layers (Memecaches) 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.
- For retrieving in desirable speeds we use memecache on top of our core relational database.
- How about data that never changes?
Challenge #1: Host in the Cloud
- Our host (Heroku) offered limited records (10,000 rows).
- We migrated to Amazon RDS: with zero downtime
- Amazon RDS makes it easy to use replication to enhance availability and reliability for production workloads
Synchronous replication
Data-center B
Data-center C
Data-center A
Data-center D
If scaling is needed, How about partitioning at the application level.
Layers are very important (MemedCached server and Amazon S3). they can sit on top of a MYSQL database (only in charge of writes)
How far can I go with using Relational Databases like MySQL and PostgreSQL
How far can I go with using Relational Databases like MySQL and PostgreSQL?
Source: http://db-engines.com/en/ranking_definition
Popularity
deck
By Omar Sar
deck
- 1,448