32
RavenDB lovin’ .NET does NoSQL Evolve your data store, move beyond relational SQL

Raven lovin' - .NET does NoSQL

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Raven lovin' - .NET does NoSQL

RavenDB lovin’.NET does NoSQL

Evolve your data store,move beyond relational SQL

Page 2: Raven lovin' - .NET does NoSQL

about:author

Raven in personal projects

Longtime user of ORMs

Raven at 3M

Raven with Ayende!

I’m no DBA! But…

Experienced in object DBs

Page 3: Raven lovin' - .NET does NoSQL

RavenDB? Why do we need anything besides SQL?

Page 4: Raven lovin' - .NET does NoSQL

SQL: Databases done right.

Circa 1970.

Page 5: Raven lovin' - .NET does NoSQL

SQL: Databases done right.

Circa 1970. ACID.

Popular in the ‘70s, man. But it makes scaling difficult.

CAP Theorem for distributed systems:

Consistency, Availability, Partition toleranceChoose 2.

Page 6: Raven lovin' - .NET does NoSQL

SQL: Databases done right.

Circa 1970. Got ACID? Scale up. Pay up.

Page 7: Raven lovin' - .NET does NoSQL

SQL: Databases done right.

Circa 1970. How many queries for this simple page?

Page 8: Raven lovin' - .NET does NoSQL

SELECT UPPER(Name) FROM Customer WHERE Name LIKE'A%' ORDER BY Name

SELECT UPPER(Name) FROM ( SELECT *, RN = row_number()

OVER (ORDER BY Name) FROM Customer WHERE Name LIKE 'A%' ) A WHERE RN BETWEEN 21 AND 30 ORDER BY Name

SELECT TOP 10 UPPER (c1.Name) FROM Customer c1 WHERE c1.Name LIKE 'A%' AND c1.ID NOT IN ( SELECT TOP 20 c2.ID FROM Customer c2 WHERE c2.Name LIKE 'A%‘ ORDER BY c2.Name ) ORDER BY c1.Name

$ SET SOURCEFORMAT “FREE”IDENTIFICATION DIVISION.Display Prompt. DISPLAY “I <3 SQL!”. STOP RUN.

Or how about…var names = db.Customers .Where(c => c.Name.StartsWith(“A”)) .OrderBy(c => c.Name) .Select(c => c.Name.ToUpper()) .Skip(20) .Take(10);

SQL: Databases done right.

Circa 1970. 1974 called. They want their query language back.

Page 9: Raven lovin' - .NET does NoSQL

SQL: Because objects and relational databases go together

like peanut butter and tuna fish

Page 10: Raven lovin' - .NET does NoSQL

•Polymorphism doesn’t exist in the relational world•Encapsulation creates fragile database models•Inheritance results in inefficient relational queries•Leaky abstraction

The object-relational impedance mismatch:

SQL + OO =Peanut butter +

Tuna.

Page 11: Raven lovin' - .NET does NoSQL

SQL + OO =Object-Relational Mapppers (O/RMs) like Entity Framework attempt to hide these problems…

…but you can mask the tuna only so long…

Page 12: Raven lovin' - .NET does NoSQL

SQL + OO =var today= DateTime.Now;context.TheBaseTypes .Where(b => b.DateCreated == today) .ToList();

“Expressing this query in LINQ to Entities is short and sweet. But don’t be fooled. It’s a hefty request. You’re asking EF and your DB query each table that maps to the derived entities and join each one to the BaseTypes table.

In my environment, this creates a 3,200 line SQL query, which can take Entity Framework some time to build and the database some time to execute.”

-Julie Lerman, MSDN Magazine, August 2012

Page 13: Raven lovin' - .NET does NoSQL

ORM: The Vietnam of Computer Science

“ORM is the Vietnam of Computer Science.

It represents a quagmire which starts well, gets more complicated as time passes, and before long entraps its users in a commitment that has no clear demarcation point, no clear win conditions, and no clear exit strategy.”

-Ted Neward

Page 14: Raven lovin' - .NET does NoSQL

SQL: The Hammer for

every nail

“The first to present his case seems right, till another comes forward and questions him.”

…and every screw

Page 15: Raven lovin' - .NET does NoSQL

NoSQL: A modern alternative to relational

databasesNoSQL databases:

Don’t use T-SQL

Typically schema-free

Relax ACID guarantees

Built for distributed scalability

Page 16: Raven lovin' - .NET does NoSQL

NoSQL: A modern alternative to relational

databasesNoSQL: weaning us off ACID

to achieve more psychedelic things

Trippy things like…

Cheap, fast reads

Horizontal scalability

Flexible, schema-free models

Page 17: Raven lovin' - .NET does NoSQL

NoSQL has problems, too.

:-(

Page 18: Raven lovin' - .NET does NoSQL

NoSQL has problems, too.

:-(

Painful query models

Immature tooling

Complex APIs

Poor language support

Page 19: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

“I’ve consulted on NHibernate and other ORMs for over a decade. I’ve seen the same problems repeated over and over.

I wanted to fix that.So I created RavenDB.”

-Ayende

Page 20: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Get out of the RDBMS/ORM mess

Fix shortcomings of NoSQL

“I intentionally designed RavenDB and its .NET API to deal with problems and frustrations in the NHibernate / RDMBS model.”

-Ayende

Evolve data storage

Page 21: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Setup should be painless

Page 22: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Simple is better

Page 23: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Putting stuff in the database should be easy

Page 24: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Transactions are important

Page 25: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

LINQ is the best query language on the planet

Page 26: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Developers should fall into the pit of success

Page 27: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Reads should be *fast*. Index fast.

Lock-free, non-ACID reads

“Better stale data quickly than live data slowly.”

Indexes should be created automagically

Every read is a query against an index. Yes!

Page 28: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Tooling is important

Page 29: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Search matters. Google-like search.

Page 30: Raven lovin' - .NET does NoSQL

RavenDBAn opinionated, 2nd generation NoSQL database

Scalability should be easy, natural

Replication: master-to-slave, master-to-master Sharding: split your data across servers

transparently

Page 31: Raven lovin' - .NET does NoSQL

Recap!

Raven is super

fast!

Raven is easy!

Raven is scalable! Raven is magical !

It’s an alternative to the SQL + ORM mess

You should totally use it for your next project :-)

Page 32: Raven lovin' - .NET does NoSQL

Thank You!Hope this has helped!

Slides: bit.ly/raventalk

Twitter: @JudahGabriel

Blog: DebuggerDotBreak.wordpress.c

om