2011-12-13 NoSQL aus der Praxis

2,760 views
2,655 views

Published on

Vortrag für die .NET User Group Frankfurt

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,760
On SlideShare
0
From Embeds
0
Number of Embeds
1,537
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2011-12-13 NoSQL aus der Praxis

  1. 1. aus der Praxis13.12.2011Dipl.-Inf. (FH) Johannes HoppeM.Sc. Johannes Hofmeister
  2. 2. Johannes Hoppe .NET Webentwickler www.johanneshoppe.de
  3. 3. Johannes Hofmeister .NET Domänenexperte www.twitter.com/pro_cessor
  4. 4. 01Not only SQL
  5. 5. Daten 2002 2004 2006 2008 2010 2012
  6. 6. Daten› Facebook hat 60k Server (2010)› Google hat 450k Server (2006)› Microsoft: hat 100k - 500k Server (seit Azure) Facebook Server Footprint
  7. 7. Trend 1: increasing data sizesTrend 2: more connectedness (“web 2.0”)Trend 3: more individualization (fever structure)
  8. 8. verteilte und horizontale Skalierbarkeitkein relationales Datenmodell (kein SQL)schemafrei / schwache Schemarestriktionenanderes Konsistenzmodell
  9. 9. Scale-upVertikale SkalierungServer auf mehr Leistungsfähigkeit trimmen
  10. 10. Scale-outhorizontale SkalierungEinfügen von Nodes (Rechnerknoten)
  11. 11. Schemafreikein ALTER TABLEkein Wartungsfenster *Datenversionierung im Code!* morgens ausschlafen
  12. 12. Anforderungenan ein verteiltes System Consistency Konsistenz Partition Availability Tolerance Verfügbarkeit Ausfalltoleranz
  13. 13. CAP Theorem› 2000: E. Brewer, N. Lynch› You can satisfy at most 2 out of the 3 requirements
  14. 14. 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
  15. 15. Availability› System is “always on”, no downtime› Node failure tolerance – all clients can find some available replica› Software/hardware upgrade tolerance
  16. 16. Partition tolerance› System continues to function even when split into disconnected subsets (network disruption)› Not only for reads, but writes as well
  17. 17. “Drum prüfe,wer sich ewig bindet.”Friedrich Schiller
  18. 18. Kategorisierung› Key-Value stores› Document stores › Wide Column stores› Graphdatenbanken› weitere
  19. 19. 02MongoDB
  20. 20. NoSQL MongoDB Quick Reference Cards http://www.10gen.com/reference
  21. 21. “Deployment”› Standardverzeichnis erstellen: c:datadb› Server-Start: mongod.exe› Shell: mongo.exe
  22. 22. BSON Master/SlaveJavaScript C# DriverSharding GNU AGPL
  23. 23. JSON  BSONAll JSON documents are stored in a binaryformat called BSON. BSON supports aricher set of types than JSON.http://bsonspec.org
  24. 24. CRUD – Create(in the shell)› db.people.save({name: Smith, age: 30});See how the save command works:› db.foo.save
  25. 25. 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();
  26. 26. 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}});
  27. 27. CRUD – Update› db.people.update({name: Smith}, {$set: {interests: []}});› db.people.update({name: Smith}, {$push: {interests: [chess]}});
  28. 28. CRUD – Delete› db.dropDatabase();› db.foo.drop();› db.foo.remove();
  29. 29. “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
  30. 30. https://webnote.codeplex.com
  31. 31. 03RavenDB
  32. 32. NoSQL Raven Db Documentation – All you need to know http://beta.ravendb.net/docs
  33. 33. JSON TransactionalLINQ Lucene100% .NET AGPL / dual
  34. 34. RavenDb› Written by Oren Eini aka Ayende Rahien › Hibernating Rhinos › Rhino Mocks & Rhino.ServiceBus› Written in C#
  35. 35. 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
  36. 36. Safe by default› Useful defaults › E.g. Limited page size – No Accidental SELECT *› ACID › Client / Server › Cross shard
  37. 37. Units› Documents › Collections› Indexes› Attachments
  38. 38. Designed to “just work”› Schema Free › Hardly any mapping required › dynamic (C# 4) yields great power
  39. 39. Designed to “just work”› Sleek Client API › Fluent API › Unit of Work Pattern › Extensible – Plugin Support
  40. 40. Makes developers happy› Testable › Interfaces all over › In-Memory Database› Extensible – Plugin Support
  41. 41. APIs› Native .NET Client API› HTTP API (Pseudo REST)
  42. 42. Indexes› Written as Linq Queries› Indexed with Lucene .NET› Lucene Syntax for querying
  43. 43. “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
  44. 44. 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"}
  45. 45. 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();
  46. 46. 04Tabellen  Dokumente
  47. 47. 05Key and Index Strategies
  48. 48. FRAGEN?
  49. 49. https://webnote.codeplex.com/
  50. 50. Vielen Dank! Johannes Hoppe Johannes Hofmeister
  51. 51. BildnachweiseAusgewählter Ordner © Spectral-Design – Fotolia.comWarnhinweis-Schild © Sascha Tiebel – Fotolia.comListe abhaken © Dirk Schumann – Fotolia.comStressed businessman © Selecstock – Fotolia.com

×