Accesso ai dati con Azure Data Platform

Preview:

Citation preview

Accesso ai dati con la Azure Data Platform Luca Di FinoWindows & Windows Phone developer

dev.luke2375@live.it@luke2375

#azureit15

Microsoft Azure Data Platform

+Databas

e aggiunti

vi

Types of Data You Can Store in Azure• Relational data (Azure SQL)• Flat semi-structured data (Azure Storage Tables)• Files (Azure Storage Blobs)• Serialized Object Graphs in Binary / Base64 (Azure

Storage Blobs)• Messages between systems or processes (Azure

Storage Queues)• Serialized Object Graphs in JSON (DocumentDb)• Cache (Redis)• Application data for PHP apps (MySQL managed by

ClearDb)• NoSQL data (MongoDb managed by MongoLabs)• Big Data (Microsoft HDInsight

Azure Data Platform

Demo

What is “NoSQL”?

• Modeled using other mechanisms than tables and relations• Key-value stores (Azure Storage Tables)• Document databases (DocumentDb)• Graph databases for storing complex relationships

(See: http://bit.do/graph-db Ex. Neo4j)

• “Not Only SQL” • Vertical vs. Horizontal Scaling

Azure Table Storage

How Azure Storage Tables are structured

Anatomy of an Entity

Required Properties•PartitionKey•RowKey•Timestamp•Etag (think: optimistic concurrency)

Even though Azure Storage Tables are represented in a tabular format, they are not to be confused with RDBMS tables

Comparing Azure Storage Tables with Azure SQL

• You cannot design Azure Storage Tables using relational database theory (Codd, normal forms, etc.) These serve a different purpose

http://bit.do/azure-tables-vs-sql

Maximum row size 1 MB Max 255 properties

2 GB Max 1024 columns

Maximum data size 200 TB per table 150 GB per database

Maximum number of rows retrieved per query

1,000 Unlimited

Utilizing Tables in your applicationAzure Storage Client library (wrapper around RESTful HTTP Azure Management API)Basic course of events:• Create a connection to the storage account• Create a connection to a table (or create it if it doesn’t exist)• Insert entities (Batch insertion)

• Entity classes (POCOs) must inherit from TableEntity class to be serialized for persistence in Azure Storage Tables

• Perform some command (update, delete, retrieve / filter)• Retrieve / filter using TableQuery<T>

Storage Tables

Demo

Azure Storage Queues

Azure Storage Queues• Messages are inserted into Queues and kept in order until they are “delivered” (de-queued)

• Simple First-In-First-Out queue in the cloud

• Each queue message can only be 64k (plenty!) but a queue can hold 200 TB of messages!

• Enables highly scalable applications allowing multiple queue writers to work with multiple queue readers.

• Handles unexpected spikes in traffic

Anatomy of Messages• Messages can be strings (UTF-8) or byte

arrays• Typical messages contain:• some proprietary message format (an XML document, comma-delimited file, etc.)• A serialized object or object graph (Ideally both writer and reader would depend on the same interfaces)

• Messages have an expiration date which is, by default, 1 week

Processing Queues• To process (read) a queue, a reader will grab a bunch of messages (max: 32) off a queue in a single request

• These are hidden – not removed – until the reader deletes (de-queues) them OR the reader times out, at which point they are un-hidden allowing another reader to attempt to process them.

• Message contents and timeouts can be modified

• Messages can be “peeked” at, which does not hide them on the queue (you can also peek at the number of messages on the queue)

Why queues are awesome• Reduces the possibility that data is lost due to

timeouts to the data store or long running processes

• Allows applications to accept data from a user then throw it over the wall to the reader (i.e., a web job, worker role, backend process, etc.)

• The reader will get to it eventually – or to handle more load, just add more instances of the reader temporarily

• Send messages between disparate systems

Storage Queues

Demo

Azure Storage Blobs

Azure Storage Blobs

• Blob = Binary Large Object• Many practical uses inside and outside of

Azure (i.e., Virtual Machines, logs, CDN origin, backups, etc.)

Anatomy of a Blob• Any file type and size can be stored in a

blob• Most of the time, you’ll use “block blobs”

– 200 GB• Need to modify ranges of bytes inside of

a blob frequently? Use “page blobs” – up to 1 TB

• Blobs are accessible via URL format: http://<storage-account>.blob.core.windows.net/<container>/<blob>

• Blobs can live inside of folders (and sub-folders) of a container

Securing Blobs - Management Keys• Container Access:• Private => Default, only visible by owner • Public Blob => Read access for blobs only (not container stuff)• Public Container => Full read access for blob and container

• Shared Access Signature – Restricted rights for a specific time interval (Actually works on tables and queues, too)

Storage Blobs

Demo

Azure SQL Server

What is Azure SQL?

Core RDBMS SQL Server functionality in the cloud.  High availability, low learning curve, inexpensive starting point, elastic capacity, low management overhead.

What you get:• Tables, Views, Stored Procedures,

Security Roles and Users• Limited T-SQL functionality• Automatic backups• Auditing• Monitoring• Geo-replication• Client tools you already know + online

administration

Service Tier

Performance Level

Common App Pattern

Performance Business Continuity

Max DB Size

Transaction Perf. Objective

DTU PITR DR / GEO-Rep

Basic Basic Small DB, SQL opp

2 GB Reliability / Hr.

5 7 Days

DB Copy + Manual Export

Standard

S0S1S2

Wrkgp/cloud app, multiple concurrent operations

250 GB

Reliability / Min.

102050

14 Days

DB Copy + Manual Export

Premium

P1P2P3

Mission Critical, High volume, Many concurrent Users

500 GB

Reliability / sec.

100200800

35 Days

Active Geo-replication

Scegliere l’edizione corretta di SQL Database

Queste informazioni potrebbero cambiare nel tempo.

http://bit.do/azure-sql-pricing

RavenHQ è un database documentale (RavenDB SaaS).

MongoDB è un database documentale (JSON).

Cassandra è un database per grandi quantità di dati con una eccellente replica.

HBase è un database Big Data (Hadoop) disponibile in HDInsight.

Macchine Virtuali con Oracle sono supportate in Azure.

MySQL è offerto com SaaS dal partner ClearDB.

Ulteriori Database in Azure

Azure Search

Azure Search

Incorpora una sofisticata esperienza di ricerca in applicazioni web e mobile, senza doversi preoccupare delle complessità di ricerca full-text e senza dover installare, mantenere o gestire qualsiasi infrastruttura.

Azure Search

Ideale per gli sviluppatori cloud enterprise, produttori di software sul cloud, architetti che necessitano di una soluzione di ricerca completamente gestita.

API HTTP/JSON per la creazione di indici, aggounta di documenti e ricercaParole chiave di ricerca con operatori user-friendly (+, -, *, “”, etc.)Evidenza dei risultatiFaceting (istogrammi su range di dati, tipicamente utilizzati nella navigazione di cataloghi)

Funzionalità di ricerca

Suggerimenti (auto-completamento)Query strutturate e complesse (filter, select, sort) combinate con la ricercaProfili con punteggio per modellare la rilevanza dei risultati di ricercaSupporto geo-spaziale integrato nei filtri, nel sort e nel ranking

Funzionalità di Ricerca

SQL Database SQL on IaaS DocumentDB

Search HDInsight

MongoDB, MySQL, Oracle,

Cassandra, Neo4j e altri

Microsoft Azure Data Platform

Highlights

Pick the right storage tool for the job

Azure can do most of it (or you can host in a VM)

RDBMS vs. NoSQL

Feedback & Q&A

http://aka.ms/evalazurebcamp

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Recommended