Intro to RavenDB

2,924 views

Published on

Published in: Technology
  • Be the first to comment

Intro to RavenDB

  1. 1. RavenDB What is it?
  2. 2. Hi, My Name Is… Alonso Robles  @alonsorobles  http://alonsorobles.com Principal Consultant at Headspring  @headspring  http://headspring.com
  3. 3. Before we begin… Central Texas GiveCamp  Developers  Sponsors  http://ctxgivecamp.org RavenDB Boot Camp  September 5th-6th  2-day hands-on workshop  Headspring, Austin, TX  http://headspring.com
  4. 4. Agenda NoSQL Crash Course Overview of RavenDB Development with RavenDB
  5. 5. Crash Course NoSQuirreLs? But why?
  6. 6. History of the Datum We (the programmers) gave birth to data We put it (the data) in memory We discovered a way to persist it So we put it in files And we had more problems to solve…
  7. 7. From Data To Management  Common problems  Data retrieval  Concurrent writes  Optimize for space  Data aggregation  Lead to the introduction of  RDBMS  SQL
  8. 8. RDBMS + SQL Strengths Limitations ACID  Scaling horizontally is hard  Atomic  Consistent  Scaling vertically is expensive  Isolated  Object to relation mapping can  Durable be difficult Relational  Table / Row Rich query support Data Integrity  Foreign Keys  Enforced Schema
  9. 9. CAP Theorem
  10. 10. Polyglot Persistence Relational  MS SQL Server  MySQL Key-Value  Redis  Dynamo Column-Oriented  BigTable  Cassandra Document-Oriented  MongoDB  RavenDB
  11. 11. Key-Value  Simplest of all data stores  IDictionary<string, object>  Key is a string  Value is a blob  Schema free  Query by key  Or key range sometimes  Good candidate for  User session storage  Shopping carts
  12. 12. Document-Oriented Like a key-value store Document in known format  JSON  BSON  XML Supports server side operations Good for  Complex objects  DDD Aggregates
  13. 13. Column-Oriented  Not relational at all  Schema free  Concepts to understand  Column families  Row Keys  Columns  A Key Value Pair  Good for  Large amounts of sparse data
  14. 14. Is SQL Dead? Nope It’s still the strongest option for  Reports  Dynamic Aggregations  Data integrity enforcement Remember  NoSQL = Not Only SQL  Or… NoSQuirreLs
  15. 15. RavenDBThe Very Brief Overview
  16. 16. What is it? It’s a document database Built on .NET for .NET JSON data storage Built on top of Lucene Open source Gets out of your way It just works Just code – studio not required
  17. 17. Features I Really Like Scalable via shards and/or replication Schema free Easy to learn and develop against Full power of Lucene  Full-text search  Faceted search  Auto suggest  More like this Multiple deployment options
  18. 18. Development Oh yeah! It’s fun!
  19. 19. .NET Client API IDocumentStore  Session factory  Thread safe heavy weight object  Thread safe  Use single instance per application IDocumentSession  Interacts with the database  Not thread safe light weight object  Implements Unit of Work pattern  Use one per thread or web request
  20. 20. CRUD Operations Create  IDocumentSession.Store(object) Retrieve  IDocumentSession.Load<T>(string) Update  Retrieve and modify Delete  IDocumentSession.Delete(object) Don’t Forget  IDocumentSession.SaveChanges()
  21. 21. Query Operations Rich LINQ support Basic Query  IDocumentSession.Query<T>()  Returns a IRavenQueryable<T>  Implements IQueryable<T> Filtering  Use a Where(…) clause Paging  Use Skip(int) and Take(int)
  22. 22. Dynamic Indexes Automagically created on demand Raven learns about your application Dynamic indexes marked as temporary  Removed if not used  Promoted to permanent if used a lot
  23. 23. Static Indexes Do it your self It’s just a class  That defines  Implicit or explicit index name  One or more map functions  Optional reduce function  Optional transform function  May define many other options like  Field options  Storage  Analysis
  24. 24. More to Learn Querying  Using the query statistics Indexes  More options  Hierarchical indexes  Polymorphic indexes Projections Document relationships Attachments Shards and Replication
  25. 25. Even More to Learn Advanced topics  Transaction support  Document metadata  Spatial search  Dynamic fields  Database commands Server administration Deployment options Multi-tenancy Using bundles
  26. 26. Where to Learn More Official website  http://ravendb.net Google group  http://groups.google.com/group/ravendb GitHub  http://github.com/ravendb/ravendb Headspring  Exclusive North American Training Partner  RavenDB Boot Camp on Sept 5th-6th  More info @ http://headspring.com Follow me on Twitter  @alonsorobles
  27. 27. The End Alonso Robles @alonsorobleshttp://alonsorobles.com

×