Download www.ntk.si

Document related concepts

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Team Foundation Server wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Transcript
Seminar Windows Azure
Bootcamp za razvijalce
Rok Bermež, Kompas Xnet
Nivo 300
Agenda
• Part 1
• Introduction
• Windows Azure Roles
• Part 2
• Windows Azure Storage
• Part 3 - bonus
• Sql Azure
• Other services
• Part 4
• Service bus
• Q&A
Nivo 300
Cloud Services
Nivo 300
The Benefits of the Cloud
The Cloud is about cheap, on-demand capacity
Windows Azure
= Managed for
You
Standalon
e
Servers
IaaS
PaaS
SaaS
Applications
Runtimes
Database
Operating System
Virtualization
Server
Storage
Networking
Efficiency
Control+Cost
Nivo 300
IaaS
Developer
1) Choose
image, then
create VM for
DBMS and
configure DBMS
2) Choose
image, then
create and
configure
VM(s) for
application
3) Provision
database,
then create
tables and
add data
4)
Install
applica
tion
5) Configure
load
balancer
6) Manage VMs
and DBMS (e.g.,
deploying new OS
images in VMs)
Library
VM
Images
Data
Application
Load
Balancer
Nivo 300
PaaS
Developer
1) Provision
database,
then create
tables and
add data
Data
2) Deploy
application
Application
Load
Balancer
Nivo 300
Simple Definition?
It’s another place to run your code. Choose between on-premises,
hosting, or the cloud based on your needs.
Nivo 300
Introducing Windows Azure
Developer Experience
Use existing skills and tools.
Compute
Storage
Management
Relational data
Management
Connectivity
Access control
ON-PREMISES
Nivo 300
Windows Azure Platform Data Centers
Nivo 300
Anatomy of a Windows Azure Service
Web
Role
Worker
Role
VM Role
Nivo 300
Storage in Windows Azure
GOAL:
SCALABLE, DURABLE
STORAGE
Windows Azure storage is an
application managed by the
Fabric Controller
Blobs: large,
unstructured
data (audio,
video, etc)
Tables: simply
structured data,
accessed using WCF
Data Services
Queues: serially accessed
messages
or requests, allowing webroles and worker-roles to
interact
Windows Azure applications can use
native storage or SQL Azure
Application state is kept in storage
services, so worker roles can replicate
as needed
Nivo 300
Windows Azure Platform Consumption Prices
Access Control
Service Bus
Per Message Operation
Per Message Operation
$1.99/10k transactions
$3.99/month per connection
Nivo 300
Azure Benefits for VS 2010
MSDN Premium, Ultimate:
Get 8 months of benefits…
…Then extend them another 8
months
$2,518 of cloud
resources
For a quick video on how to sign
up:
http://bit.ly/bqtAzAct1
Nivo 300
Monthly Service Level Agreement
Compute
connectivity
Your service is
connected and
reachable via
web. Internet
facing roles will
have external
connectivity
>99.95%
Instance monitoring
and restart
Storage
availability
Database
availability
Service bus and
access control
availability
All running roles
will
be continuously
monitored
If role is not
running, we will
detect and
initiate
corrective state
Storage service
will be
available/reacha
ble
(connectivity)
Your storage
requests will be
processed
successfully
Database is
connected to
the internet
gateway
All databases
will be
continuously
monitored
Service bus and
access control
endpoints will
have external
connectivity
Message operation
requests processed
successfully
>99.9%
>99.9%
>99.9%
>99.9%
http://www.microsoft.com/windowsazure/sla/
Nivo 300
The Developer Tools
Development Environment
• Vista+
• Must enable local IIS
features
• Visual Studio 2010
• Must run as local Admin
• .NET 3.5 SP1 / .NET 4.0
• Local SQL instance
Azure SDK
• Provides local emulator
• Complete local simulation of
the cloud fabric
• 90% of the local emulator is
the same as the cloud fabric
• Includes handy project
templates
• Deployment and
management tools
• Includes client storage
library
Nivo 300
Basic Roles
Nivo 300
Roles and Instances
• Roles are defined in a Service Model
• May define one or more Roles per Service
• A role definition specifies
• VM size
• Communication Endpoints
• Local storage resources
• Etc…
• At runtime each Role will execute on one or more instances (up to 20
per subscription)
• A role instance is a set of code, configuration, and local data,
deployed in a dedicated VM
Nivo 300
Comparison of Role Types
• Web Role : The role is hosted on IIS
• Worker Role : The role is an executable (you can create your
own web server, host a database, …)
• VM Role : The role is the VM.
• Use Windows services, scheduled tasks, etc.
• You configure and maintain the OS.
Web /
Worker
Role
Admin
Web /
Worker
Role
Abstraction
(i.e. Less IT & Less Plumbing Code)
VM Role
Control
Nivo 300
Compute Service Roles
Web and Worker Role
VM Role
Operating system is provided by
Microsoft
Operating System is provided by
customer
Patches are provided by Microsoft
Patches are provided by customer
Nivo 300
Compute Services Security
Hypervisor and “Sandbox”
R
o
o
t
V
M
G
u
e
s
t
G
u
e
s
t
G
u
e
s
t
G
u
e
s
t
G
u
e
s
t
G
u
e
s
t
G
u
e
s
t
V
M
V
M
V
M
V
M
V
M
V
M
V
M
Hypervisor
1, 2, 4 or 8 CPUs, up to 14GB of
memory
Stripped down, hardened version of
Windows Server 2008
Three virtual hard disks
Limited number of device drivers
Network connectivity restricted
using host firewall
Hyper-V based hypervisor
Network/Disk
• Customer code run on dedicated virtual machines (VMs)
• VMs isolated by a Hyper-V based hypervisor
• All access to network and disk is mediated by a “root” virtual machine
Nivo 300
Fabric Controller
Web Role
Instance
Worker
Role
Instance
VM Role
Instance
•
Interacts with a “Fabric Agent”
on each machine
•
Monitors every VM,
application and instance
•
Performs load balancing,
check pointing and recovery
Nivo 300
What is the web role?
A web role hosts an IIS based web site or service.
• Supports HTTP, HTTPS and certificates
• Automatically load balanced by Azure
• Can be internal only, but usually public facing
• Runs on IIS7
• Usually runs an ASP.NET site.
Nivo 300
Full IIS – Overview
• Web Role will now use full IIS by default
• One Web role can run many Web sites, all hosted behind the same
public IP address
• Multiple sites, applications, virtual directories, and bindings can be
modeled
• Everything else can be scripted (using admin access where necessary)
Nivo 300
Full IIS Scenario - Walkthrough
Phase
Key Steps
Local
Development
•
•
First-time Publish •
(~10 Min)
•
Iterative
Development
(seconds)
•
•
Deployment of
•
Final Version (~10 •
Min)
Use Visual Studio solution to code & deploy to
Compute Emulator
Edit local content files without redeploying to
Compute Emulator
Deploy service to Windows Azure
Ensure Windows Azure service definition (csdef/cscfg) configures Web role:
• To enable remote WMSVC, WebDeploy, PowerShell, etc.
• As single instance
Continue coding in same Visual Studio solution
Push intermittent changes (e.g. w/ Web Deploy)
Deploy service to Windows Azure
Note: If service is now multi-instance, Remote Desktop can be used, but other remote mgmt. tools will get loadbalanced to arbitrary instances.
Mitigation: Run mgmt. tools inside Remote Desktop session
Nivo 300
What is a worker role?
.NET 3.5 sp1 / 4.0
Focused on backend processing
and non-HTTP service hosting
By default, does not allow
inbound connections
Nivo 300
Role Programming Model
• Inherits RoleEntryPoint
• OnStart() Method
• Called by Fabric on startup, allows you to perform
initialization tasks.
• Reports Busy status to load balancer until you return true.
• Run() Method
• Main logic is here – can do anything, typically infinite loop.
Should never exit.
• OnStop() Method
• Called when role is to be shutdown, graceful exit.
• 30 Seconds to tidy up
Nivo 300
Worker Role Patterns
• Queue Polling Worker
• Poll and Pop Messages within while(true) loop
• E.g. Map/Reduce pattern, background image processing
• Listening Worker Role
• Create TcpListener or WCF Service Host
• External Process Worker Role
• OnStart or Run method executes Process.Start()
• Startup Task installs or executes background/foreground
process
• E.g. Run a database server, web server, distributed cache
Nivo 300
What is the VM Role
• Developers have full control over the OS image
• Ability to upload your own customized WS08R2
Enterprise images
• Operators can reboot, re-image and Remote Desktop
• Continue to benefit from automated service
management, including service model enhancements
described on subsequent slides
Nivo 300
VM Role Lifecycle
Base.VHD
& Additional Software
& Windows Azure
Integration Components
- Agent
- Runtime Interface (topo,
config, shutdown notification,
…)
Identical/similar deployment
instances using
common uploaded OS image
(base.VHD + diff.VHD)
Blob
Storage
- Remote Desktop
Boot VHD
configurator
- Diagnostics
- Windows Azure Drives
driver
- Windows Azure Connect
& Generalize
Customize
Save
VHD
Diff.VHD
(Recommended)
On-Premises
Cloud
Nivo 300
VM Role – Common Questions
• Will any WS08 R2-based application work?
• No, VM Role inherits some Web/worker restrictions:
• SLA requires at least two identical/similar instances
• No durability of OS image on hardware failure
• One public IP per service (unless using Windows Azure Virtual
Network)
• Does Windows Azure take care of *everything*?
• No
• With VM Role, the customer creates & maintains the OS
• Windows Azure does not automatically understand the health
of the applications running in our VM
• But, since you deploy services instead of individual
VM’s, Windows Azure does automate many
management tasks.
Nivo 300
VM Role – Common Questions
• How will it be priced?
• It will be priced the same as Web and Worker roles.
Customers will be charged at an hourly rate
depending on the compute instance size.
• How does licensing in the cloud work?
• Windows:
• Included in the CPU-hour price
• Licensing status of uploaded image is not considered
• Applications: Per the licensing terms of the
application
Nivo 300
Instances
• An instance is a physical implementation of your role template.
• There are different sizes of instances, but all instances of a role must
be the same size.
• You can not change instance size on the fly.
Size
CPU Cores
CPU Speed
Memory
Cost Per Hour
Extra Small
Shared
1.0 GHz
768 MB
$0.04
Small
1
1.6 GHz
1.75 GB
$0.12
Medium
2
1.6 GHz
3.5 GB
$0.24
Large
4
1.6 GHz
7 GB
$0.48
Extra Large
8
1.6 GHz
14 GB
$0.96
Nivo 300
Windows Azure
Your
Service
D
N
S
L
B
Web Portal
(API)
Fabric
Controller
L
B
Nivo 300
Service Deployment
Your
Service
Model
Service
D
N
S
L
B
Web Portal
(API)
config
DNS
Fabric
Controller
L
B
Nivo 300
Service Scaling
Your
Service
Service
D
N
S
Service
Service
Service
L
B
Service
Service
Service
Service
Web Portal
(API)
Model
Fabric
Controller
L
B
Nivo 300
Service Monitoring & Recovery
Your
Service
D
N
S
Service
Service
L
B
Service
Service
Web Portal
(API)
Model
Fabric
Controller
L
B
Nivo 300
Local Emulator
The SDK includes a local emulation of the real fabric and fabric controller.
•
•
•
•
Based on 90% of the real fabric code
Uses a local SQL instance to simulate storage
Best way to debug your application
Use the Compute Emulator UI to watch your processes
Nivo 300
SDK Emulator Icon
Nivo 300
Compute Emulator UI
Nivo 300
Storage Emulator UI
Nivo 300
SQL Express?
If you have SQL Express the storage emulator will auto-configure on
the first run
If you want to use a different SQL instance:
DSInit /sqlInstance:.
Nivo 300
Are we running in the fabric?
Nivo 300
Debugging in the cloud?
No. No debug for you.
Nivo 300
Debugging locally
You can debug locally just like a normal ASP.NET application.
Full support for multiple instances.
Nivo 300
Support for IntelliTrace
IntelliTrace now supported in Windows Azure
Integrated into VS2010 Ultimate
Requires .NET 4 applications
Deploys an agent to your instances
Gathers and reports all debugging stack information
Can replay the app locally
Nivo 300
Support for Profiling
Easily detect performance bottlenecks in your application while its
running in Windows Azure.
Profiling report is retrieved
from Windows Azure
Open shortcut menu
for instance to profile
After report is downloaded,
it is displayed
Choose “View
Profiling Report”
Nivo 300
Looking at configuration.
Configuration is handled by two files.
ServiceDefinition.csdef
ServiceConfiguration.cscfg
Nivo 300
Service Definition
Nivo 300
Service Configuration
Nivo 300
GUI
Double click on Role Name in Azure Project
Nivo 300
Settings
Nivo 300
Endpoints
Nivo 300
Certificates
Nivo 300
Hello Cloud
Nivo 300
Three Choices to Deploy Code
Visual Studio
Portal
Script/Management API
Nivo 300
Deploying to the cloud
• You must create an Azure account, then a service, and then you
deploy your code.
• VS builds two files.
• Encrypted package of your code
• Your config file
• Can take 20 minutes
• (which is better than six months)
• In a dev scenario, you can use Web Deploy
Nivo 300
Portal
Nivo 300
Visual Studio Publishing
• Fast publishing direct from Visual Studio
• Uses .publishsettings file (like Web Matrix)
• Wizard uses Windows Live ID credentials to download file
• Auto-generation of X509 certificate
• Base64 encoded certificate in .publishsettings
• Subscription ID and name of each subscription linked to that
Windows Live ID.
• Publishing will add new X509 certificate and your package to
Windows Azure.
Nivo 300
Visual Studio Publishing
Nivo 300
Deploying to the cloud
Nivo 300
DNS
• All services get a *.cloudapp.net address
• myservicename.cloudapp.net
• TTL is 10 seconds
• Standard approach is to CNAME to *.cloudapp.net
• Requires two DNS lookups
• Limited caching due to low TTL
• Officially we do not support the use of A records
• IP Address for deployment is fixed for lifetime of that slot
Nivo 300
Advanced Roles
-
Nivo 300
Admin Access & Startup Tasks
•
Scenarios
Perform short, unattended setups on role startup. E.g.
COM Component
Registry Key
Configuring a Windows Server Role, such as IIS
Debugging
•
Reminders
•
•
Durability: Runtime state on OS image does not survive OS upgrade and hardware failure
Drift: Service should behave correctly when any role instance fails
Nivo 300
Admin Access & Startup Tasks
<WebRole name="foo">
<Startup>
<Task commandline="relative\path\ToSetupExecutable"
executionContext="limited|elevated"
taskType="simple|foreground|background"/>
</Startup>
</WebRole>
Task Types:
• Simple [Default] – System waits for the task to exit before any
other tasks are launched
• Background – System does not wait for the task to exit
• Foreground – Similar to background, except role is not restarted
until all foreground tasks exit
Nivo 300
Startup tasks
Nivo 300
Local Storage
Each role can define an amount of local storage.
Protected space on the local drive.
Considered volatile storage.
You can define several resources.
Size is between 1MB and 20GB+.
Defined in .csdef.
Nivo 300
Local Resource Configuration
Nivo 300
Using a Local Resource
Nivo 300
Where is Local Storage?
Nivo 300
Local storage
Nivo 300
Input endpoints
Expose a WCF service to the public.
Enrolled in the Azure load balancer.
internal
NOT
Nivo 300
Endpoints Model
Internet
LB
SVC
SVC
SVC
Worker Role 0 Instance 0
Worker Role 0 Instance 1
Worker Role 0 Instance 2
SVC
SVC
SVC
Worker Role 1 Instance 0
Worker Role 1 Instance 1
Worker Role 1 Instance 2
Nivo 300
Configuring an Endpoint
Nivo 300
Using Endpoints
Just like normal WCF
You need to define your address at runtime
Select from the InstanceEndpoints collection
Typical pattern is to loop on all internal endpoints.
Nivo 300
Using an Input Endpoint
Nivo 300
Using an Internal Endpoint
Nivo 300
Calling all Internal Endpoints
Nivo 300
Endpoints
Nivo 300
Windows Azure Connect
Secure network connectivity
between on-premises and
cloud
Windows Azure
Supports standard IP protocols
Example use cases:
Enterprise app migrated to
Windows Azure that requires
access to on-premise SQL Server
Windows Azure app domainjoined to corporate Active
Directory
Remote administration and
trouble-shooting of Windows
Azure Roles
Simple setup and management
Enterprise
Nivo 300
Windows Azure Connect
Nivo 300
VPRAŠANJA?
Po zaključku predavanja, prosimo, izpolnite vprašalnik.
Vprašalniki bodo poslani na vaš e-naslov, dostopni pa bodo tudi
preko profila na spletnem portalu konference www.ntk.si.
Najlepša hvala!
Nivo 300