nosql & ravendb with .net

Post on 27-Jan-2015

126 Views

Category:

Technology

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

NoSQL & RavenDB with .NET(C#) examples

TRANSCRIPT

NoSQL & RavenDB with

.NET

Venkat SomulaLead ArchitectWoltersKluwer (CLS – Corporate Legal Services)@vsomula

September 24, 2013

What is NoSQL? NoSQL is a brand name for Non-Relational(RDBMS) databases Means

Not Only SQL No schema No relationships between entities No joins and sub queries

Some of the Characteristics of NoSQL databases Not a relational database No Schema Open Source Highly scalable and available High retrieval performance

Why NoSQL? Flexible data model for being Schema-less Simple – just serialize objects as-is Avoid impedance mismatch between the code(object) and

data (table). One size(RDBMS) does not fit all Scalability(data distribution across multiple servers) When performance is the key - no joins To store and retrieve(quickly) millions of records with no

relations Integrated Caching Cost reduction – mostly work commodity servers Easy to program

NoSQL Types• RavenDB• MongoDB• CouchDB• MarkLogic

DocumentDatabases

• Redis• SimpleDB(Amazon)• Dynamo

Key/Value Stores

• Cassandra• BigTable(Google)• HBase

Tabular/Wide Column

Databases

• Neo4J• Infinite Graph• InfoGrid

GraphDatabases

NoSQLDatabases

http://ravendb.net

What is RavenDB? A NoSQL Database Document based – data is stored as JSON Open Source Built on C# REST based Schema less Simple and feature rich

RavenDB Features Support for multiple database hosting .NET client API for .NET platform REST API for non .NET platform Horizontal Scaling Supports ACID transactions Built-in full-text search Built-in caching Built-in sharding(split data across different servers) Built-in replication(copies of data in multiple servers) Storing of binary data(attachments, images, etc..) Support for Replication to SQL Server, Oracle, MySQL, etc.. Embedded database makes automated testing a breeze

High Level Architecture

.NET Client App

Non .NET Client App

RavenDB Server

RESTAPI

RavenDB Server

RESTAPI

RavenDB Server

RESTAPI

DataReplication

Tasks

IndexingTasks

RavenDB

.NET Client

API

http

RavenDBManagement

Studio

System Requirements Software

Windows .NET Framework 4.0

Hardware Minimum

2 GB of RAM 1 GHz Dual Core 1 GB of disk space

Recommended (more is better) 4 GB RAM 2 GHz Quad Core 50 GB of disk space

RavenDB Installation RavenDB has 2 parts (RavenDB Server and RavenDB client API) Download RavenDB Server or RavenDB Embedded from

http://ravendb.net/download 4 ways to Run RavenDB server

Console application from command Prompt(Raven.Server.exe) Windows Service(Raven.Server.exe /install) Website (Configure RavenDB-Build-xxxx/Web folder as website or

virtual directory) Embedded as part of .NET application(embedded version only)

Download RavenDB client from http://ravendb.net/download OR Download as Nuget Package(search for RavenDB)

RavenDB Management Studio

Is accessible at http://localhost:port#/raven/studio.html Available features

Create, Import, Export, and Backup database View/Edit/Delete documents Query documents Manage indexes View usage and recent queries etc.. Manage Authentication, replication, and sharding

Data Modeling In relational modeling, every entity is stored in its own

table(to avoid duplicate data) and joins are necessary where as in NoSQL world all related information is stored in single document for fast retrieval

Relational databases are optimized for writes where as NoSQL is optimized for reads

Relational NoSQL(RavenDB-JSON)

Order Order Item

ShippingInfo

BillingInfo

TrakcingInfo

Indexes Indexes play an important role in query performance Supports dynamic as well as static indexes Dynamic indexes get created by database automatically based

on queries but indexes are not persisted Static indexes are permanent, and can be created using code

or in the management studio(UI) Can define indexes using Linq queries Supports Map/Reduce functionality Indexes run in the background so no impact to the operations Indexes can be stale

Security Available only with commercial license Supports 2 types of authentication

Windows Authentication OAuth Authentication(API key authentication)

Basic Operations (using .NET Client API)

Initialize Database

Add Employee

Stored As JSON

Basic Operations …

Load Employee

Update Employee

Basic Operations …

Delete Employee

Query/Search Employees

Basic Operations …Paging

Best Practices Setup RavenDB server as IIS Website for granular

administration(load balancing, scalability, security, isolation, administration, start/stop, etc..)

Use .NET client API for .NET consumers Create static indexes for all known queries Keep in mind that indexes can be stale and design you

applications accordingly Use Includes feature to load related objects to avoid chatty

interface to database Use replication feature for high availability

Licensing Available freely as open source under AGPL license Refer to http://ravendb.net/licensing for commercial purposes

Use Cases Store server logs, errors, instrumentation/profiling Blogs – with comments, notes, tags, etc.. Shopping cart Complex objects with hierarchy(orders, product catalogue) High volume data (tweets, chat, comments, etc..) where query

performance is critical Click streams Big Data

Resources Site: http://ravendb.net Twitter: @RavenDB GitHub: https://github.com/ravendb/ravendb

top related