Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design,...

62

Transcript of Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design,...

Page 1: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.
Page 2: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

DPA307 - Cost Oriented Development

Shy Cohen Alon FliessCEO CTO

Page 3: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Not accounting for the cost implications of your architecture design, and implementation will

result in lower cost-efficiency

Page 4: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

demo

OptimizingResourcesUsageUsing Your Money Wisely

Page 5: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

hardware

software

facilities

power/cooling

IT labor

support

network

security

procurement&

accounting

management tools

disaster recovery

backup

Acquisition cost is 10% of IT Spend

Operating cost is 90% of IT Spend

Source: IDC

Cloud Computing Addressed Many of the

“Hidden Costs”

runtime costs

Emphasizes Others

The Real Cost of Software

storage

maintenance

runtime costs

Page 6: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cloud Challenge

Pay-per-use consumption modelHuge cost savingsTrouble if cost is not managed properly

At development timeWhen deployed in the cloud

Page 7: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Raising to the Challenge

Create a cost-management strategyUnderstand your applicationArchitecting & designing with cost in mindImplementing efficiently

The key to all of the above:

Cost Insight

Page 8: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost and Your Application

Cost is important at every stage of the application lifecycleFor every application type

Requirement Capturing

Architecture & Design

ImplementationTesting

Operations

Page 9: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Orientation Strategy

Understand Plan Solve ReviewRequirement

Capturing

Architecture & Design

ImplementationTesting

Operations

U P S R

U P S R

U P S R

U P S R

U P S R

Page 10: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Oriented Requirements

Functional RequirementsNon-Functional RequirementsConstraints

Huge impact on construction expenses &operational expenses (OpEx)

Page 11: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Oriented RequirementsHaving the right conversations

Cost-analyze the requirements

Discuss implications & alternatives with stakeholdersPay more for user experience?Cheaper alternative experience?Clever solutions?

Review the options you consideredDocument cost implication of each requirement

Or you will return to these discussions again and again

Understand

Plan

Solve

Review

Page 12: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Functional RequirementsPutting a cost on business needs

Understand the cost of business requirementsAre is absolutely required?Can we perform expensive operations on demand?

Plan & solveThe right feature setMitigationsThe right business models

Review & document the cost for each option, and the decision made

Understand

Plan

Solve

Review

Page 13: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Non-Functional Requirements

Engineering: making compromises

Architecture: building product while answering many quality attributes

OpEx Reduction: one of the more

important quality attributesExpense lasts the longest

Might contradict otherimportant qualities

For example: High availability

Requirements

Time

Quality

Business Value

Resources

Page 14: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Non-Functional RequirementsPutting a cost on quality attributes

Understand the cost of the desired qualitiesAvailability, Latency, Robustness

Plan for the optimal way to achieve themConsider the tradeoffs

Implement right architecture & mitigations

Document the cost for each architectural option

Understand

Plan

Solve

Review

Page 15: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Non-Functional RequirementsCost-oriented tradeoffs on quality attributes

Cost vs. LatencySpeed of processing requests as a factor of the cost of instances

Quality vs. PerformanceImage quality as a factor of the cost to generate and transmit

Data Size vs. Data AccessibilityNormalized vs. DenormalizedCompression vs. SearchabilityRelational vs. No-SQL

Etc.

Page 16: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Oriented Constraints

Constraints come from many placesCompetitiveRegulatoryBusinessBudgetEtc.

They can effect cost drasticallyCompute example: Need to encrypt information at restStorage example: Need to keep users’ data for 7 yearsNetworking example: Data must reside in a certain geography

Page 17: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

ConstraintsPutting a cost on things you can’t avoid

Understand the cost of each constraint

Plan for the optimal way to address constraintsDevise a solution to each constraint

This is a good time to assess fiscal feasibility!

Document the cost for each of the constraints, and the decisions made

Understand

Plan

Solve

Review

Page 18: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Orientation: Focusing on Value

Not just about lowering costCost limits are ConstraintsConstraints can be negotiated / managed

Mainly about maximizing your investmentMaximizing value is a Quality Attribute

Page 19: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Requirements & CostKey takeaways

Understand the cost ofFunctional RequirementsNon-Functional RequirementsConstrains

Consider tradeoffs and plan mitigations

Make cost-impact an integral part of project documents

Page 20: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Requirement Capturing

Architecture & Design

ImplementationTesting

Operations

Page 21: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Understanding Your ApplicationYour application’s component utilization characteristics

Page 22: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Understanding Your ApplicationComputational requirements

Is your Application CPU bound?Does it have constant load?Does the load change or fluctuate over time?Can you benefit from throttling? Elasticity?

Instance Size CPU Memory Instance Storage I/O Perf Cost per Hour | Month

Extra Small 1 GHz 768 MB 20 GB Low (5 Mbps) $0.05 | $36

Small 1.6 GHz 1.75 GB 225 GB Moderate (100 Mbps) $0.12 | $86

Medium 2 x 1.6 GHz 3.5 GB 490 GB High (200 Mbps) $0.24 | $173

Large 4 x 1.6 GHz 7 GB 1,000 GB High (400 Mbps) $0.48 | $346

Extra large 8 x 1.6 GHz 14 GB 2,040 GB High (800 Mbps) $0.96 | $691

Page 23: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Understanding Your ApplicationStorage requirements

Estimate the size and type of the storage you needFixed storage sizePer-user storage sizeIs the data really relational?

What is the rate of new data?What types of queries do you need?How long should the data be kept for?How often do you need to retrieve the data?How quickly do you need to retrieve the data when asked for?Would it make sense to save computation by storingpre-processed data?

Storage Type Component Cost

SQL Azure Storage $10 / GB / Month

Windows Azure Storage $0.15 / GB / Month

Transaction $0.01 / 10,000 tx

Page 24: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Understanding Your ApplicationCommunication requirements

Where will your users be located?What are your network traffic patterns?Do you need to connect with existing systems?

Systems of recordConnecting across network boundaries

What’s your expected ingress and egress?Baseline trafficVariable trafficSystem generated trafficUser generated traffic

RegionPrice for 1 GB

In Out

North America andEurope regions

$0.10 $0.15

Asia Pacific Region $0.10 $0.20

Page 25: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Application Cost AnalysisA really simplified example

Our app provides up-to-date Cost Insight & AnalysisCompute Analysis

4 instances (2 front-end, 2 back-end)Application is relatively CPU-light No requirements on instance size

Storage AnalysisProjected data accrual rate is _____ per user per dayData is retained for ____ daysData is not relational we can use Azure Storage

Communication AnalysisWeb: inbound is negligible, est. ___ outbound per user per dayEmail: no inbound, ___ outbound per user per dayMeet communication limits for ___ instance

Throttling StrategyMust scale to sample every account every 5 minutesSoft deadlines on outbound email

Elasticity StrategySoft limit + hard Limit

ConclusionRunning COST will cost a $___ per 1000 clients per month

Page 26: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

COA ConsiderationKnown architecture patterns

Page 27: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Worker Role 2Worker Role 1

Worker Role 4Worker Role 3

Web Role 1

SOA and the Cloud

Services are units of functionality and compositionRoles are units of deployment and scalabilityDon’t mix architecture and deployment strategy

Service A

Service C

Service E

Service B

Service D

Worker Role 2Worker Role 1

Web Role 1

Service A

Service C

Service E

Service B

Service D

- 40%

Page 28: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Worker Role 2

Master

SOA and the CloudRethinking solutions

Sometimes, the “standard” solution is not the best oneExample, dividing work

Worker Role 4Worker Role 3

Worker Role 1

Master

SlaveSlave

Reduction of 2/(n+2)

Master-Slave

Worker Role 2Worker Role 1

PeerPeer

Peer-to-Peer

Worker Role 2Worker Role 1

SlaveMaster +

Slave

Non-Dedicated Master

Page 29: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Compute ResourcesGuidance

Combine servicesMind the cost boundaryOptimize # of instancesCreate a “Compute Pool”Offload work to worker rolesUse queues to manage compute loadsUse statistical information to pre-load instancesOffload work to deployments in different regionsLeverage AppFabric Caching to share calculation results

Page 30: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Architecting Interfaces

Design a service interface that optimizes cost-benefit

Avoid chatty interfacesProvide the right amount of informationDon’t force complex operations in the implementation

Don’t perform unnatural acts

What will be the cost of implementation and maintenance?Is the saving meaningful?

Page 31: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Architecting InterfacesReduce costs

Design a service interface that optimizes cost-benefit

Page 32: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Architecting InterfacesConsider the impact of the frameworks you use

DataSets are easy to use, but they can be wastefulSend the original value when saving a change(As opposed to using a timestamp or an E-tag)

Using Entity Framework can result in unexpected trafficSelf-tracking entitiesLazy loading of referenced objectsEtc.

Page 33: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Saving Cost of Content Generation

Choosing the right order of the tabsLoading tab content when tab is displayed

Order Instances Hours Cost

Used 100% 23% 89%

Order Cost Instances Hours

Used 100% 37% 22%

Before: 2.1 charts/visit

After: 1.6 charts/visit

Page 34: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Resource Optimization

Creating the Correct user Experience

DEMO

Page 35: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

More Ways to SaveAdditional guidance

Avoid computationUse the client CPUUse storage accountUse SQL Azure

Use optimal role sizesDifferent sizes for the different rolesDifferent sizes for the same role at different times

Avoid storage accessUse cookies for client conf

Lower computation costUse storage in tandem with computeUse the CDNDefer content generation until it’s needed

Page 36: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Optimization Techniques

Standard optimization techniquesSpeed of executionMemory usage

Cloud specific code-optimizationOptimal cloud resource usage

Page 37: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Offloading Work to the Client

Generating UI on the Client Side

Demo

Page 38: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Oriented ArchitectureSummary

Use SOA principlesBut don’t conflate architecture with deployment

Create effective interfacesWithout over-complicating their implementation

Determine the actual cost impact of your designMeasure the right things

Page 39: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Requirement Capturing

Architecture & Design

ImplementationTesting

Operations

Page 40: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cost of Your Code

Code: Affected by architecture but independent from it

Page 41: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

.NET Defers Resource Collection

Page 42: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Better Ways to Manage Connection Cost

using(…)Close the connection explicitlyReuse the connection

Factory patternClose when not being used

Cost profiling & optimization is key

Page 43: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Cost Oriented Development

Understanding the Impact of Code

Demo

Page 44: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Thinking Outside The Code

The Cost Of DataThe Cost Of ConnectivityThe Cost Of Security

The Cost Of DevelopmentThe Cost of QAThe Cost Of Bugs

Page 45: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cost of Data

Data SizeWhat’s the required fidelity? (Images, Videos, etc.)Does data compression pay? (CPU vs. Network & Storage)

Data Retention Policy

Page 46: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Storage Services

Data storage optionsTable StorageQueue StorageBLOB Storage (page & block), and Azure DrivesSQL AzureAppFabric CachingThe CDN

Understand storage consumption and pricing modelsSelect the right storage option for your needs

Page 47: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Storage ServicesGuidance

Compute data at the right timeUse the CDN’s dynamic-content-cachingCreate views over large data dynamicallyBatch operations to reduce store transactionsOptimize serialization formats & compressionMake fewer queries (e.g. use CSS Image Sprites)Leverage AppFabric Caching to share calculation resultsReuse SQL Azure database instances during development

Page 48: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

More Ways to SaveAdditional guidance

Protect against "data leaks“Optimize your queue pulling strategyOptimize your SQL Azure data schemaMake sure you are using a “right sized” SQL Azure dbHeed the cost of failed storage requests & poison msgUnderstand the cost using the Azure Client LibraryUnderstand the cost of using Azure DriveDon't blindly cache everything

Page 49: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Storage ServicesThings to avoid

Storing large binary data in SQL AzureAllowing unrestricted upload sizesAllowing unrestricted queries

Page 50: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Connectivity Services

Connectivity requirements have 2 sourcesArchitectureCode

Understand connectivity consumption & pricing modelsIngress and egress costsThe AppFabric Service Bus costsWindows Azure Connect costs

Page 51: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Connectivity ServicesGuidance

Throttle communicationOptimize internet traffic for web rolesMultiplex over service bus connectionsProvide on-premises fan-out for eventsClose connections when you are not using themPut services are in same region as the data they accessUse AppFabric Caching in cross-region comm. Scenarios

Page 52: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Optimizing Connectivity ServicesThings to avoid

Transmitting repetitive dataChatty communication channelsKeeping connections openExcessive cross-region communication

But remember that in some cases it can actually save money!

Page 53: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cost Of Development

Understand the cost of the development processUnit Tests & CIIntegration TestsLoad Tests

How much does a check-in cost?

Page 54: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cost of QA

The cost of testingManual testingLoad testing

The cost of debugging

How much does a full test-pass cost?Is this bug or change request worth the cost of testing it?

Page 55: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

The Cost Of Bugs

LeaksMemorySystem resources (e.g. handles)ConnectionsStorageetc.

Instance crash and recyclingConsuming resources without making progress

Bad handling of poison messages

Page 56: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Operation Is Still Very ImportantRumors of its demise have been greatly exaggerated

Data backupDROP TABLE Customers … Oops!Backup/version of BLOBs via snapshots

Creating cost-effective data retention policies

Monitoring resource consumption on a regular basis

Page 57: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Avoiding the Dangers of Cost Orientation

Shifting cost models can throw you offFocus on the high level modelAvoid over-tuning to a particular price pointEncapsulate highly-optimized areasBe agile

Avoid unnatural acts in the name of cost reductionDon’t create overly complex architectures in the name of costDon’t create un-maintainable code in the name of cost

Follow the general rules regarding architecting for the cloudThey will ultimately lead you down the right path

Page 58: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Not accounting for the cost implications of your architecture design, and implementation will

result in lower cost-efficiency

Page 59: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Summary

Cost Orientation: Maximizing the value of your investmentA Quality Attribute, not a Constraint

CO touches every aspect of the app lifecycleCost Oriented RequirementsCost Oriented Architecture & DesignCost Oriented ImplementationCost Oriented TestingCost Oriented Operations

Integrate CO into every phase of your project!

Page 60: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Complete an evaluation on CommNet and enter to win!

Page 61: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

Scan the Tag to evaluate this session now on myTech•Ed Mobile

Page 62: Shy CohenAlon Fliess CEOCTO Not accounting for the cost implications of your architecture design, and implementation will result in lower cost-efficiency.

© 2011 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.