azure weekly - 2015.01.20 - marco parenzan - data opportunities with azure
TRANSCRIPT
Data Opportunities with Azure
Marco ParenzanAzure Weekly – January 20th, 2015
Marco ParenzanTraining 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
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?
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
….
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
Opportunity
Enhance you SQL-BASED ASP.NET
experience with AZURE
Is Azure just a new hosting opportunity?
Yes, it’s an operational opportunity. You can solve your issues
about
Deployment
Security
Maintenance
(some) Scalability
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
Agenda
Operational opportunities in Azure
Developer opportunities in Azure
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
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
DEMO
SQL Server in a Azure VM
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”
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
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
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/
DEMOMigrate your SQL Database to SQL Azure
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
DEMOPublish your web app to Azure Web Site
in Visual Studio 2013
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!
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!)
DEMOConfigure ASP.NET using REDIS
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
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
DEMO
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
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
DEMO
Latencies with data
As already told, data is “far” from app
You can have issues with timeouts
You have to retry a query
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
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
DEMO
Conclusions
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
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
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
Thank You! - Q&A
Marco ParenzanAzure Weekly – January 20th, 2015
Email: [email protected]
Slideshare: http://www.slideshare.net/marcoparenzan
GitHub: https://www.gihtub.cob/marcoparenzan
Twitter: http://twitter.com/marco_parenzan