Cloud Computing with .Net
-
Upload
wesley-faler -
Category
Technology
-
view
243 -
download
2
description
Transcript of Cloud Computing with .Net
Cloud Computing with .NetCloud Computing with .NetCodeMash 2009Wes FalerCodeMash 2009Wes Faler
Cloud ComputingCloud Computing
• Just what is “Cloud Computing”?– Is it difficult to get started with the Cloud?
• Short answers:– Computing resources on demand.
– It’s easier than you think and you likely already know how and just don’t know it.
Example Cloud Architecture?Example Cloud Architecture?
Controller
ClientWorker
Worker
Worker
Client
Typical Cloud Architecture!Typical Cloud Architecture!
Load
Balancer
BrowserWeb
Server
Web
Server
Web
Server
Browser
Congratulations!
It’s a web farm!
Essential
Parts
Of a
Distributed
ApplicationQueue
MasterClient
Workers
Amazon EC2 Sample ApplicationAmazon EC2 Sample Application
• The problem:– Use ZabaSearch.com to search public
records, obtaining alternate addresses for a person.
– They won’t take a data file with thousands of records and do batch processing, but did ok as many searches as we can do using their web site.
– I’m too cheap to pay a hundred people to point and click on a website, and doing it with just one is far too slow.
Amazon EC2 Sample AppAmazon EC2 Sample App
• We know all these technologies.• It’s only the technique we really need to study.
Jobs &Results
Master(Web Service)
-Get Jobs- Report Results-Worker Mgmt
ClientWindows service
calls Master interfacethen uses Core logic
JobBundles
Amazon EC2 Sample AppAmazon EC2 Sample App
• The Solution:– A core module able to POST to ZabaSearch
and scrape data from its HTML.– A database as the queue of names/addresses
to check and to hold the results.– A master web service giving out blocks of
name/address jobs– A worker service getting jobs and using the
core module– A local computer running the worker service– Any number of Amazon EC2 computers
running the worker service
• Tada! It’s Cloud Ready!
Database Schema and Job StatesDatabase Schema and Job States
• Jobs start in “ToDo” status• When a worker requests a bundle,
jobs are set to “InProgress”, get an expiration time, and get flagged with the worker’s GUID.
• Jobs not done by the expiration time are reset back to “ToDo” and their worker ID cleared.
• When workers report results, results are only recorded if the job is still “InProgress” and still assigned to the worker. Such jobs get set to “Done”.
• As a courtesy, workers can report that they are abandoning work, which just sets anything “InProgress” assigned to them back to “ToDo” with a cleared worker ID.
Amazon EC2 Sample AppAmazon EC2 Sample App
Code Demo• ZabaSearch Core• Master Web Service• Client Interface• Client Service Threading
Amazon EC2 Sample AppAmazon EC2 Sample App
Getting It Into The Cloud
• Signup, Keys, Security, Security, Security, and Some More Security.
• Elastifox– Public AMIs– Instances
• Start, Stop, Reboot• Destroy
– Bundles– Private AMIs
Things in a Cloud
All using:
Storage
Security
Management
Virtual
PCs
Process
Flow
DB
Servers
Web
Servers
Cloud HierarchyCloud Hierarchy
Michael Sheehan on Jun 24th, 2008
“The Cloud Pyramid”
In the Cloud, you can…In the Cloud, you can…
• Rent– Web servers– Load balancers– Database servers– Storage space– Logic
• Application• Queue Management/Flow
• Vary– Number of each rented item– Location of each rented item
All Can Be In
A Cloud
Farm
Grid
Shared PC
Cluster
Types of Distributed AppsTypes of Distributed Apps
Virtual PC Farm Cluster Grid Cloud
Cash Up front Up front Up front0 to Mini-Cluster
Pay as you grow
Availability Dedicated Dedicated Dedicated StatisticalOn Demand
Redundancy None Good Good Good Varies
Computing General SpecializedGeneral but Custom
General but Custom
Varies
Low Hanging FruitLow Hanging Fruit
• What could you do with a virtual computer in the cloud?– It’s sharable– You control the configuration– Not just rebootable, reformatted-and-
reinstalled with a click– Discardable– Cheap– No waiting
Low Hanging FruitLow Hanging Fruit
• Install incremental releases onto a cloud virtual PC– Control the demo environment– Fully validate before release– Restore to initial release easily– Archivable– Remove the client’s configuration from
each release’s issue list
Low Hanging FruitLow Hanging Fruit
• Training Applications on cloud virtual PCs– Create one master image and clone on
demand– Trainees only need remote desktop
access– Easily reset for those adventurous
students
Low Hanging FruitLow Hanging Fruit
• A Spare Development PC – Per Developer!– Unit tests, esp. CPU intensive ones– Can start with standard, easily reset, test
data– Installer testing without breaking your
development environment– Ease handoffs to QA dept– Experiment with time-limited trial
libraries without the time limit
Queuing!Queuing!
We finally have to take it seriously.
(My simulation prof would be so happy!)
We finally have to take it seriously.
(My simulation prof would be so happy!)
Latency
Activation
Flow Control
Queuing: LatencyQueuing: Latency
Consider:• 100 requests, each taking 3 seconds on a
high end server when done sequentially.• How long does the 1st request take?
– 3 seconds. Users love us!
• How long does the 100th request take?– 300 seconds. Users hate us. Work every
weekend until this is fixed.
• 300 seconds? Don’t measure just “Performance”, measure “Latency”.
• Which do you test most often?
Queuing: LatencyQueuing: Latency
Consider:• 100 requests, each taking 3+1 seconds on
20 medium virtual servers in a cloud.• How long does the 1st request take?
– 3+1 seconds. Users still love us!
• How long does the 100th request take?– 20 seconds. Is this ok?
• Classical “Performance” dropped, but “Latency” improved drastically. Which actually drives satisfaction more?
Queuing: LatencyQueuing: Latency
Best Case Latency = Time/ItemWorst Case Latency = Time/Item * # of items /
# of serversAverage Latency = Time/Item * (# of items / #
of servers) / 2
Clouds likely raise Time/Item slightly but can raise the number of servers drastically.
Order the number of servers that will meet your latency needs.
Speed up your code! Time/Item still matters.
QueuingQueuing
• Activation– What gets activated when an item moves
within the queue?– Push vs. Pull?
• Flow Control– Are all jobs equal?– Are all processes equal?
• What are users doing while they wait for queued items to finish?
Your life will be easier if you…Your life will be easier if you…
• Separate your core logic from your cloud communications logic
• Put core logic into its own assembly• Objects-In, Objects-Out in your core• Use unit tests for your core• Use an interactive testing tool to debug your core logic
– Remember it’ll be much harder to debug once in the cloud!
• Consider network connectivity problems when coding recovery logic– Balance reassignment with forgiveness
• Design for some local processing
CostsCosts
• Data sent into the cloud, even if your cloud software requested the data.
• Data sent out of the cloud, even if your cloud software sent the data.
• Data sent within the cloud isn’t typically charged for.• Time your machine instances exist – even if “off”.• CPU time actually used.• RAM available.• Time and size of storage, including uninstantiated
machine instances.
• Amazon EC2 costs me about $20/month and would be about $100/month for a 24x7 medium power virtual machine.
• Transfer large lumps, such as databases, once and keep them in the cloud. It’s faster and cheaper.
Cloud ComputingCloud Computing
• Just what is “Cloud Computing”?
• Short answer: Computing resources on demand.
• Real answer: Architecture Freedom!