• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
2011-12-13 NoSQL aus der Praxis

2011-12-13 NoSQL aus der Praxis



Vortrag für die .NET User Group Frankfurt

Vortrag für die .NET User Group Frankfurt



Total Views
Views on SlideShare
Embed Views



1 Embed 1,508

http://blog.johanneshoppe.de 1508



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

    2011-12-13 NoSQL aus der Praxis 2011-12-13 NoSQL aus der Praxis Presentation Transcript

    • aus der Praxis13.12.2011Dipl.-Inf. (FH) Johannes HoppeM.Sc. Johannes Hofmeister
    • Johannes Hoppe .NET Webentwickler www.johanneshoppe.de
    • Johannes Hofmeister .NET Domänenexperte www.twitter.com/pro_cessor
    • 01Not only SQL
    • Daten 2002 2004 2006 2008 2010 2012
    • Daten› Facebook hat 60k Server (2010)› Google hat 450k Server (2006)› Microsoft: hat 100k - 500k Server (seit Azure) Facebook Server Footprint
    • Trend 1: increasing data sizesTrend 2: more connectedness (“web 2.0”)Trend 3: more individualization (fever structure)
    • verteilte und horizontale Skalierbarkeitkein relationales Datenmodell (kein SQL)schemafrei / schwache Schemarestriktionenanderes Konsistenzmodell
    • Scale-upVertikale SkalierungServer auf mehr Leistungsfähigkeit trimmen
    • Scale-outhorizontale SkalierungEinfügen von Nodes (Rechnerknoten)
    • Schemafreikein ALTER TABLEkein Wartungsfenster *Datenversionierung im Code!* morgens ausschlafen
    • Anforderungenan ein verteiltes System Consistency Konsistenz Partition Availability Tolerance Verfügbarkeit Ausfalltoleranz
    • CAP Theorem› 2000: E. Brewer, N. Lynch› You can satisfy at most 2 out of the 3 requirements
    • 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
    • Availability› System is “always on”, no downtime› Node failure tolerance – all clients can find some available replica› Software/hardware upgrade tolerance
    • Partition tolerance› System continues to function even when split into disconnected subsets (network disruption)› Not only for reads, but writes as well
    • “Drum prüfe,wer sich ewig bindet.”Friedrich Schiller
    • Kategorisierung› Key-Value stores› Document stores › Wide Column stores› Graphdatenbanken› weitere
    • 02MongoDB
    • NoSQL MongoDB Quick Reference Cards http://www.10gen.com/reference
    • “Deployment”› Standardverzeichnis erstellen: c:datadb› Server-Start: mongod.exe› Shell: mongo.exe
    • BSON Master/SlaveJavaScript C# DriverSharding GNU AGPL
    • JSON  BSONAll JSON documents are stored in a binaryformat called BSON. BSON supports aricher set of types than JSON.http://bsonspec.org
    • CRUD – Create(in the shell)› db.people.save({name: Smith, age: 30});See how the save command works:› db.foo.save
    • CRUD – Create…with a bit JavaScriptfor(i=0; i<1000; i++) { [quiz, essay, exam].forEach(function(name) { var score = Math.floor(Math.random() * 50) + 50; db.scores.save({student: i, name: name, score: score}); }); } db.scores.count();
    • CRUD – ReadQueries are specified using a document-style syntax!› db.scores.find();› db.scores.find({score: 50});› db.scores.find({score: {"$gte": 70}});› db.scores.find({score: {"$gte": 70}});
    • CRUD – Update› db.people.update({name: Smith}, {$set: {interests: []}});› db.people.update({name: Smith}, {$push: {interests: [chess]}});
    • CRUD – Delete› db.dropDatabase();› db.foo.drop();› db.foo.remove();
    • “Map Reduce is the Uzi of aggregationtools. Everything described with count,distinct and group can be done withMapReduce, and more.”Kristina Chadorow, Michael Dirolf in MongoDB – The Definitive Guide
    • https://webnote.codeplex.com
    • 03RavenDB
    • NoSQL Raven Db Documentation – All you need to know http://beta.ravendb.net/docs
    • JSON TransactionalLINQ Lucene100% .NET AGPL / dual
    • RavenDb› Written by Oren Eini aka Ayende Rahien › Hibernating Rhinos › Rhino Mocks & Rhino.ServiceBus› Written in C#
    • Deployment› Get it via NuGet› Change defaults in Raven.Server.exe.config › It’s safe by default› Just run the Raven.Server.exe in the /server/ folder
    • Safe by default› Useful defaults › E.g. Limited page size – No Accidental SELECT *› ACID › Client / Server › Cross shard
    • Units› Documents › Collections› Indexes› Attachments
    • Designed to “just work”› Schema Free › Hardly any mapping required › dynamic (C# 4) yields great power
    • Designed to “just work”› Sleek Client API › Fluent API › Unit of Work Pattern › Extensible – Plugin Support
    • Makes developers happy› Testable › Interfaces all over › In-Memory Database› Extensible – Plugin Support
    • APIs› Native .NET Client API› HTTP API (Pseudo REST)
    • Indexes› Written as Linq Queries› Indexed with Lucene .NET› Lucene Syntax for querying
    • “While being RESTful is a goal of theHTTP API, it is secondary to the goal ofexposing easy to use and powerfulfunctionality”Ayende Rahien on the HTTP API - http://ravendb.net/documentation/docs-http-api-restful
    • HTTP API › Caching › E-Tags › Lucene Queries possibleC:>curl -X GET http://localhost:8080/docs/Categories/1 -iHTTP/1.1 200 OKContent-Type: application/json; charset=utf-8ETag: 00000000-0000-0200-0000-000000000004{ "Name" : "Normal Importance", "Color" : "green"}
    • Lucene Style QueriesClassic Linq Style Lucene Stylevar notes = session var notes = session.Advanced.Query<Note>() .LuceneQuery<Note>().Where(n => n.Category == “Important") .Where(“Category:Important").ToArray(); .ToArray();
    • 04Tabellen  Dokumente
    • 05Key and Index Strategies
    • FRAGEN?
    • https://webnote.codeplex.com/
    • Vielen Dank! Johannes Hoppe Johannes Hofmeister
    • BildnachweiseAusgewählter Ordner © Spectral-Design – Fotolia.comWarnhinweis-Schild © Sascha Tiebel – Fotolia.comListe abhaken © Dirk Schumann – Fotolia.comStressed businessman © Selecstock – Fotolia.com