This document discusses how Azure provides opportunities for handling data beyond traditional relational databases. It presents Azure as both an operational opportunity for hosting through IaaS and PaaS offerings, as well as an architectural opportunity through services like Redis, Azure Search, and scaling data across instances. The document demonstrates migrating a SQL database to SQL Azure, publishing a web app to an Azure web site, configuring ASP.NET to use Redis, and searching data with Azure Search. It concludes that Azure should be viewed as a platform to enhance applications through improved data handling.
2. Marco Parenzan
Training and Speaking with 1nn0va
Microsoft MVP 2014 for Microsoft Azure
Training and planning with ITS Kennedy
www.slideshare.net/marco.parenzan
marco [dot] parenzan [at] libero [dot] it
www.innovazionefvg.net
Developer and Architect in .NET and Web
Cloud Developer
Loves functional programming
Some videogames for fun
3. Data Legacy WITHOUT Azure
It’s common having just ONE data store in our toolbox
Typically it’s a relational database (either Microsoft SQL server or
other SQL vendors)
Traditional hosting providers had just few combinations of data and
hosting capabilities
Is Azure just another data (and hosting) opportunity?
4. Data WITH Azure
Azure give you many opportunities handling you data
Not just relational
Not just small
Not just monolithic
Not just table
Not just fields
….
5. One Scenario
You have an ASP.NET MVC application
But ASP.NET WebForms, PHP, Java is the same
You have a relational DB in SQL Server
But having a MySQL, Postgre, “Oracle”, is the same
7. Is Azure just a new hosting opportunity?
Yes, it’s an operational opportunity. You can solve your issues
about
Deployment
Security
Maintenance
(some) Scalability
8. Is Azure just a new hosting opportunity?
No, it’s also an architectural opportunity, but only if you write
some code
Cache your data
Search your data
Query your data
10. Handle relational data with IaaS: Pro
Free to choose your OS
Full power of a Relational DB
Simple Scaling Up
“partial” licencing
Pay Per Use (no CAPEX)
Full power control
Ready images (no installation)
With specific configurations
Just Click, Name, choose, deploy
11. Handle relational data with IaaS: Cons
OPEX: highest
Relational (non open) DBMS are expensive
Bits+Management
You have to be a real Administrator
Scalability: you can ONLY scale up
Current sharding needs application to be updated
Current sharding is in experimentation stage
13. Handle relational data with SaaS
You don’t want to handle management issues
You don’t want vertical scalability-related issues
You don’t need special infrastructural architecture
“PaaS if possibile, IaaS if really needed”
14. Handle relational data with SaaS: Pro
OPEX: lower than IaaS
Bits+Management
Full power of a Relational DB
Editions
Clustering
CPU+Memory
No licencing (No CAPEX)
Pay Per Use (OPEX)
No need for images
15. Handle relational data with SaaS: Cons
OPEX: lower, than IaaS
Partial power of a Relational DB
Configure what is just available
Scalability: can ONLY scale up
16. Migrating your on-premise SQL to SQL Azure
Not all features of On-Premise SQL are available in SQL Azure
A “backup” is not enough to bring DB to the cloud
Exporting a script
Last December 2014 update have great news
Some tools are available, updated
Developer Way: Database Project, targeting SQL Azure
Operations Way: Database | Tasks | Deploy to Windows Azure SQL Database
https://sqlazuremw.codeplex.com/
18. Host your Web Application in a Azure Web Site
Publish your Web Application in a Web Sites
Seconds (minutes) to go
Configure DB access in web.config
20. Stateful web application
Statefulness is the state that influences the computation of every
request in a web application
State avoids horizontal scalability
State is evil, but you have it!
21. Bring state OUTSIDE your web server
Redis as an efficient in memory key/value store
Configure ASP.NET MVC to use Redis (declarative approach)
Session State is taken OUTSIDE web application
State can be shared between two or more instances (scaling out!)
23. Latency in a cloud environment is an issue
In a cloud environment, database is FAR from app hosting
Query result set can “arrive” long…
How many times is a query executed? How many times same data
are retrieved?
In a pay per use environment, queries costs?
SQL licensing
Bandwidth
24. Programming approach to Redis
Implements a cache-aside pattern
http://azure.microsoft.com/en-us/documentation/infographics/cloud-design-patterns/
Query cache first
If not found, Query data source and store result in cache
Cache invalidation rules have to be handled
Explicit
Timeout
Find many .NET clients in nuget
Example Stack Exchange implementation
26. Search inside your data
Search on relational DB is tipically “field-oriented” search
Search in the web is more “context free”, “full text” search
Handling text is not simple
27. Azure Search
A search-as-a-service solution allowing developers to incorporate great
search experiences into applications without managing infrastructure or
needing to become search experts.
You acquire immediately all text search experience
You acquire immediately support for languages
It is based on Elastic Search
Bullet proof, state of the art, search implementation
It is independent from a specific data source
You need to publish your data EXPLICITLY to the search service
29. Latencies with data
As already told, data is “far” from app
You can have issues with timeouts
You have to retry a query
30. Data that scale out
You can handle scalability in two ways
Scale up: increase power of your “hardware” to improve
application responsiveness
But you cannot avoid programming issues, like “locks”
Scale out: partition data. Divide data horizontally (by key) to
distribute data between instances.
Problem: SQL db don’t partition
31. Entity Framework to the rescue
All issues can be solved at application level with Entity Framework
(EF6)
Well, with some help from external code
Not native implementations
Not the best solutions in Cloud
34. Recap Operations
Migrate your DB to SQL Azure
Or the equivalent DaaS for the RDBMS you like (https://www.cleardb.com/, for
example)
Use IaaS only if you really (really) need
Publish your app on Web Site
35. Developer Recap
Create a Redis instance
Configure SessionState if you use Session in ASP.NET
Implement cache-aside pattern to avoid repeated queries – this is the same for
every db you use
Create an Azure Search instance
Enhance your experience in text search!
Improve EF experience
Handle retries (in cloud is mandatory)
Partition your data if you have very big datasets
36. Conclusions
Consider Azure as a Platform opportunity for your application
Consider Azure as a Data Platform opportunity for your application
You cannot move your application without making improvements
to your architecture
Make an assessment to check all issues with your legacy chooses
Evaluate all other data opportunities in Azure