Introducing
RavenDB
Agile Persistence in .Net
About Johnny Graber
•Software Engineer - Swiss Medical Association
•Twitter: @j_graber
•E-Mail: JG@JGraber.ch
•Blog: ImproveAndRepeat.com Examples at
Today’s Main Topics
•NoSQL
•RavenDB
•Agile Persistence
Demo RavenDB .Net Client
How simple is it to access RavenDB?
NoSQL?
No SQL
Not only SQL
Polyglot Persistence
Relational Databases aren’t
Obsolete
Great for
•Optimized Writes
•Minimal Storage Footprint
•Flexible Querying
But
•Mostly Reads in Our Applications
•Storage Costs (Almost) Nothing
•Hard to Scale
NoSQL Provides Solutions
Main Types of NoSQL
•Key / Value Store
•Graph Database
•Column Database
•Document Store
RavenDB
•2nd Generation Document Database
•Built on .Net
•Schema Free
Some RavenDB Features
•Safe by Default
•Supports Transactions (ACID)
•Best Practices Built in
A Document in RavenDB
•Self-Contained
•Independent
•Redundant Data (History)
A Document in RavenDB
Running RavenDB
•Standalone Server
•Part of Your Web-Application
•Embedded Mode
Installing RavenDB
RavenDB Studio
•Look Into the Database
•Generate Sample Data
•Administration Tools
Demo RavenDB Studio
How does the administration interface works?
Connect to RavenDB
•.Net Client
Install-Package RavenDB.Client
•HTTP API
Demo HTTP API
Can you use RavenDB without .Net?
Querying RavenDB
var books = from books in session.Query<Book>()
where books.Title.StartsWith("Raven")
select books;
var book = session.Load<Book>("books/1");
Indexes in RavenDB
•All Queries Need an Index
•Static or Dynamic
•Created in Background (Stale Index)
Challenges for Index Creation
•Schema Free Data
•Fixed Structure to Find Data
•Closing the Gap with Map/Reduce
Map/Reduce
This is probably the most
common error that
people make with any
sort of data access
technology. "Just give me
the whole thing, I'll make
sense of it on the client
side." In the RDBMS
world, this would be
expressed as "SELECT *
FROM Orders".
The problem with such
queries is they can
potentially…
Map
Reduce
Demo Index Creation
How hard can it be?
Licencing RavenDB
•AGPL for Open Source Projects
•Commercial Licence: 399$/Year/Instance
•RavenHQ: Starting at 10$/Month
Agile Persistence
Development Today
•Agile Approach
•Embrace Change
•Fail Fast
Except in the Persistence Layer
•First Time Right
•Hard to Change
•Don’t Touch
“When the Database must be
correct the first time, every part of
the application must be known at
the beginning”
“Persistence should be
an application detail”
Domain-Driven Design
•Aggregates
•Bounded Context
•Entity or Value Object
Benefits of Following DDD Principles
•History of Documents
•Complete Change Tracking
•Optimised Data Access
Command Query
Responsibility Segregation (CQRS)
•Commands Modify State
•Queries Answer Questions
•Keep Them Apart
CQRS for Fast Applications
CQRS and RavenDB
•HTTP API (REST )
•When Unauthenticated Only Allow Read
•Done
TDD and RavenDB
•Don’t Abstract an Abstraction Layer!
•Use In-Memory Mode
•It’s Fast Enough
Changing Documents
•Easily Done
•Know the Impacts
•Worst Case: Full DB Update
Demo Schema Change
How can you change your schema?
Use RavenDB
•Hacking
•Pet Projects
•Prototypes
Try This at Home
NOT in Production!
What’s Missing
•Authorisation & Authentication
•Bulk Inserts
•Paging
•Sharding
More on RavenDB
•RavenDB.net
•Tekpub.com
•ImproveAndRepeat.com
More on Polyglot Persistence
•Martin Fowler:
http://martinfowler.com/bliki/CQRS.html
•Jimmy Bogard: Real World Polyglot Persistence
http://vimeo.com/68320412
Questions?
JG@JGraber.ch
Thank You!

Einführung in RavenDB

Editor's Notes

  • #4 Nächste Woche an der SoftShake in Genf, 300 Besucher, Hat noch Tickets Testen der Folien und Beispiele, Feedback sehr willkommen!
  • #5 RavenDB ist ein tolles Produkt. Ohne Wissen über die Problemfelder die zur Entstehung führten kann man nur schwer die Vorteile erkennen. Da ich keine Lizenzen verkaufe möchte ich im 3. Teil vor allem über die dadurch gewonnenen Möglichkeiten sprechen.
  • #6 Da jeder immer nur von einfach spricht schauen wir einmal an wie einfach es wirklich ist
  • #10 Heute Benutzt: Amazon (Relational Produktekatalog, GraphDB für Empfehlungen, usw). Ihr selber: Caching, Sessions, Cookies,
  • #26 Get Resource/Id (Created in .Net) Put Resource/Id + JSON Show in RavenDB Studio
  • #31 Create AllProducts Index Destination Query in HTTP Query in .Net
  • #45 .Net Class Add Field Add Code to Set Field Add New, Update Old DNUG: Speichern ohne Authoren zu speichern, einmal mit, einmal als Wrapper (Ids übernehmen!)