RavenDB overview

Post on 27-Jan-2015

118 views 0 download

Tags:

description

 

Transcript of RavenDB overview

OVERVIEW

Igor MoochnickDirector, Cloud PlatformsBlueMetal Architectsigorm@bluemetal.com

Blog: igorshare.wordpress.com

BlueMetal Capabilities

UX

Social

Services

Data

Creative & Interactive ServicesMobile ApplicationsWeb & RIA Clients

Enterprise CollaborationSocial PlatformsInformation Management

Application ModernizationServer-side Application ComponentsPrivate, Public or Hybrid Cloud

Relational Database EnginesBusiness Analytics and InsightsNoSQL Data Platforms M

icro

soft

Pla

tform

sA

pp

le,

Am

azo

n a

nd

Leadin

g

Pla

tform

s O

pen

Sou

rce S

oft

ware

THEMES FOCUS AREAS PLATFORMS

Deep

Dis

covery

& B

usi

ness

A

lign

ment

Ag

ile,

Sm

all

Team

s w

ith H

igh

Velo

city

Inte

gra

ted

Cre

ati

ve &

Eng

ineeri

ng

APPROACH

Why work with us?

• Our model is based on a deep connection to our customer’s true needs

3 We are a relationship-driven partner not a transactional services firm

3 Our relationships are based on high integrity, ethics & mutual success

3 Deep discovery “Seek first to understand” – listen, then synthesize

3 We never lead with a solution - first understand the true business problem then design the solution that exactly meets the customer’s needs

• Our capabilities approach is unique to marketplace:

3 Senior level, extremely talented individuals that can operate at high velocity

3 Team model where we operate at a high rate of speed: force multiplier

3 Integrated Platform approach where we offer end to end solutions

3 Differentiated Creative connected to Engineering resulting in shipping what we design

Sweet Spots

Web Related Data, such as user sessions, shopping cart, etc.

Dynamic Entities, such as user-customizable entities, entities with a large number of optional fields, etc.

Persisted View Models

Large Data Sets - known to scale in excess of 1 terabyte (on a single machine with thousands writes/sec) and trivial to shard the database across multiple machines

Modeling

Stop thinking relational

Start thinking about how your data will be used Usage scenarios Optimize for reads? Writes?

Think about your domain objects and business logic in native .Net (POCO) classes

Deformalize if needed

Reference entities to other entities, or collections of them

Identify aggregate root(s)

Modes of operations

Windows Service

Console App (debug mode)

Embedded

IIS App (ASP.NET Service)

On the cloud (Azure, RavenNest)

RavenDB Design Guidelines

Self optimizing, zero admin

Eventual consistency

Extensible

Fluent simple API

Client API

Lightweight

Silverlight

Embedded

RavenLight

Sessions

Manages UoW (Units of Work)

Cheap to create

Transactional

Manages IDs, tracking

Don’t shoot yourself in the foot

Will get you first 128 results (unbounded result set protection)

Don’t forget to commit your changes by calling SaveChanges()

30 operations per session (client/server chatter protection)

Automatic batching

No locking

Advanced API

2nd level – Session level

3rd level – DatabaseCommands

Document store level

Thin wrapper around HTTP API

NOT Transactional

Queries

Strongly typed

Linq

Works against Lucene indexes

Feeds back into index updates

By design, results may be stale, but you’ll know about it

Indexes

Dynamic, created on-the-fly - temporary

Becomes static, if you insist (suggested for production)

Rich Actions: Map Reduce Transform (live projections) Field Paging

Spatial index

Linq Queries

// Filter by property valuevar posts = from post in session.Query<BlogPost>() where post.Subject == "NoSQL Update" select post;

// Filter by rangevar posts = from post in session.Query<BlogPost>() where post.NumberOfWords > 50 select post;

// Filter by nested (calculated) propertyvar posts = from post in session.Query<BlogPost>() where post.Comments.Count > 2 select post;

Queries

// Filter by property valuevar posts = session.Query<BlogPost>() .Where(post => post.Subject == "NoSQL Update");

// Filter by rangevar posts = session.Query<BlogPost>() .Where(post => post.NumberOfWords > 50);

// Filter by nested (calculated) propertyvar posts = session.Query<BlogPost>() .Where(post => post.Comments.Count > 2);

Paging

You can skip and pick any number of entities from the returned Query result

Use Skip() and Take() to control the size of the result set

// If a Page has 10 records, to get the 4th page -var posts = session.Query<BlogPost>() .Skip(30) // Skip 3 pages worth of posts .Take(10) // Select next page .ToArray(); // Execute query

Efficient loads

Improves normalized data access

Include relevant information with your query results

// Request to include Author with the Post resultvar post = session.Include<BlogPost>(post => post.Author.Id) .Load ("BlogPosts/34");

var author = session.Load<Author>(post.Author.Id);

BLOBs / Attachments

Can store and manage large binary BLOBs

// Store BLOB/Attachmentbyte[] data = new byte[] { ... };documentStore.DatabaseCommands.PutAttachment("videos/2", null, data, new RavenJObject {{"Title", "Birthday song"}});

// Get BLOB/Attachmentvar attachment = documentStore.DatabaseCommands.GetAttachment("videos/1");

Polymorphism

No required inheritance association

// Query against unified indexvar result = session.Query<dynamic, EverytingByName>();

foreach (dynamic animal in result)Console.WriteLine(animal.Name);

For more watch webcast …

Extensibility

MEF (Managed Extensibility Framework)

Triggers

PUT triggers DELETE triggers Read triggers Index update triggers

Request Responders

Custom Serialization/Deserialization

Plugins

// RavenDB pluginpublic class DocSize : RequestResponder{

public override void Respond(IHttpContext context) { ... }

public override string UrlPattern { get { return "/blobsize/(.+)"; } }

public override string[] SupportedVerbs { get { return new[] {"GET"}; } }}

Bundles

Drop-in plugins (MEF, .NET)

Write your own

Available Authentication Authorization Cascade delete Expiration Quotas Replication Versioning

Replication Between Servers

Implemented as a plug-in (Raven.Bundles.Replication.dll)

Tracks the server the document was originally written on.

The replication bundle uses this information to determine if a replicated document is conflicting with the existing document.

Supported by the client API

Detects that an instance is replicating to another set of instances.

When that instance is down, will automatically shift to the other instances.

Given this document…

And this index…

Gives this table output

http://ravendb.net/bundles/index-replication

Replication to Relational DB

Sharding

Sharding refers to horizontal partitioning of data across multiple machines.

The idea is to split the load across many commodity machines, instead of buying huge expensive machines.

Raven has full support for sharding, and you can utilize sharding out of the box.

Advanced

Single document patch

Attachments (BLOBs)

Transactions (transaction scope)

Batching

Lucene Query (parser syntax)

Query statistics

Learn More!

Raven DB Home Pagehttp://ravendb.net/

Raven DB: An Introduction http://www.codeproject.com/KB/cs/RavenDBIntro.aspx

Herding Code 83: Ayende Rahien on RavenDB http://herdingcode.com/?p=255

Raven posts from Ayende Rahienhttp://ayende.com/Blog/category/564.aspx

Raven posts from Rob Ashton http://codeofrob.com/category/13.aspx

RavenDB - The Lost Session