18
Relational Databases An experience by a young startup aficionado

Relational Databases - Benefits and Challenges

Embed Size (px)

Citation preview

Relational DatabasesAn 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