SlideShare a Scribd company logo
Thinking in a document centric world
with RavenDB
There’s got to be a better way,
Somewhere over the…
We’re off to see the Wizard
Thinking in a document centric world with RavenDB by Nick Josevski
What is RavenDB?
•
•
•
•
•
•
•

It is a Document Store
Built with .NET
Fast
Easy to use / program against
Currently only runs on Windows
If you’re wondering it supports MSDTC
Open source
SOME BASIC CONCEPTS
CAP Theorem
• Consistency
• Availability
• Partition Tolerance
• When you suffer a network partition between stores.
• You decide how much Consistency OR Availability you would
like to have.
Documents are not flat
• A single document can be a complex object
graph.
• It’s no longer a challenge to store your data
• You’re no longer in a relational world
– Schema-free data store
– Does not mean chaos as some would lead you to
believe

More info on this at: http://ravendb.net/docs/theory/document-structure-design
Eventual Consistency
• In RavenDB
– Writes occur against the document store.
– Queries occur against the index store.
– Single Load operations go directly to the
document store.

• RavenDB is more consistent than others
• Also: not all viewers of data should be
considered equal.
Eventual Consistency
• Step 1 : Optimise for reading,
• Step 2:

by prioritising Availability
higher than Consistency

• Step 3:

(Index is stale)

• Step 4:

Profit
GETTING STARTED
Installation
Raven Management Studio
USING RAVEN DB
Using Raven in your .NET Code
Just like any (good) ORM
• Persist Document

• Loading

• Queries
Unit of Work Pattern
• With IDocumentSession
– Open a session of work
– Make changes in memory
– Persist changes
Search Capabilities
• Search is delegated to Lucene.NET
– Full text indexing
FETCH / QUERY
Session.Include
• The simplest way to start retrieving
documents and other associated documents
Session.Query
• It is just LINQ
• Pagination via:
– .Skip() and .Take()
Session.Customize
• As part of a query retrieve associated
documents
Safe by Default
• 3 magic numbers to help you out
– Default page size limit 128
– Take(n > 1024) is still 1024
– Requests 30
• Why so many calls?
•

Overridable via configuration, for those SELECT * FROM addicts
Transformers
• Server side projections
– with the ability load data from other documents
– RavenDBs true power shining through
Simple Transformer
Real World Example
Real World Example
INDEXES
Indexes
• With the power of schema-less store
• Comes great (some) responsibility
• Raven doesn’t know about fields on your
document by default
• So if you haven’t set up indexes raven will help
you out
Indexes
• Extend Abstract Index Creation Task
Map / Reduce
• Just like previous examples except there’s a
reduce component
• Most trivial examples is summing up
totals/counts of items
Map / Reduce
Multi-Map
• Querying Unlike Documents
• To build up something that doesn’t exist
• We’re working with documents
– No need for left/inner/outer/right/middle joins
Multi-Map
Real World Example
PROFILING
Profiling is first class
• Fiddler is your friend
ASP.NET Profiling Integration
• For your ASP.NET MVC App
1.

2.

3.

•

In Global.asax.cs

In _layout.cshtml

Demo app up at: https://github.com/NickJosevski/ravendb-presentation
ASP.NET Profiling Integration
More in the

REAL WORLD
Raven in

Apps
Structure of our Documents
• Varies and has been tuned for each use case
• But can be summarised into 3 types
Network of Documents
Single Documents
Single Documents
Parent & Child Documents
4th type and no longer used
• When we started with Raven
• We started down a path of “Summary”
Documents
– Which became a problem to maintain

• Replaced with Transformers outputting
SummaryDTOs
Deploying Indexes/Transformers
IOC Container Registration
Document Conventions
Projectors
More Info / Sources
•
•
•
•

http://ravendb.net/
Tekpub (series now on Pluralsight)
RavenDB High Performance by Brian Ritchie
NoSQL video from Martin Fowler
– http://www.youtube.com/watch?v=qI_g07C_Q5I

• Reach out to me Nick Josevski
– 1st video recording of this:
– http://www.youtube.com/watch?v=u3kUpFlf76M
Thanks
• Questions?

More Related Content

PPTX
Introduction to RavenDB
PPT
Document Databases & RavenDB
PPTX
RavenDB Overview
PPTX
RavenDB Presentation
PPTX
Intro to RavenDB
PPTX
Introduction to Azure DocumentDB
PPTX
RavenDB - Indexes Deep Dive
PPTX
Azure DocumentDB 101
Introduction to RavenDB
Document Databases & RavenDB
RavenDB Overview
RavenDB Presentation
Intro to RavenDB
Introduction to Azure DocumentDB
RavenDB - Indexes Deep Dive
Azure DocumentDB 101

What's hot (20)

PPTX
Azure DocumentDB
PPTX
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
PPTX
Introduction à DocumentDB
PPTX
Cool NoSQL on Azure with DocumentDB
PPTX
Azure doc db (slideshare)
PPTX
SQL To NoSQL - Top 6 Questions Before Making The Move
PPTX
No SQL, No Problem: Use Azure DocumentDB
PPTX
Tips & Tricks SQL in the City Seattle 2014
PPTX
Javascript on Server-Side
PPTX
Survey of the Microsoft Azure Data Landscape
PPTX
Azure CosmosDB the new frontier of big data and nosql
PDF
Building a spa_in_30min
KEY
MongoDB vs Mysql. A devops point of view
PDF
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
PPTX
Microsoft Web Technology Stack
PDF
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
PDF
Introduction to datomic
PPTX
Cloud architectural patterns and Microsoft Azure tools
PDF
Command Query Responsibility Segregation (CQRS)
PPTX
Big Data Day LA 2015 - Introducing N1QL: SQL for Documents by Jeff Morris of ...
Azure DocumentDB
Dropping ACID: Wrapping Your Mind Around NoSQL Databases
Introduction à DocumentDB
Cool NoSQL on Azure with DocumentDB
Azure doc db (slideshare)
SQL To NoSQL - Top 6 Questions Before Making The Move
No SQL, No Problem: Use Azure DocumentDB
Tips & Tricks SQL in the City Seattle 2014
Javascript on Server-Side
Survey of the Microsoft Azure Data Landscape
Azure CosmosDB the new frontier of big data and nosql
Building a spa_in_30min
MongoDB vs Mysql. A devops point of view
Benjamin Guinebertière - Microsoft Azure: Document DB and other noSQL databas...
Microsoft Web Technology Stack
Дмитрий Лавриненко "Blockchain for Identity Management, based on Fast Big Data"
Introduction to datomic
Cloud architectural patterns and Microsoft Azure tools
Command Query Responsibility Segregation (CQRS)
Big Data Day LA 2015 - Introducing N1QL: SQL for Documents by Jeff Morris of ...
Ad

Similar to Thinking in a document centric world with RavenDB by Nick Josevski (20)

PPTX
Big Data (NJ SQL Server User Group)
PDF
Voldemort Nosql
PPTX
NoSQLDatabases
PPTX
Do you queue
PPTX
Navigating NoSQL in cloudy skies
PPTX
noSQL choices
PPTX
Introduction to Data Science NoSQL.pptx
PPTX
Intro to Big Data and NoSQL
KEY
Writing Scalable Software in Java
PPTX
Sql vs NoSQL
PPTX
Scaling a High Traffic Web Application: Our Journey from Java to PHP
PPTX
Scaling High Traffic Web Applications
PPTX
The Rise of NoSQL and Polyglot Persistence
PDF
No sq lv1_0
PPTX
Architecting Your First Big Data Implementation
PDF
Scaling the Web: Databases & NoSQL
PDF
From ddd to DDD : My journey from data-driven development to Domain-Driven De...
PPTX
Revision
PPTX
Mapping Life Science Informatics to the Cloud
KEY
Make Life Suck Less (Building Scalable Systems)
Big Data (NJ SQL Server User Group)
Voldemort Nosql
NoSQLDatabases
Do you queue
Navigating NoSQL in cloudy skies
noSQL choices
Introduction to Data Science NoSQL.pptx
Intro to Big Data and NoSQL
Writing Scalable Software in Java
Sql vs NoSQL
Scaling a High Traffic Web Application: Our Journey from Java to PHP
Scaling High Traffic Web Applications
The Rise of NoSQL and Polyglot Persistence
No sq lv1_0
Architecting Your First Big Data Implementation
Scaling the Web: Databases & NoSQL
From ddd to DDD : My journey from data-driven development to Domain-Driven De...
Revision
Mapping Life Science Informatics to the Cloud
Make Life Suck Less (Building Scalable Systems)
Ad

Recently uploaded (20)

PPTX
sap open course for s4hana steps from ECC to s4
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
cuic standard and advanced reporting.pdf
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
Building Integrated photovoltaic BIPV_UPV.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
cuic standard and advanced reporting.pdf
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
MIND Revenue Release Quarter 2 2025 Press Release
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx

Thinking in a document centric world with RavenDB by Nick Josevski

Editor's Notes

  • #2: Here to talk to you about RavenDb
  • #3: Solutions to a lot of software development problems still get solved using relational databases as a default
  • #4: I’m going to take you on a journey
  • #5: There’s a wonderful place where interacting with your DataStore is no longer a frustration.
  • #6: Document Store.NETFast & Easy to use/program against
  • #8: It’s not one over the other.It can’t be a talk in the noSQL space without bringing this up.
  • #9: Does not mean ChaosSpend the time to think about structureSchema-free data store, that doesn't mean that you shouldn't take some time to consider how to design your documents to ensure that you can access all the data that you need to serve user requests efficiently, reliably and with as little maintainability cost as possible.
  • #10: Explain the 2 stores.Writes are ASYNCPerformance gain – Writes don’t hold up reads use the apple inventory example here.Index is set as stale when a write has happened, and Raven is updating the index. Not the same EC like in Casandra where in those it's about writes.It is optimized for reads by prioritizing Availability higher than Consistency. RavenDB is not unique in this regard, but it is somewhat special in that it still has the ability to be consistent. If you are retrieving single document, such as reviewing an order or an end user viewing their profile, these operations are ACID compliant, and are not affected by the "eventual consistency" design.
  • #11: To summariseRemember this does not mean “lack of consistency” it simply means prioritised over.A sales person goes to a "products list" page that is sorted alphabetically.On the first page, they see that "Apples" aren't currently being sold.So they click "add product", and go to a new page where they enter "Apples".They are then returned to the "products list" page and they still don't see any Apples because the index is stale. WTF - right?Embrace this and you’ll be a much happier software developer!
  • #14: Open up raven management studio
  • #16: NUGET and you’re done!
  • #17: Sesion is Raven.Client.IDocumentSessionQueries with Linq. In fact you don’t need an ORM like EF/Nhib you just write linqepressions after you include the Raven.Client assembly.If you’ve ever used any kind of ORM, this is very straight forwardBasicsStore,Retrieve,Query
  • #18: Use of raven document session followsUnit of Work pattern
  • #19: Delegated to LucenePowerful search engine (a whole different talk)
  • #21: Not joins, forget about joins.On like 24 we’re linking to a very common external document, one that represents a user (in this case an assignee)On line 25 we’re linking out to another separately stored document participants
  • #22: Standard paging by usingResults Per Page & Page Number
  • #23: Show fiddlerNEED A LESS CONFUSING LIST OF .Customize() calls
  • #24: Don’t shoot your own foot off128 = default page size1024 = page size limit as per safe by default30 is the hey why are you talking to raven so much over the wire
  • #25: Are awesome!Server side projectionsWith loading!Run inside raven!
  • #26: Simple Mapping
  • #27: We can come back to this slide if people are interested.I wanted to include it, if this came up as a question, or at least to give a glimpse of their power
  • #28: The nested transformer
  • #29: Remember at the start I mentioned we have the ‘document store’ and the ‘index store’
  • #30: You should set up your own indexes, here’s how you do it
  • #32: Need a more interesting example
  • #33: Sorry but this is it, our example of map reduce is quite complex
  • #34: Like a viewOur library (DAM) is a good example, a variety of items get organised into buckets, but we need to show them all together, the user doesn’t care what it technically is while browsing around
  • #35: That leads into Multi-Map
  • #39: Fiddler is your friend
  • #49: This is where you go and find your indexes that extend Abstract Index Creation TaskAnd the transformers
  • #50: Autofac registration code.The lines of note are 86 – pulling from a configuration the location of the databaseLine 92 our replication setup96-100 port exhaustion issue we saw in production109-111 regular Autofac lifetime management
  • #52: With the help of IoC when an event occurs in our CQRS style applicationA projector will get given the correct document from raven, we simply manipulate that documentWhen the raven session ends (request ends) the changes get savedLines of note 31: our tie/link to an event stream aggregate33-36 onevent handlers39 simplest example45 one of these per