2012-01-31 nosql in .net

53
Veranstalter: Partner: 30.-31. JAN. 2012, MÜNCHEN VISUAL STUDIO FÜR WINDOWS-ENTWICKLER 31.01.2012 Dipl.-Inf. (FH) Johannes Hoppe in .NET mit RavenDB und MongoDB

Upload: johannes-hoppe

Post on 27-Jan-2015

106 views

Category:

Technology


2 download

DESCRIPTION

NoSQL presentation for the VSone conference

TRANSCRIPT

Page 1: 2012-01-31 NoSQL in .NET

Veranstalter: Partner:

30.-31. JAN. 2012, MÜNCHEN

VISUAL STUDIO FÜR WINDOWS-ENTWICKLER

31.01.2012 Dipl.-Inf. (FH) Johannes Hoppe

in .NET mit RavenDB und MongoDB

Page 2: 2012-01-31 NoSQL in .NET

Johannes Hoppe .NET Webentwickler

www.johanneshoppe.de

Page 3: 2012-01-31 NoSQL in .NET

Not only SQL

01

Page 4: 2012-01-31 NoSQL in .NET

2002 2004 2006 2008 2010 2012

Daten

Page 5: 2012-01-31 NoSQL in .NET

Trend 1: wachsende Datenmengen

Trend 2: mehr Vernetzung (“web 2.0”)

Trend 3: mehr Individualisierung (weniger Struktur)

Page 6: 2012-01-31 NoSQL in .NET
Page 7: 2012-01-31 NoSQL in .NET

Scale-up Vertikale Skalierung

Server auf mehr Leistungsfähigkeit trimmen

Page 8: 2012-01-31 NoSQL in .NET

Scale-out horizontale Skalierung

Einfügen von Nodes (Rechnerknoten)

Page 9: 2012-01-31 NoSQL in .NET

verteilte und horizontale Skalierbarkeit

kein relationales Datenmodell (kein SQL)

schemafrei / schwache Schemarestriktionen

anderes Konsistenzmodell

Page 10: 2012-01-31 NoSQL in .NET

Schemafrei kein ALTER TABLE

kein Wartungsfenster *

Datenversionierung im Code!

* morgens ausschlafen

Page 11: 2012-01-31 NoSQL in .NET

Anforderungen

an ein verteiltes System

Consistency Konsistenz

AvailabilityVerfügbarkeit

Partition

Tolerance Ausfalltoleranz

Page 12: 2012-01-31 NoSQL in .NET

CAP Theorem › 2000: E. Brewer, N. Lynch

› You can satisfy

at most 2 out of the 3 requirements

Page 13: 2012-01-31 NoSQL in .NET

Consistency › The system is in a consistent state after an operation

› All clients see the same data

› Strong consistency (ACID)

vs. eventual consistency (BASE)

ACID: Atomicity, Consistency, Isolation and Durability

BASE: Basically Available, Soft state, Eventually consistent

Page 14: 2012-01-31 NoSQL in .NET

Availability › System is “always on”, no downtime

› Node failure tolerance

– all clients can find some available replica

› Software/hardware upgrade tolerance

Page 15: 2012-01-31 NoSQL in .NET

Partition tolerance › System continues to function even when

split into disconnected subsets (network disruption)

› Not only for reads, but writes as well

Page 16: 2012-01-31 NoSQL in .NET

“Drum prüfe,

wer sich ewig bindet.” Friedrich Schiller

Page 17: 2012-01-31 NoSQL in .NET

Klassifizierung › Key-Value stores

› Document stores MongoDB & RavenDB

› Wide Column stores

› Graph-Datenbanken

› und viele weitere

Page 18: 2012-01-31 NoSQL in .NET

Tabellen Dokumente

02

Page 19: 2012-01-31 NoSQL in .NET
Page 20: 2012-01-31 NoSQL in .NET

https://webnote.codeplex.com

Page 21: 2012-01-31 NoSQL in .NET
Page 22: 2012-01-31 NoSQL in .NET
Page 23: 2012-01-31 NoSQL in .NET

MongoDB

03

Page 24: 2012-01-31 NoSQL in .NET

NoSQL

MongoDB Quick Reference Cards

http://www.10gen.com/reference

und zum Mitnehmen!

Page 25: 2012-01-31 NoSQL in .NET

“Deployment” › Standardverzeichnis erstellen:

c:\data\db

› Server-Start: mongod.exe

› Shell: mongo.exe

Page 26: 2012-01-31 NoSQL in .NET
Page 27: 2012-01-31 NoSQL in .NET
Page 28: 2012-01-31 NoSQL in .NET

BSON Master/Slave

JavaScript C# Driver

Sharding GNU AGPL

Page 29: 2012-01-31 NoSQL in .NET

JSON BSON

All JSON documents are stored in a binary

format called BSON. BSON supports a

richer set of types than JSON. http://bsonspec.org

Page 30: 2012-01-31 NoSQL in .NET

CRUD – Create

In der Shell

› use WebNote

› db.Notes.save( {Title: 'Mittag',

Message: 'nicht vergessen' });

So funktioniert der Befehl

› db.Notes.save

Page 31: 2012-01-31 NoSQL in .NET

CRUD – Read Queries werden ebenso im Dokument-Stil spezifiziert

› db.Notes.find();

› db.Notes.find({ Title: /Test/i });

› db.Notes.find({ "Categories.Color": "red"}).limit(1);

Page 32: 2012-01-31 NoSQL in .NET

CRUD – Update

› db.Notes.update({Title: 'Test'}, {'$set': {Categories: []}});

› db.Notes.update({Title: 'Test'},

{'$push': {Categories: { Color: 'Red' }}});

Page 33: 2012-01-31 NoSQL in .NET

CRUD – Delete

› db.dropDatabase();

› db.Notes.drop();

› db.Notes.remove();

Page 34: 2012-01-31 NoSQL in .NET

“Map Reduce is the Uzi of aggregation

tools. Everything described with count,

distinct and group can be done with

MapReduce, and more.” Kristina Chadorow, Michael Dirolf in MongoDB – The Definitive Guide

Page 35: 2012-01-31 NoSQL in .NET

RavenDB

04

Page 36: 2012-01-31 NoSQL in .NET

NoSQL

Raven Db Documentation

http://ravendb.net/docs

Page 37: 2012-01-31 NoSQL in .NET

JSON * Transaktional

LINQ Lucene

100% .NET AGPL / dual

* Newtonsoft.Json.dll JSON DOM (Raven.Json)

Page 38: 2012-01-31 NoSQL in .NET

“Deployment” › Via NuGet

› Raven.Server.exe.config anpassen It’s safe by default!

› Server-Start: Raven.Server.exe

Page 40: 2012-01-31 NoSQL in .NET

Designed to “just work” › Fluent API

› Unit of Work Pattern

› Extensible – Plugin Support

Page 41: 2012-01-31 NoSQL in .NET

Safe by default › praktische defaults

› z.B. Limited page size – kein unabsichtliches SELECT *

› ACID

› Client / Server

› Cross shard

Page 42: 2012-01-31 NoSQL in .NET

Indexe › Als Linq Queries definiert

› Indiziert mit Lucene .NET

Page 43: 2012-01-31 NoSQL in .NET

APIs › Native .NET Client API

› HTTP API (Pseudo REST)

Page 44: 2012-01-31 NoSQL in .NET

HTTP API › Caching

› E-Tags

› Lucene Queries möglich

C:\>curl -X GET http://localhost:8080/docs/Categories/1 -i HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 ETag: 00000000-0000-0200-0000-000000000004 { "Name" : "Normal Importance", "Color" : "green" }

Page 45: 2012-01-31 NoSQL in .NET

Lucene Style Queries

Lucene Style var notes = session.Advanced .LuceneQuery<Note>() .Where(“Category:Important") .ToArray();

Classic Linq Style var notes = session .Query<Note>() .Where(n => n.Category == “Important") .ToArray();

Page 46: 2012-01-31 NoSQL in .NET

NoSQL: Einstieg in die Welt nicht-

relationaler Web 2.0 Datenbanken

MongoDB:

The Definitive Guide

MongoDB in Action RavenDB Mythology Documentation https://s3.amazonaws.com/

daily-builds/RavenDBMythology-11.pdf

Page 47: 2012-01-31 NoSQL in .NET

https://webnote.codeplex.com/

Page 48: 2012-01-31 NoSQL in .NET

Veranstalter: Partner:

30.-31. JAN. 2012, MÜNCHEN

VISUAL STUDIO FÜR WINDOWS-ENTWICKLER

FRAGEN?

Page 49: 2012-01-31 NoSQL in .NET

Veranstalter: Partner:

Wir sehen uns wieder!

Advanced Developers Conference C++

3. – 4. Mai 2012, Zugspitzland

Development for C++ Professionals!

www.adcpp.de

SharePoint Konferenz in Wien

19. – 20. Juni 2012, Wien

ppedv-Konferenz in Kooperation mit

Microsoft Österreich

www.SharePointKonferenz.at

Page 50: 2012-01-31 NoSQL in .NET

Veranstalter: Partner:

30.-31. JAN. 2012, MÜNCHEN

VISUAL STUDIO FÜR WINDOWS-ENTWICKLER

Hat Ihnen mein Vortrag gefallen?

Ich freue mich auf Ihr Feedback!

Page 51: 2012-01-31 NoSQL in .NET

Veranstalter: Partner:

30.-31. JAN. 2012, MÜNCHEN

VISUAL STUDIO FÜR WINDOWS-ENTWICKLER

Vielen Dank Johannes Hoppe

Page 52: 2012-01-31 NoSQL in .NET

https://webnote.codeplex.com/

Page 53: 2012-01-31 NoSQL in .NET

Bildnachweise

Ausgewählter Ordner © Spectral-Design – Fotolia.com

Warnhinweis-Schild © Sascha Tiebel – Fotolia.com

Liste abhaken © Dirk Schumann – Fotolia.com

Stressed businessman © Selecstock – Fotolia.com