SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Being RDBMS Free
Alternative Approaches to Data
Persistence
DAVID HOERSTER
About Me
C# MVP (Since April 2011)
Sr. Solutions Architect at Confluence
One of the Conference Organizers for Pittsburgh TechFest
Past President of Pittsburgh .NET Users Group and organizer of recent Pittsburgh Code
Camps and other Tech Events
Twitter - @DavidHoerster
Blog – http://blog.agileways.com
Email – david@agileways.com
Goals
To allow you to achieve a zen-like state by
never having to decide between a left and
right outer join
Goals
That a non-relational solution may be considered an option
What are some areas of a traditional application that could be a non-relational solution
Introduce some non-relational tools
How those tools would be used in a .NET solution (CODE!)
Traditional Architecture
Data persistence is central to application
Generally monolithic
Jack of all trades; master of none
Traditional Architecture
Client
Web
Server
App
Server
Data
Repository
App Data
Session
Cache (?)
Full Text Search
Audit
Consider…
An online employment application
Wizard interface, with 9-12 steps
Most data is 1:1 across steps, but some data is 1:many
How to best structure 1:1 data
◦ 6-8 tables, linked by ID?
◦ Or one wide table with lots of nullable columns?
◦ What about joining?
How about 1:many data
◦ Several tables with 1:* relationships, which also needs to be joined
Don’t forget searching!!!
Applicant
General
Disclosure
Attestation
Skills
Empl
Educat’
n
Database Thaw
I'm confident to say that if you starting a new strategic enterprise
application you should no longer be assuming that your
persistence should be relational. The relational option might be the
right one - but you should seriously look at other alternatives.
-- Martin Fowler (http://martinfowler.com/bliki/PolyglotPersistence.html)
Monolithic Data Persistence
Provides consistency, but…
Is it always best tool for all jobs?
Is it easy for prototyping / rapid development?
Consider
◦ How data will be used
◦ What kinds of data you’ll have
Why Non-Relational
Use Case – Company Intranet / CMS
Overall object is a CMS-like app for a company’s intranet content
Usage is mostly read-only, with pages and attachments
◦ Pages, attachments, searching, admin, etc.
Traditional database could be multiple tables with 1:1 relationships and some 1:many
relationships
Lots of joins for a page
…or a single document
What if…
We could break some pieces out
◦ Flatten structures for querying
◦ Highly efficient search services
◦ Pub/sub hubs
◦ Remote caching with excellent performance
◦ Session management outside a DB for load balanced environments
How would app then be architected?
…but consider the costs
Learning curve
Distributed systems
Compensating transactions
Consider this with
◦ Data
◦ Searching
◦ Caching/Session
◦ Auditing
Data Storage
Typically, RDBMS is the de facto standard
◦ SQL Server
◦ MySQL
◦ PostgreSQL
◦ Oracle (Yikes!!)
But do you really need it?
Data Storage
Get all the orders for user ‘David’ in last 30 days
SELECT c.FirstName, c.MiddleName, c.LastName, soh.SalesOrderID, soh.OrderDate,
sod.UnitPrice, sod.OrderQty, sod.LineTotal,
p.Name as 'ProductName', p.Color, p.ProductNumber,
pm.Name as 'ProductModel',
pc.Name as 'ProductCategory',
pcParent.Name as 'ProductParentCategory'
FROM SalesLT.Customer c INNER JOIN SalesLT.SalesOrderHeader soh
ON c.CustomerID = soh.CustomerID
INNER JOIN SalesLT.SalesOrderDetail sod ON soh.SalesOrderID = sod.SalesOrderID
INNER JOIN SalesLT.Product p ON sod.ProductID = p.ProductID
INNER JOIN SalesLT.ProductModel pm ON p.ProductModelID = pm.ProductModelID
INNER JOIN SalesLT.ProductCategory pc ON p.ProductCategoryID = pc.ProductCategoryID
INNER JOIN SalesLT.ProductCategory pcParent ON pc.ParentProductCategoryID = pcParent.ProductCategoryID
WHERE c.FirstName = 'David'
AND soh.OrderDate > (GETDATE()-30)
Data Storage
Wouldn’t it be great if it were something like this?
SELECT FirstName, MiddleName, LastName, SalesOrderID, OrderDate,
UnitPrice, OrderQty, LineTotal, ProductName, Color, ProductNumber,
ProductModel, ProductCategory, ProductParentCategory
FROM CustomerSales
WHERE FirstName = 'David'
AND OrderDate > (GETDATE()-30)
Data Storage
Maybe a document database can be of use
Number out there
◦ MongoDB
◦ RavenDB
◦ Couchbase
Consolidated structures without relational ties to other collections
Object databases
Why Document Database
Quick prototyping
Application usage that lends itself to persisting objects
Consider usage of your data before using
Avoid “cool factor”
Consider performance
◦ “NoSQL is so much faster...”
◦ Um, not always…
Looking at MongoDB
Server can have databases
Databases contain collections (like a table)
Collections contain documents (like rows)
Documents can be structured, have hierarchies, indexes, primary key
Working with Mongo’s C# Client
public class MongoContext<T> : IContext<T> where T : class, new() {
private IDictionary<String, String> _config;
private readonly MongoCollection<T> _coll;
public MongoContext(IDictionary<String, String> config) {
_config = config;
var client = new MongoClient(config["mongo.serverUrl"]);
var server = client.GetServer();
var database = server.GetDatabase(config["mongo.database"]);
_coll = database.GetCollection<T>(config["mongo.collection"]);
}
public IQueryable<T> Items {
get { return _coll.FindAll().AsQueryable(); }
}
}
Working with Mongo’s C# Client
Encapsulate my queries and commands
public class FindPageById : ICriteria<Page> {
private readonly String _id;
public FindPageById(String pageId)
{
_id = pageId;
}
public IEnumerable<Page> Execute(IContext<Page> ctx)
{
return ctx.Items.Where(p => p.Id == _id);
}
}
Working with Mongo’s C# Client
Invoke my query/command
public class TemplateController : MyBaseController {
private readonly IContext<Page> _pageCtx;
public TemplateController(IContext<Page> ctx) : base() {
_pageCtx = ctx;
}
[HttpGet]
public IportalPageMetadata Section(String cat, String page) {
var id = String.Format("{0}/{1}", cat, page);
var thePage = new FindPageById(id)
.Execute(_pageCtx)
.FirstOrDefault();
...
}
}
Working with Mongo’s C# Client
Writing to Mongo is just as simple...
[HttpPost]
public Boolean Post(Page page)
{
var userId = await GetUserId();
new CreatePage(page, userId)
.Execute(_pages);
_searchPage.Insert(page);
return true;
}
Evolving Architecture
Client
Web
Server
App
Server
Data
Repository
Search
Some data (?)
Session
Cache (?)
Document
Repository
Write
Query
Search
How do you search?
◦ LIKE ‘%blah%’ ?
◦ Dynamic SQL
◦ Full-Text
LIKE and Dynamic SQL can be quick to create
◦ Tough to maintain
Full-Text gives power
◦ Limited in search options
Search
Number of search services out there like
◦ Lucene
◦ Solr
Lucene is a search engine
◦ Embed in apps
◦ .NET port (Lucene.NET)
Solr is search service
◦ Built on Lucene
◦ Connect apps to it
Searching with Solr
Disconnected from your application
Search content via HTTP REST calls
Can use SolrNet as a client
◦ https://github.com/mausch/SolrNet
Document-based
Searching with Solr
private readonly ISolrOperations<T> _solr;
public SolrSearchProvider(ISolrOperations<T> solr) { _solr = solr; }
public IEnumerable<T> Query(String searchString) {
var options = new QueryOptions() {
Fields = new List<String> {"title", "body", "lastModified" }.ToArray(),
Highlight = new HighlightingParameters() {
BeforeTerm = "<strong><em>",
AfterTerm = "</em></strong>",
Fields = new List<String> { "title", "body" }.ToArray(),
Fragsize = 100
}
};
var results = _solr.Query(new SolrQuery(searchString), options);
return results;
}
Evolving Architecture
Client
Web
Server
App
Server
Data
Repository
Some data (?)
Session
Cache (?)
Search
Service
Query
Write
Document
Repository
Write
Query
Session and Cache Data
Generally short-lived for users
Fairly static for cached data
Key/value stores can serve us well here
◦ Redis
Redis has two good .NET client libraries
◦ StackExchange.Redis
◦ ServiceStack.Redis
Using Redis
public class RedisSessionManager : ISessionManager {
private static ConnectionMultiplexer _redis = null;
private readonly IDictionary<String, String> _config;
public RedisSessionManager(IDictionary<String, String> config) {
if (_redis == null) {
_redis = ConnectionMultiplexer.Connect(config["session.serverUrl"].ToString());
}
_config = config;
}
public async Task<Boolean> CreateSessionAsync(String portalId, String userId, String fullName) {
var time = DateTime.UtcNow.ToString();
var timeout = _config.ContainsKey("session.timeout");
var vals = new HashEntry[] {
new HashEntry("userid", userId), new HashEntry("login", time),
new HashEntry("lastAction", time), new HashEntry("fullName", fullName)
};
await RedisDatabase.HashSetAsync(portalId, vals);
return await RedisDatabase.KeyExpireAsync(portalId, TimeSpan.FromMinutes(timeout));
}
}
Using Redis
public async Task<Boolean> ExtendSessionAsync(String portalId) {
var timeout = _config.ContainsKey("session.timeout");
await RedisDatabase.HashSetAsync(portalId, "lastAction",
DateTime.UtcNow.ToString());
return await RedisDatabase.KeyExpireAsync(portalId,
TimeSpan.FromMinutes(timeout));
}
public async Task<Boolean> ExpireSessionAsync(String portalId) {
return await RedisDatabase.KeyDeleteAsync(portalId);
}
Using Redis
At login (to stick session id in a cookie):
await Session.CreateSessionAsync(userId, fullName);
Upon log out:
await Session.ExpireSessionAsync(sessionCookie.Value);
Evolving Architecture
Client
Web
Server
App
Server
Data
Repository
Some data (?)
Search
Service
Query
Write
Document
Repository
Write
Query
Session/
Cache
Service
Why Data Store
We’re left with a database with not much use
◦ Transactional data in document store
◦ Search documents in Solr
◦ Session, caching, etc. in key/value or caching service like Redis
What it probably ends up acting as is…
Evolving Architecture
Client
Web
Server
App
Server
Event Store
2-3 flat tables
Event data
Search
Service
Query
Write
Document
Repository
Write
Query
Session/
Cache
Service
Queue?
(D)Evolved Architecture
Client
Web
Server
App
Server
Event
Store
Search
Service
Query
Write
Doc
Repo
Write
Query
Session/
Cache
Service
Queue?
(D)Evolved Architecture
Pick and choose what components work best
Don’t use them just to use them
Proof-of-Concept / Prototype
Why look to be RDBMS free
Searching
◦ More than just full-text needs
Data
◦ Choose a system that you can model the business
◦ Not the other way around
Caching / Session Values / PubSub
◦ Offload necessary?
◦ Ensure performance
Maintenance and support big factors to consider
Consider data usage/architecture before just jumping in
Tools
MongoDB
◦ http://mongodb.org
◦ RoboMongo http://robomongo.org
◦ Perf Best Practices http://info.mongodb.com/rs/mongodb/images/MongoDB-Performance-Best-
Practices.pdf
◦ Operations Best Practices http://info.mongodb.com/rs/mongodb/images/10gen-
MongoDB_Operations_Best_Practices.pdf
Solr
◦ http://lucene.apache.org/solr/
Redis
◦ http://redis.io/
◦ Redis Manager http://redisdesktop.com/

Weitere ähnliche Inhalte

Was ist angesagt?

AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013Amazon Web Services
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Studypetabridge
 
Search and analyze your data with elasticsearch
Search and analyze your data with elasticsearchSearch and analyze your data with elasticsearch
Search and analyze your data with elasticsearchAnton Udovychenko
 
Actor model in F# and Akka.NET
Actor model in F# and Akka.NETActor model in F# and Akka.NET
Actor model in F# and Akka.NETRiccardo Terrell
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON
 
Akka for big data developers
Akka for big data developersAkka for big data developers
Akka for big data developersTaras Fedorov
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data WarehousingDavide Mauri
 
Java Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsJava Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsAfkham Azeez
 
Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Yan Cui
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsNLJUG
 
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and moreTypesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and moreLegacy Typesafe (now Lightbend)
 
CQRS + ES with Scala and Akka
CQRS + ES with Scala and AkkaCQRS + ES with Scala and Akka
CQRS + ES with Scala and AkkaBharadwaj N
 
Slick – the modern way to access your Data
Slick – the modern way to access your DataSlick – the modern way to access your Data
Slick – the modern way to access your DataJochen Huelss
 
Enterprise Application Architectures by Dr. Indika Kumara
Enterprise Application Architectures by Dr. Indika KumaraEnterprise Application Architectures by Dr. Indika Kumara
Enterprise Application Architectures by Dr. Indika KumaraThejan Wijesinghe
 
Common Patterns of Multi Data-Center Architectures with Apache Kafka
Common Patterns of Multi Data-Center Architectures with Apache KafkaCommon Patterns of Multi Data-Center Architectures with Apache Kafka
Common Patterns of Multi Data-Center Architectures with Apache Kafkaconfluent
 
FunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemFunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemRobert Virding
 
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...Amazon Web Services
 
Introduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.ClusterIntroduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.Clusterpetabridge
 
Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster OpenCredo
 

Was ist angesagt? (20)

AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
AWS CloudFormation under the Hood (DMG303) | AWS re:Invent 2013
 
Syncromatics Akka.NET Case Study
Syncromatics Akka.NET Case StudySyncromatics Akka.NET Case Study
Syncromatics Akka.NET Case Study
 
Search and analyze your data with elasticsearch
Search and analyze your data with elasticsearchSearch and analyze your data with elasticsearch
Search and analyze your data with elasticsearch
 
Actor model in F# and Akka.NET
Actor model in F# and Akka.NETActor model in F# and Akka.NET
Actor model in F# and Akka.NET
 
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
44CON 2014 - Pentesting NoSQL DB's Using NoSQL Exploitation Framework, Franci...
 
Akka for big data developers
Akka for big data developersAkka for big data developers
Akka for big data developers
 
Agile Data Warehousing
Agile Data WarehousingAgile Data Warehousing
Agile Data Warehousing
 
Java Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable AppsJava Colombo: Developing Highly Scalable Apps
Java Colombo: Developing Highly Scalable Apps
 
Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)Serverless in production, an experience report (codemotion milan)
Serverless in production, an experience report (codemotion milan)
 
Introducing Akka
Introducing AkkaIntroducing Akka
Introducing Akka
 
Akka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based ApplicationsAkka in Practice: Designing Actor-based Applications
Akka in Practice: Designing Actor-based Applications
 
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and moreTypesafe Reactive Platform: Monitoring 1.0, Commercial features and more
Typesafe Reactive Platform: Monitoring 1.0, Commercial features and more
 
CQRS + ES with Scala and Akka
CQRS + ES with Scala and AkkaCQRS + ES with Scala and Akka
CQRS + ES with Scala and Akka
 
Slick – the modern way to access your Data
Slick – the modern way to access your DataSlick – the modern way to access your Data
Slick – the modern way to access your Data
 
Enterprise Application Architectures by Dr. Indika Kumara
Enterprise Application Architectures by Dr. Indika KumaraEnterprise Application Architectures by Dr. Indika Kumara
Enterprise Application Architectures by Dr. Indika Kumara
 
Common Patterns of Multi Data-Center Architectures with Apache Kafka
Common Patterns of Multi Data-Center Architectures with Apache KafkaCommon Patterns of Multi Data-Center Architectures with Apache Kafka
Common Patterns of Multi Data-Center Architectures with Apache Kafka
 
FunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang EcosystemFunctionalConf '16 Robert Virding Erlang Ecosystem
FunctionalConf '16 Robert Virding Erlang Ecosystem
 
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
(SPOT302) Under the Covers of AWS: Core Distributed Systems Primitives That P...
 
Introduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.ClusterIntroduction to Akka.NET and Akka.Cluster
Introduction to Akka.NET and Akka.Cluster
 
Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster Spring Boot Microservices vs Akka Actor Cluster
Spring Boot Microservices vs Akka Actor Cluster
 

Ähnlich wie Being RDBMS Free Alternative Approaches to Data Persistence

NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020Thodoris Bais
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMark Kromer
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven DesignRyan Riley
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampKais Hassan, PhD
 
QuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing WebinarQuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing WebinarRTTS
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Raza Baloch
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Servicesukdpe
 
DataFinder concepts and example: General (20100503)
DataFinder concepts and example: General (20100503)DataFinder concepts and example: General (20100503)
DataFinder concepts and example: General (20100503)Data Finder
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudMicrosoft ArcReady
 
Organizing the Data Chaos of Scientists
Organizing the Data Chaos of ScientistsOrganizing the Data Chaos of Scientists
Organizing the Data Chaos of ScientistsAndreas Schreiber
 
NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021Thodoris Bais
 
DataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data ManagementDataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data ManagementAndreas Schreiber
 
Advanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAdvanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAsad Abbas
 
Building a Testable Data Access Layer
Building a Testable Data Access LayerBuilding a Testable Data Access Layer
Building a Testable Data Access LayerTodd Anglin
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learnconfluent
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web appsyoavrubin
 

Ähnlich wie Being RDBMS Free Alternative Approaches to Data Persistence (20)

NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020NoSQL Endgame DevoxxUA Conference 2020
NoSQL Endgame DevoxxUA Conference 2020
 
Microsoft Azure Big Data Analytics
Microsoft Azure Big Data AnalyticsMicrosoft Azure Big Data Analytics
Microsoft Azure Big Data Analytics
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
Information Retrieval - Data Science Bootcamp
Information Retrieval - Data Science BootcampInformation Retrieval - Data Science Bootcamp
Information Retrieval - Data Science Bootcamp
 
QuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing WebinarQuerySurge Slide Deck for Big Data Testing Webinar
QuerySurge Slide Deck for Big Data Testing Webinar
 
DBMS an Example
DBMS an ExampleDBMS an Example
DBMS an Example
 
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
Cdocumentsandsettingsuser1desktop2 dbmsexamples-091012013049-phpapp01
 
Windows Azure and a little SQL Data Services
Windows Azure and a little SQL Data ServicesWindows Azure and a little SQL Data Services
Windows Azure and a little SQL Data Services
 
DataFinder concepts and example: General (20100503)
DataFinder concepts and example: General (20100503)DataFinder concepts and example: General (20100503)
DataFinder concepts and example: General (20100503)
 
ArcReady - Architecting For The Cloud
ArcReady - Architecting For The CloudArcReady - Architecting For The Cloud
ArcReady - Architecting For The Cloud
 
Practical OData
Practical ODataPractical OData
Practical OData
 
Organizing the Data Chaos of Scientists
Organizing the Data Chaos of ScientistsOrganizing the Data Chaos of Scientists
Organizing the Data Chaos of Scientists
 
NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021
 
DataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data ManagementDataFinder: A Python Application for Scientific Data Management
DataFinder: A Python Application for Scientific Data Management
 
12363 database certification
12363 database certification12363 database certification
12363 database certification
 
Introduction to azure document db
Introduction to azure document dbIntroduction to azure document db
Introduction to azure document db
 
Advanced full text searching techniques using Lucene
Advanced full text searching techniques using LuceneAdvanced full text searching techniques using Lucene
Advanced full text searching techniques using Lucene
 
Building a Testable Data Access Layer
Building a Testable Data Access LayerBuilding a Testable Data Access Layer
Building a Testable Data Access Layer
 
Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learn
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 

Mehr von David Hoerster

Creating scalable message driven solutions akkadotnet
Creating scalable message driven solutions akkadotnetCreating scalable message driven solutions akkadotnet
Creating scalable message driven solutions akkadotnetDavid Hoerster
 
Freeing Yourself from an RDBMS Architecture
Freeing Yourself from an RDBMS ArchitectureFreeing Yourself from an RDBMS Architecture
Freeing Yourself from an RDBMS ArchitectureDavid Hoerster
 
A Minimalist’s Attempt at Building a Distributed Application
A Minimalist’s Attempt at Building a Distributed ApplicationA Minimalist’s Attempt at Building a Distributed Application
A Minimalist’s Attempt at Building a Distributed ApplicationDavid Hoerster
 
Greenfield Development with CQRS and Windows Azure
Greenfield Development with CQRS and Windows AzureGreenfield Development with CQRS and Windows Azure
Greenfield Development with CQRS and Windows AzureDavid Hoerster
 
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRSDavid Hoerster
 
jQuery and OData - Perfect Together
jQuery and OData - Perfect TogetherjQuery and OData - Perfect Together
jQuery and OData - Perfect TogetherDavid Hoerster
 

Mehr von David Hoerster (7)

Creating scalable message driven solutions akkadotnet
Creating scalable message driven solutions akkadotnetCreating scalable message driven solutions akkadotnet
Creating scalable message driven solutions akkadotnet
 
Mongo Baseball .NET
Mongo Baseball .NETMongo Baseball .NET
Mongo Baseball .NET
 
Freeing Yourself from an RDBMS Architecture
Freeing Yourself from an RDBMS ArchitectureFreeing Yourself from an RDBMS Architecture
Freeing Yourself from an RDBMS Architecture
 
A Minimalist’s Attempt at Building a Distributed Application
A Minimalist’s Attempt at Building a Distributed ApplicationA Minimalist’s Attempt at Building a Distributed Application
A Minimalist’s Attempt at Building a Distributed Application
 
Greenfield Development with CQRS and Windows Azure
Greenfield Development with CQRS and Windows AzureGreenfield Development with CQRS and Windows Azure
Greenfield Development with CQRS and Windows Azure
 
Greenfield Development with CQRS
Greenfield Development with CQRSGreenfield Development with CQRS
Greenfield Development with CQRS
 
jQuery and OData - Perfect Together
jQuery and OData - Perfect TogetherjQuery and OData - Perfect Together
jQuery and OData - Perfect Together
 

Kürzlich hochgeladen

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Kürzlich hochgeladen (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Being RDBMS Free Alternative Approaches to Data Persistence

  • 1. Being RDBMS Free Alternative Approaches to Data Persistence DAVID HOERSTER
  • 2. About Me C# MVP (Since April 2011) Sr. Solutions Architect at Confluence One of the Conference Organizers for Pittsburgh TechFest Past President of Pittsburgh .NET Users Group and organizer of recent Pittsburgh Code Camps and other Tech Events Twitter - @DavidHoerster Blog – http://blog.agileways.com Email – david@agileways.com
  • 3. Goals To allow you to achieve a zen-like state by never having to decide between a left and right outer join
  • 4. Goals That a non-relational solution may be considered an option What are some areas of a traditional application that could be a non-relational solution Introduce some non-relational tools How those tools would be used in a .NET solution (CODE!)
  • 5. Traditional Architecture Data persistence is central to application Generally monolithic Jack of all trades; master of none
  • 7. Consider… An online employment application Wizard interface, with 9-12 steps Most data is 1:1 across steps, but some data is 1:many How to best structure 1:1 data ◦ 6-8 tables, linked by ID? ◦ Or one wide table with lots of nullable columns? ◦ What about joining? How about 1:many data ◦ Several tables with 1:* relationships, which also needs to be joined Don’t forget searching!!! Applicant General Disclosure Attestation Skills Empl Educat’ n
  • 8. Database Thaw I'm confident to say that if you starting a new strategic enterprise application you should no longer be assuming that your persistence should be relational. The relational option might be the right one - but you should seriously look at other alternatives. -- Martin Fowler (http://martinfowler.com/bliki/PolyglotPersistence.html)
  • 9. Monolithic Data Persistence Provides consistency, but… Is it always best tool for all jobs? Is it easy for prototyping / rapid development? Consider ◦ How data will be used ◦ What kinds of data you’ll have
  • 10. Why Non-Relational Use Case – Company Intranet / CMS Overall object is a CMS-like app for a company’s intranet content Usage is mostly read-only, with pages and attachments ◦ Pages, attachments, searching, admin, etc. Traditional database could be multiple tables with 1:1 relationships and some 1:many relationships Lots of joins for a page …or a single document
  • 11. What if… We could break some pieces out ◦ Flatten structures for querying ◦ Highly efficient search services ◦ Pub/sub hubs ◦ Remote caching with excellent performance ◦ Session management outside a DB for load balanced environments How would app then be architected?
  • 12. …but consider the costs Learning curve Distributed systems Compensating transactions Consider this with ◦ Data ◦ Searching ◦ Caching/Session ◦ Auditing
  • 13. Data Storage Typically, RDBMS is the de facto standard ◦ SQL Server ◦ MySQL ◦ PostgreSQL ◦ Oracle (Yikes!!) But do you really need it?
  • 14. Data Storage Get all the orders for user ‘David’ in last 30 days SELECT c.FirstName, c.MiddleName, c.LastName, soh.SalesOrderID, soh.OrderDate, sod.UnitPrice, sod.OrderQty, sod.LineTotal, p.Name as 'ProductName', p.Color, p.ProductNumber, pm.Name as 'ProductModel', pc.Name as 'ProductCategory', pcParent.Name as 'ProductParentCategory' FROM SalesLT.Customer c INNER JOIN SalesLT.SalesOrderHeader soh ON c.CustomerID = soh.CustomerID INNER JOIN SalesLT.SalesOrderDetail sod ON soh.SalesOrderID = sod.SalesOrderID INNER JOIN SalesLT.Product p ON sod.ProductID = p.ProductID INNER JOIN SalesLT.ProductModel pm ON p.ProductModelID = pm.ProductModelID INNER JOIN SalesLT.ProductCategory pc ON p.ProductCategoryID = pc.ProductCategoryID INNER JOIN SalesLT.ProductCategory pcParent ON pc.ParentProductCategoryID = pcParent.ProductCategoryID WHERE c.FirstName = 'David' AND soh.OrderDate > (GETDATE()-30)
  • 15. Data Storage Wouldn’t it be great if it were something like this? SELECT FirstName, MiddleName, LastName, SalesOrderID, OrderDate, UnitPrice, OrderQty, LineTotal, ProductName, Color, ProductNumber, ProductModel, ProductCategory, ProductParentCategory FROM CustomerSales WHERE FirstName = 'David' AND OrderDate > (GETDATE()-30)
  • 16. Data Storage Maybe a document database can be of use Number out there ◦ MongoDB ◦ RavenDB ◦ Couchbase Consolidated structures without relational ties to other collections Object databases
  • 17. Why Document Database Quick prototyping Application usage that lends itself to persisting objects Consider usage of your data before using Avoid “cool factor” Consider performance ◦ “NoSQL is so much faster...” ◦ Um, not always…
  • 18. Looking at MongoDB Server can have databases Databases contain collections (like a table) Collections contain documents (like rows) Documents can be structured, have hierarchies, indexes, primary key
  • 19. Working with Mongo’s C# Client public class MongoContext<T> : IContext<T> where T : class, new() { private IDictionary<String, String> _config; private readonly MongoCollection<T> _coll; public MongoContext(IDictionary<String, String> config) { _config = config; var client = new MongoClient(config["mongo.serverUrl"]); var server = client.GetServer(); var database = server.GetDatabase(config["mongo.database"]); _coll = database.GetCollection<T>(config["mongo.collection"]); } public IQueryable<T> Items { get { return _coll.FindAll().AsQueryable(); } } }
  • 20. Working with Mongo’s C# Client Encapsulate my queries and commands public class FindPageById : ICriteria<Page> { private readonly String _id; public FindPageById(String pageId) { _id = pageId; } public IEnumerable<Page> Execute(IContext<Page> ctx) { return ctx.Items.Where(p => p.Id == _id); } }
  • 21. Working with Mongo’s C# Client Invoke my query/command public class TemplateController : MyBaseController { private readonly IContext<Page> _pageCtx; public TemplateController(IContext<Page> ctx) : base() { _pageCtx = ctx; } [HttpGet] public IportalPageMetadata Section(String cat, String page) { var id = String.Format("{0}/{1}", cat, page); var thePage = new FindPageById(id) .Execute(_pageCtx) .FirstOrDefault(); ... } }
  • 22. Working with Mongo’s C# Client Writing to Mongo is just as simple... [HttpPost] public Boolean Post(Page page) { var userId = await GetUserId(); new CreatePage(page, userId) .Execute(_pages); _searchPage.Insert(page); return true; }
  • 23. Evolving Architecture Client Web Server App Server Data Repository Search Some data (?) Session Cache (?) Document Repository Write Query
  • 24. Search How do you search? ◦ LIKE ‘%blah%’ ? ◦ Dynamic SQL ◦ Full-Text LIKE and Dynamic SQL can be quick to create ◦ Tough to maintain Full-Text gives power ◦ Limited in search options
  • 25. Search Number of search services out there like ◦ Lucene ◦ Solr Lucene is a search engine ◦ Embed in apps ◦ .NET port (Lucene.NET) Solr is search service ◦ Built on Lucene ◦ Connect apps to it
  • 26. Searching with Solr Disconnected from your application Search content via HTTP REST calls Can use SolrNet as a client ◦ https://github.com/mausch/SolrNet Document-based
  • 27. Searching with Solr private readonly ISolrOperations<T> _solr; public SolrSearchProvider(ISolrOperations<T> solr) { _solr = solr; } public IEnumerable<T> Query(String searchString) { var options = new QueryOptions() { Fields = new List<String> {"title", "body", "lastModified" }.ToArray(), Highlight = new HighlightingParameters() { BeforeTerm = "<strong><em>", AfterTerm = "</em></strong>", Fields = new List<String> { "title", "body" }.ToArray(), Fragsize = 100 } }; var results = _solr.Query(new SolrQuery(searchString), options); return results; }
  • 28. Evolving Architecture Client Web Server App Server Data Repository Some data (?) Session Cache (?) Search Service Query Write Document Repository Write Query
  • 29. Session and Cache Data Generally short-lived for users Fairly static for cached data Key/value stores can serve us well here ◦ Redis Redis has two good .NET client libraries ◦ StackExchange.Redis ◦ ServiceStack.Redis
  • 30. Using Redis public class RedisSessionManager : ISessionManager { private static ConnectionMultiplexer _redis = null; private readonly IDictionary<String, String> _config; public RedisSessionManager(IDictionary<String, String> config) { if (_redis == null) { _redis = ConnectionMultiplexer.Connect(config["session.serverUrl"].ToString()); } _config = config; } public async Task<Boolean> CreateSessionAsync(String portalId, String userId, String fullName) { var time = DateTime.UtcNow.ToString(); var timeout = _config.ContainsKey("session.timeout"); var vals = new HashEntry[] { new HashEntry("userid", userId), new HashEntry("login", time), new HashEntry("lastAction", time), new HashEntry("fullName", fullName) }; await RedisDatabase.HashSetAsync(portalId, vals); return await RedisDatabase.KeyExpireAsync(portalId, TimeSpan.FromMinutes(timeout)); } }
  • 31. Using Redis public async Task<Boolean> ExtendSessionAsync(String portalId) { var timeout = _config.ContainsKey("session.timeout"); await RedisDatabase.HashSetAsync(portalId, "lastAction", DateTime.UtcNow.ToString()); return await RedisDatabase.KeyExpireAsync(portalId, TimeSpan.FromMinutes(timeout)); } public async Task<Boolean> ExpireSessionAsync(String portalId) { return await RedisDatabase.KeyDeleteAsync(portalId); }
  • 32. Using Redis At login (to stick session id in a cookie): await Session.CreateSessionAsync(userId, fullName); Upon log out: await Session.ExpireSessionAsync(sessionCookie.Value);
  • 33. Evolving Architecture Client Web Server App Server Data Repository Some data (?) Search Service Query Write Document Repository Write Query Session/ Cache Service
  • 34. Why Data Store We’re left with a database with not much use ◦ Transactional data in document store ◦ Search documents in Solr ◦ Session, caching, etc. in key/value or caching service like Redis What it probably ends up acting as is…
  • 35. Evolving Architecture Client Web Server App Server Event Store 2-3 flat tables Event data Search Service Query Write Document Repository Write Query Session/ Cache Service Queue?
  • 37. (D)Evolved Architecture Pick and choose what components work best Don’t use them just to use them Proof-of-Concept / Prototype
  • 38. Why look to be RDBMS free Searching ◦ More than just full-text needs Data ◦ Choose a system that you can model the business ◦ Not the other way around Caching / Session Values / PubSub ◦ Offload necessary? ◦ Ensure performance Maintenance and support big factors to consider Consider data usage/architecture before just jumping in
  • 39. Tools MongoDB ◦ http://mongodb.org ◦ RoboMongo http://robomongo.org ◦ Perf Best Practices http://info.mongodb.com/rs/mongodb/images/MongoDB-Performance-Best- Practices.pdf ◦ Operations Best Practices http://info.mongodb.com/rs/mongodb/images/10gen- MongoDB_Operations_Best_Practices.pdf Solr ◦ http://lucene.apache.org/solr/ Redis ◦ http://redis.io/ ◦ Redis Manager http://redisdesktop.com/