You are on page 1of 47

LECTURE 4

AZURE COMPUTE
FSOFT SOLUTION BOARD
January 8, 2014

PAAS

CLOUD
PROVIDER

DEVELOPER

1. Dev writes program using


3. Cloud get resource from pool
cloud tools & libraries
and assign to program
On demand self service
2. Dev uploads program to
cloud and ask for resources
Resource
Rapid
Broad network
pooling
elasticity
access
RESOURCE

PROGRAM
Measured service
4. Program (hosted in cloud)
use resources

Copyright 2011 FPT Software

DEFINITION

Microsoft Windows Azure Platform is a


cloud computing platform used to
build, host and scale web applications
through Microsoft data centers.
Azure is classified as platform as a
service (PaaS).
Copyright 2011 FPT Software

MAIN COMPONENTS:
CURRENT VERSION

Copyright 2011 FPT Software

HOW AZURE WORKS


You only have to
manage your
application and
data

Windows Azure
Datacenter
Fabric

Hypervisor

Hardware

Microsoft
manages every
underlying detail
for you
Copyright 2011 FPT Software

THIS LECTURE
Web Sites vs Cloud Services vs Virtual
Machines
How an Azure application works
Azure Roles and Instances
Service Definition and Configuration Files
Azure Compute Emulator
Compute Libraries and Classes
Copyright 2011 FPT Software

EXECUTION MODELS (COMPUTE):


HOST & RUN YOUR APPLICATION

Copyright 2011 FPT Software

PUTTING THINGS IN PERSPECTIVE

Copyright 2011 FPT Software

You manage

IAAS vs PAAS vs SAAS

IaaS

PaaS

SaaS

Application

Application

Application

Application

Data

Data

Data

Data

Runtime

Runtime

Runtime

Runtime

Middleware

Middleware

Middleware

Middleware

OS

OS

OS

OS

Virtualization

Virtualization

Virtualization

Virtualization

Server

Server

Server

Server

Storage

Storage

Storage

Storage

Networking

Networking

Networking

Networking

Copyright 2011 FPT Software

Provider manage

Normal
Software

VIRTUAL MACHINE
IaaS in Azure, based on IIS
Developer register for a virtual machine and prepare
the underlying OS and applications: OS disk and Data
disk
Can use template virtual hard disk (vhd) in gallery or
upload own vhd
Persistent storage: Store and backup vhd image in
Azure Blob Storage
Support both Linux and Windows
Copyright 2011 FPT Software

10

VIRTUAL MACHINE

Copyright 2011 FPT Software

11

VIRTUAL MACHINE
CONNECTIVITY
Can join Virtual Network
Can use Azure Connect
Can open up endpoints to connect with other
roles and applications
Can use Remote Desktop Connection

Copyright 2011 FPT Software

12

WEB SITES
A cloud hosting service for Web Sites (SaaS)
Allow creation and deployment of Web Sites
in seconds
Support ASP, ASP.NET, PHP, Node.js
Support opensource like Joomla, Wordpress,
Drupal, DotNetNuke
Support shared and reserved instance
Dashboard and management tools
Copyright 2011 FPT Software

13

WEB SITES

Copyright 2011 FPT Software

14

COMPARISON

Copyright 2011 FPT Software

15

OUR MAIN FOCUS:


CLOUD SERVICES
Previously Azure Compute
Pure Platform as a Service
Best for building scalable web applications

Copyright 2011 FPT Software

16

AN AZURE APPLICATION

AZURE
DEVELOPER

WINDOWS
AZURE

1. Dev writes Azure program


using Azure tools & libraries
On demand self service
2. Dev uploads program to
Azure as a package with
definition files and config files

3. Azure read definition and


config files, then get resource
from pool, create VM
instances, copy code to VMs,
then run and monitor VMs
Resource
Rapid
pooling
elasticity

Broad network access


AZURE
PROGRAM

RESOURCE
Measured service
4. Program (hosted in Azure)
runs and uses further Azure
resources from pool

Copyright 2011 FPT Software

17

AN AZURE APPLICATION
High availability: Your application run as much
as possible (with the resources you have) and
respond to request
Scalability: You can easily and dynamically
change the number of VMs
Manageability: Azure manages the
infrastructure and platform for you and give
you tools and libraries to monitor your
applications
Copyright 2011 FPT Software

18

ROLE AND INSTANCE


An Azure application can be designed as a
combination of one or many components
together
As the application is uploaded to Azure, each
component is run in one specific role
A role can be considered a job
For each roles there are many instances. An
instance is a virtual machine that runs a single
job.
Copyright 2011 FPT Software

19

ROLE AND INSTANCE


The role is the scalability unit
The role is a conceptual container for Azure
Compute resource
With each role there is the component code
and resource configuration file.
Instances of a roles are virtual machines with
the roles configuration and the component
.dll installed.
Copyright 2011 FPT Software

20

AN ANALOGY
Azure: The Coach
A role: Forward, Midfielder, Goalkeeper
Two type of roles: Web (attacking) and Worker
(defending)
Resource of role: Dribbling, shooting,
Your application: The match

Copyright 2011 FPT Software

21

ROLE AND INSTANCE


The code for each role will execute in a role
instance
A role can have one or many instances
A role is like a special class, and an instance
is like an object for that class.
Each instance is a virtual server running the
Guest-OS (compatible with Windows Server
2008)
Copyright 2011 FPT Software

22

ROLE AND INSTANCE

Copyright 2011 FPT Software

23

ROLE AND INSTANCE


Inside, every instance is the same
Each instance runs an identical version of the apps code
For each request to the role (through input endpoints)
Windows Azure automatically load-balances between the
instances
The developer only specifies what and how many
instance he needs
Windows Azure creates the instances and put your
applications in them.
Windows Azure monitors your application and manage
the instances in case of failure
Copyright 2011 FPT Software

24

AZURE ROLES

Copyright 2011 FPT Software

25

AZURE ROLES:
WEB ROLES
Underlying Guest-OS has IIS 7.0 installed and
customized
Web Roles run in IIS
Azure automatically deploys your Web Roles
to the IIS. You dont work with the OS
Suitable for web-based frontend
Unsuitable for running background processes

Copyright 2011 FPT Software

26

AZURE ROLES:
WORKER ROLES
Underlying Guest-OS has IIS disabled
Worker Roles doesnt accept inbound
connections by default
Azure automatically deploys your Worker
Roles in a Windows Azure process
Useful for general development
Often served as background processing for a
Web Role
Copyright 2011 FPT Software

27

AZURE ROLES:
HOW TO USE WEB & WORKER

Web Role runs Websites


Worker Role runs Tasks
Copyright 2011 FPT Software

28

AZURE ROLES:
CONFIGURATION
Virtual
Machine
Size

CPU
Cores

ExtraSmall

Shared 768 MB

19,480 MB (6,144 MB is reserved 20 GB


for system files)

Small

1.75 GB

229,400 MB (6,144 MB is
reserved for system files)

165 GB

100

Medium

3.5 GB

500,760 MB (6,144 MB is
reserved for system files)

340 GB

200

Large

7 GB

1,023,000 MB (6,144 MB is
reserved for system files)

850 GB

400

ExtraLarge

14 GB

2,087,960 MB (6,144 MB is
reserved for system files)

1890 GB

800

Memory

Disk Space for Local Storage


Resources in Web and Worker
Roles

Disk Space Allocated


for LSR in Bandwidth
a VM Role (Mbps)

Copyright 2011 FPT Software

29

WHAT REALLY HAPPENED

Copyright 2011 FPT Software

30

AZURE ROLES:
CONFIGURATION
How to request a specific VM Size: Azure
configuration file
Include as a part of the deployment package
Can change the number of instances without
stopping the application
Can change the VM size of a role without
rebuilding the application

Copyright 2011 FPT Software

31

AZURE ROLE:
FILES
The Website that runs in the web
role WebRoleOne
Specific code to manage the web
role lifecycle, inherits
RoleEntryPoint Class
Setting for the web role
Configuration file for the whole
Azure deployment (has Cloud
and Local version)
Definition file for the whole
Azure deployment
Copyright 2011 FPT Software

32

AZURE DEFINITION FILE


Default Filename: ServiceDefinition.csdef
Use XML Schema
The service definition file describes the service
model. It defines the roles included with the
service and their endpoints, and declares
configuration settings for each role.

Copyright 2011 FPT Software

33

AZURE DEFINITION FILE:


EXAMPLE

<?xml version="1.0" encoding="utf-8"?>


<ServiceDefinition name="WindowsAzureProject1"
xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
<WebRole name="WebRoleOne" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
</ServiceDefinition>

Copyright 2011 FPT Software

34

AZURE CONFIGURATION FILE


Default Filename:
ServiceConfiguration.Cloud.cscfg for the Cloud
version or ServiceConfiguration.Local.cscfg for
the emulator
Use XML Schema
The service configuration file specifies the
number of instances to deploy for each role
and provides values for any configuration
settings declared in the service definition file.
Copyright 2011 FPT Software

35

AZURE CONFIGURATION FILE:


EXAMPLE

<?xml version="1.0" encoding="utf-8"?>


<ServiceConfiguration serviceName="WindowsAzureProject1"
xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/Se
rviceConfiguration" osFamily="1" osVersion="*">
<Role name="WebRoleOne">
<Instances count="1" />
<ConfigurationSettings>
<Setting
name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionSt
ring" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>

Copyright 2011 FPT Software

36

NOTICE
Managing your Azure applications will mainly
require tweaking the definition and
configuration files.

Copyright 2011 FPT Software

37

WEBROLE.CS
The WebRole.cs file is automatically generated
when you create a Cloud Service Project and
add in one of the Web Role variants;
However, if you associate an existing ASP.NET
application as a web role the additional file
isnt generated for you
Extends the RoleEntryPoint class, a part of the
Azure service runtime used to start, run, and
stop your roles in the cloud
Copyright 2011 FPT Software

38

WEBROLE.CS

namespace WebRole1
{
public class WebRole : RoleEntryPoint
{
public override bool OnStart()
{
return base.OnStart();
}
}
}

Copyright 2011 FPT Software

39

WORKERROLE.CS
The WorkerRole.cs file is automatically
generated when you create a Cloud Service
Project and add in one of the Web Role
variants
A Worker Role requires the WorkerRole.cs file
to run
Extends the RoleEntryPoint class, a part of the
Azure service runtime used to start, run, and
stop your roles in the cloud
Copyright 2011 FPT Software

40

WORKERROLE.CS

namespace WorkerRole1
{
public class WorkerRole : RoleEntryPoint
{
public override void Run()
{
Trace.WriteLine("$projectname$ entry point called", "Information");
while (true)
{
Thread.Sleep(10000);
Trace.WriteLine("Working", "Information");
}
}
public override bool OnStart()
{
ServicePointManager.DefaultConnectionLimit = 12;
return base.OnStart();
}
}
}

Copyright 2011 FPT Software

41

ROLEENTRYPOINT CLASS
Library: Microsoft.WindowsAzure.ServiceRuntime
Worker roles must extend the RoleEntryPoint class
to add functionality to the role instances.
Web roles can optionally extend
the RoleEntryPoint class, or can use the ASP.NET
lifecycle management methods to handle the start
and stop sequences.
For a VM role, Windows Services (provided in the
adapter) are used instead of the RoleEntryPoint class
Copyright 2011 FPT Software

42

ROLEENTRYPOINT CLASS
Methods:
OnStart: Runs code that initializes a role instance
OnStop: Runs code when a role instance is to be
stopped
Run: Runs code that is intended to be run for the life
of the role instance.

Copyright 2011 FPT Software

43

AZURE COMPUTE EMULATOR


A component in the SDK
Used to emulate the Azure environment in the
local machine
You can build and test Azure applications
locally using the Compute Emulator before
deploying them to Azure
The performance should be widely different
when deploying to Azure
Copyright 2011 FPT Software

44

COMPUTE EMULATOR
VS REAL AZURE
COMPUTE EMULATOR

REAL WINDOWS AZURE

Role instance has access to the GAC (Global


Assembly Cache), the registry, the machine
configuration files and other local system
components

No Access

Logging is written to the output Emulator


Windows as well as captured by Azure
Diagnostics

Logging can be transferred using Azure


Diagnostics API to an Azure Storage Table

Role instances run with Administrator privileges Role instances run as standard User Account
Does not fully support load balancer

Support load balancer and Azure

Limit to 50 role instances

No limit

Use IIS Express

Use IIS 7

Use SQL Server Express

Use SQL Azure

Can use Remote Desktop Connection

Can not

All roles run on one computer

Different roles run on different computers


Copyright 2011 FPT Software

45

AZURE COMPUTE EMULATOR

Copyright 2011 FPT Software

46

SUMMARY
Web Sites vs Cloud Services vs Virtual
Machines
How an Azure application works
Azure Roles and Instances
Service Definition and Configuration Files
Azure Compute Emulator
Compute Libraries and Classes
Copyright 2011 FPT Software

47

You might also like