Top Banner
Relational Databases An experience by a young startup aficionado
18

Relational Databases - Benefits and Challenges

Jan 21, 2018

Download

Technology

Elvis Saravia
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Relational Databases - Benefits and Challenges

Relational DatabasesAn experience by a young startup aficionado

Page 2: Relational Databases - Benefits and Challenges

"The primary online data store for an application is the worst place to take a risk with

new technology." Adam D' Angelo - Quora CEO

Page 3: Relational Databases - Benefits and Challenges

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)

Page 4: Relational Databases - Benefits and Challenges

How Do I choose the right Database?

How do elephants make decisions?

They make the smartest decisions, hence no sacrifices are needed.

Page 5: Relational Databases - Benefits and Challenges

It’s all about the Trade-offs

Source: http://blog.nahurst.com/visual-guide-to-nosql-systems

Page 6: Relational Databases - Benefits and Challenges

But is it really just about trade-offs?

Page 7: Relational Databases - Benefits and Challenges

Trade-offs and theories are naturally confusing!!!

Page 8: Relational Databases - Benefits and Challenges

Hands-on experience is the best

The most improvised white-board ever!

Page 9: Relational Databases - Benefits and Challenges

Requirement #1: What do we know already?

Page 10: Relational Databases - Benefits and Challenges

Requirement #2:What is trending?

Source: http://db-engines.com/en/ranking_trend

Page 11: Relational Databases - Benefits and Challenges

That was easy!!!

Page 12: Relational Databases - Benefits and Challenges

Requirement #3:What about complex queries?

AHA!!! Relationships do matter right?

Page 13: Relational Databases - Benefits and Challenges

Requirement #4: What about Transactions?

● Transactions ensure that you atomically make changes to your database.

Page 14: Relational Databases - Benefits and Challenges

Requirement #5: What about Consistency?

● Achieved through ACID transactions.

● Consistency is about ensuring that all clients have the same view of the data.

Page 15: Relational Databases - Benefits and Challenges

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)

Page 16: Relational Databases - Benefits and Challenges

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.

Page 17: Relational Databases - Benefits and Challenges

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.

Page 18: Relational Databases - Benefits and Challenges

Consistency:Synchronous Replication

Datacenter A

Datacenter B

Datacenter C

Datacenter D