提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人...

66
提提提提提提提提提 提提提提提提提提提 Improving Performance and Improving Performance and Scalability Scalability Microsoft .NET 技技技技 技技技

Transcript of 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人...

Page 1: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

提昇應用程式的效能提昇應用程式的效能Improving Performance and ScalabilityImproving Performance and Scalability

Microsoft .NET 技術代言人林耀珍

Page 2: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 2

林耀珍林耀珍

經歷第三波資訊 技術總監育碁數位科技 總經理

專業認證與專長微軟 .NET 技術軟體開發流程,資訊系統規劃Microsoft MCSD/MCSE/MCDBA

物件導向技術, Rational OOAD 認證講師Lotus Notes principle CLP/CLI

J2EE

Page 3: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 3

目標與對象目標與對象

對象技術平台的決策人員軟體建構師系統分析師專案經理應用程式開發人員

目標開發高效能的應用程式

Page 4: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 4

AgendaAgenda

Overview

Framework for improving Performance

Performance Modeling

Testing Process

Design Guidelines

Improving ASP.NET Performance

Page 5: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 5

Performance Categories Performance Categories

Speed Does the application respond quickly enough for the intended users?

Scalability Will the application handle the expected user load and beyond?

Stability Is the application stable under expected and unexpected user loads?

Page 6: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 6

Tough ChallengesTough Challenges

Simple -> High PerformanceMonolithic program runs on a huge machine

Life is not so simpleMore demandsSecurity issuesInternet makes things more complexScalable to support more users

Less resources / time / manpower to do these works

Architectures & Components & Designs are used to increase developers’ productivities, but add challenges for us to build high performance system.

Page 7: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 7

Common Pitfall - Optimize LaterCommon Pitfall - Optimize Later

Performance is typically ignored until there is a problem. There are several problems with this approach:

Performance problems are often introduced early in the design

Design issues can’t always be fixed through tuning or more efficient coding

Fixing an architecture or design issue later in the cycle is inefficient and often very expensive.

Page 8: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 8

Common Pitfall - Common Pitfall - Make it perfect earlyMake it perfect early

Developers work on optimizing everything up front. This results in:

“Gold Plated” code

Highly optimized code that is rarely executed

Missed schedules

Page 9: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 9

Need a better wayNeed a better way

Defining performance targets

Measuring performance

Troubleshooting performance problems80/20 Rule: 80% of performance problems are caused by 20% of the issues

Tune system

Regularly monitor performance trends

Architecting systems that have the right balance of security, performance, manageability and scalability

Page 10: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 10

Framework for improving Framework for improving PerformancePerformance

Page 11: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 11

#1 Principle#1 Principle

Hardware Tuning

Product Tuning

Code Tuning

Design

Requirements

Greater Impact

Less

Impac

t

Page 12: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 12

Plan & Design with Perf & ScalePlan & Design with Perf & Scale

Common issues

Page 13: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 13

Development LifecycleDevelopment Lifecycle

Page 14: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 14

Measure, don’t PredictMeasure, don’t Predict

Get Familiar with Metrics

Set SMART Goals"run fast" vs. 25 transactions per second

“load quickly“ vs. "3 second response time"

Get Familiar with Test types

Get Familiar with Tools

Metric Definition Measured By Impacts

Throughput How Many? # Request/Sec App / Server

Response Time How Fast? TTFB or TTLB Customer Sat

Resource Util. How Much? % of resource Upgrade/Add

Page 15: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 15

Tune IterativelyTune Iteratively

Test, Collect, Analyze and Fix

Collecting

Testing

Analyzing

Fixing

Pre-Requisites

Page 16: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 16

Equip with Tools & Skills

Custom-Made Testing program

Microsoft Application Center Test

Professional Performance & Scalability Tools

System Monitor: Counters; Understand thresholds

CLRProfiler: Allocations; Survivors; Leaking

WINDBG: Dumps; Hangs, Crashes, Blocks, Memory, etc

VADUMP: Working set; Memory, etc

NETMON: Data on Wire; Bandwidth and Latency

… And Good Team Members

Page 17: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 17

Framework Framework

Page 18: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 18

Performance Modeling Approach Performance Modeling Approach

Structured approach to modeling the performance of your application

Goal: Focus efforts where they matter the most

Benefits:Performance becomes part of your design

Evaluate trade-offs before you build the solution

Avoid performance surprises in production

Document itemized scenarios

what to test

where to instrument

Page 19: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 19

Performance ModelingPerformance Modeling

Two parts of Performance model

An information structure Performance objectives

Budgets

Workloads

Itemized scenarios with goals

Test cases with goals

A process

Page 20: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 20

Information Category in the Information Category in the performance model performance model

Application DescriptionScenariosPerformance ObjectivesBudgetsMeasurementsWorkload GoalsBaseline HardwareQuality of Service Requirements

security, maintainability, and interoperability

Workload RequirementsTotal # of users, concurrent users, data volumes, expected usages

Page 21: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 21

Performance Modeling ProcessPerformance Modeling Process

1. Identify Use Cases

2. Identify workload

3. Identify Performance Objectives

4. Identify Budget

5. Identify Steps of User Activities

6. Allocate Budget

7. Evaluate

8. Validate

Page 22: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 22

1. Identify Use Cases1. Identify Use Cases

Critical use casesUse cases with performance expectations or requirements, such as service level agreements

Submit an order

Process a message

Significant use casesUse cases that represent the majority of interaction or activity

Search for products

Browse catalog

Page 23: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 23

2. Identify workload2. Identify workload

Total users

Concurrently active users

Data volumes

Transaction volumes and transaction mix

Ex:

100 concurrent users browsing

10 concurrent users placing orders

Page 24: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 24

3. Identify Performance Objectives3. Identify Performance Objectives

Response timeTime to first byte no longer than 3 seconds, time to last byte no longer than 7 seconds

Throughput 10 million read requests/sec

10K write requests/sec

100 transactions per second

Resource utilization 80% CPU

T1 Network

Page 25: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 25

Speed Requirements Speed Requirements

normal pages — typical to fast reports — under a minute exception activities (list) — fast to very fast query execution — under 30 seconds nightly backup batch process — under an hour

Activity type Requirement Goal

Normal pages 5 sec 3 sec

Reports 60 sec 30 sec

Exception activities (listed elsewhere) 3 sec 2 sec

Query execution 30 sec 15 sec

Nightly backup 1 hour 45 min

Page 26: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 26

Scalability Requirements Scalability Requirements

peak expected hourly usage — 500 users

peak expected sustained usage — 300 users

maximum percentage of users expected to execute reports in any one hour — 75%

maximum percentage of users expected to execute queries in any one hour — 75%

maximum number of rows to be replicated during nightly backup — 150,000

Page 27: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 27

4. Identify Budget 4. Identify Budget

Cost (manpower, tool, time, …)

Execution time

Resource utilization – how much you can use

Network: Bandwidth.

Hardware: Servers, memory, CPUs … etc.

Resource dependencies: Number of available database connections, Web service connections, … etc.

Page 28: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 28

5. Identify Steps of User Activities5. Identify Steps of User Activities

Users have different activities and steps.

Steps of User Activity1. Order submitted by client

2. Client authentication token is validated

3. Order input is validated

4. Business rules validate order

5. Order is sent to database server

6. Order is processed

7. Response is sent to the client

Page 29: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 29

6. Allocate Budget 6. Allocate Budget

Assigning Execution Time

Assigning Resources

Page 30: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 30

7. Evaluate7. Evaluate

Does the budget meet the objectives? Is the budget realistic? Does the model identify a resource hotspot?Are there more efficient alternatives? Can the design or features be reduced or modified to meet the objectives? Can you improve efficiency in terms of resource consumption or time? Would an alternative pattern, design, or deployment topology provide a better solution? What are you trading off?

productivity, scalability, maintainability or security

Page 31: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 31

8. Validate 8. Validate

Continue to create prototypes and measure the performance of the use cases by capturing metrics.

Page 32: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 32

Testing Process Testing Process

Page 33: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 33

Load Testing Process Load Testing Process

1. Identify key scenarios

2. Identify workload

3. Identify metrics

4. Create test cases

5. Process test

6. Analyze the results

7. Report

Page 34: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 34

Identify Key Scenarios Identify Key Scenarios

Log on to the application.

Browse a product catalog.

Search for a specific product.

Add items to the shopping cart.

Validate credit card details and place an order.

Page 35: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 35

Identify Workload Identify Workload

Numbers of usersThe total number of concurrent users accessing the application in a given time frame

Rate of requests

Patterns of requests

Page 36: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 36

Identify Metrics Identify Metrics

Network specific metrics

System related metrics

Platform specific metrics

Application specific metrics

Service level metrics

System Metric Accepted level

% CPU Usage Must not exceed 60%

Requests / second 100 or more

Response time < 2 seconds

Service Level Metric

Value

Orders per second 70

Unique browses per second

130

Page 37: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 37

Create Test Cases Create Test Cases

Sample E-Commerce Application Expected Results under the load profile below

Throughput: 100 Requests/secRequests Executing: 45 Requests executingResponse Time: 2.5 sec Response time Resource utilization thresholds:Processor\% Processor Time: 75 %Memory\ Available MBytes: 25 % of total physical RAM

User scenarios Percentage of users Users

Browse 50 250

Search 30 150

Place order 20 100

Total 100 500

Page 38: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 38

Process testProcess test

Create scriptsModify Scripts or configure scripts

User delaysUser patterns: different pathsGroups of users: customer, sales, adminsDistribution of Activities: ex. start timeAbandon ratio

Avoid script failuresDataNavigationData CorrelationSecurity issues: Authorization/Authentication

Load DataRun the tests and Collect Data

Page 39: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 39

Analyze the Results Analyze the Results

Analyze the captured data and compare the results against the metric's accepted level. The data you collect helps you analyze your application with respect to your application's performance objectives:

Throughput vs. user load.

Response time vs. user load.

Resource utilization vs. user load.

Page 40: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 40

AnalysisAnalysis

Potential Bottlenecks Throughput Vs User load

0

50

100

150

200

250

300

350

0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600

Number of Simultaneous Users

Th

rou

gh

pu

t (R

eq

uests

/Sec)

Throughput Peak

SLA Failure

Response Time Vs User load

0

500

1000

1500

2000

2500

0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600

Number of Simultaneous Users

Res

po

nse

Tim

e (m

S)

Service Level Violation

% Processor Time Vs User load

0

20

40

60

80

100

120

0 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600

Number of Simultaneous Users

Pro

cess

or

Tim

e(%

)

Your threshold limit

Page 41: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 41

Analyze ResultsAnalyze Results

Proper design and execution of tests as well as proper measurement of system and/or component activities make the analysis easier

Page 42: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 42

Investigate root causesInvestigate root causes

Multiple Performance Index

Page 43: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 43

ReportingReporting

Hardware Details Software detailsConfiguration DetailsWorkload Profile Performance ObjectivesMetrics

System MetricsWeb Server MetricsSQL Server Metrics

Analysis

Page 44: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 44

Load TrendLoad Trend

Good for high level presentation

Page 45: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 45

Design Guidelines Design Guidelines

Page 46: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 46

Improve Components PerformanceImprove Components Performance

Managed CodeData Access ComponentASP.NETWeb Services.NET Remoting ComponentEnterprise Services ComponentInterop Component

Page 47: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 47

Common CategoriesCommon Categories

Data Structures and Algorithms

Communication

Concurrency

Resource Management

Coupling and Cohesion

Caching

State Management

Security

Deployment

Page 48: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 48

Design PrinciplesDesign Principles

Design coarse-grained services Minimize roundtrips and batch work Acquire late and release earlyEvaluate affinity with processing resources Put the processing closer to the resourcesPool shared resources Avoid unnecessary work Reduce contention Use smart recalculation Concurrently process independent tasks

Page 49: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 49

Improving ASP.NET PerformanceImproving ASP.NET Performance

Architecture

Page 50: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 50

Performance and Scalability Performance and Scalability Issues Issues

Resource affinity Failure to share expensive resources Blocking operations Misusing threadsMaking late bound callsMisusing COM Interop Large pages Improper data caching Failure to use output caching properly Inefficient rendering

Page 51: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 51

Design GuidelinesDesign Guidelines

Partition your application logicallysecurityReduce roundtripsAvoid blocking on long-running taskscachingExceptionsResource ManagementDeployment Considerations----------------------------------------------------------------Pages GuidelinesServer Controls GuidelinesData BindingState ManagementData Access

Page 52: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 52

SecuritySecurity

Constrain unwanted Web server trafficTurn off authentication for anonymous accessValidate user input on the clientAvoid per-request impersonationAvoid caching sensitive dataSegregate secure and non-secure contentOnly use SSL for pages that require itUse absolute URLs for navigation between HTTP & HTTPS pagesConsider using SSL hardware to offload SSL processingTune SSL timeout to avoid SSL session expiration

Page 53: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 53

Reduce RoundtripsReduce Roundtrips

HttpResponse.ClientIsConnectedConsider using this to check if the client is still connected before processing a request and performing expensive server side operations

Output caching

Output buffering – not for a slow comm.

use Server.Transfer instead of Response.Redirect.

Page 54: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 54

Avoid Blocking on Long-Running Avoid Blocking on Long-Running Tasks Tasks

Use asynchronous calls to invoke Web services or remote objects

Consider using the OneWay attribute on Web methods or remote object methods if you do not need a response

Queue work and poll for completion from the client

Page 55: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 55

CachingCaching

Separate dynamic data from static data in your pagesConfigure the memory limitCache the right dataRefresh your cache appropriatelyCache the appropriate form of dataUse output caching to cache relatively static pagesChoose the right cache locationUse VaryBy attributes for selective cachingUse kernel caching on Windows Server 2003

Page 56: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 56

ExceptionException

Implement a Global.asax error handler

Monitor application exceptions

Use Try/Finally on disposible Resources

Write code that avoids exceptions

Set timeouts aggressively

Page 57: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 57

Resource ManagementResource Management

Pool resources

Explicitly Close/Dispose resources you open

Do not cache or block on pooled resources

Know your application allocation pattern

Obtain resources late and release them early

Avoid per-request impersonation

Page 58: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 58

Pages GuidelinesPages Guidelines

Trim your page sizeEnable bufferingUse Page.IsPostBack to minimize redundant processingPartition page content to improve caching efficiency and reduce renderingEnsure pages are batch compiledEnsure debug is set to falseOptimize expensive loopsConsider using Server.Transfer instead of Response.RedirectUse client side validationAvoid calling Server.MapPath on a per-request basis

Page 59: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 59

Server Controls GuidelinesServer Controls Guidelines

Identify your server control's use of view state

Use server controls where appropriate

Avoid creating deep hierarchies of controls

Page 60: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 60

Data BindingData Binding

Avoid using Page.DataBindWhen you call DataBind, this invokes the page level method that in turn calls the DataBind method of every control on the page that supports data binding. Rather than calling the page level DataBind, call DataBind on specific controls.

Minimize calls to DataBinder.EvalDataBinder.Eval uses reflection to evaluate the arguments passed in and return the results. If you have a table that has 100 rows and 10 columns, you end up calling DataBinder.Eval 1000 times if you used DataBinder.Eval on each column

Page 61: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 61

State ManagementState Management

Do not maintain complex types between requests

Store simple state on the client where possible

Consider serialization costs

Page 62: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 62

Data AccessData Access

Data access is typically a focal point for improving performance

Use paging for large Resultsets

Use a DataReader for fast and efficient data binding

Prevent users from requesting too much data

Consider caching data

Page 63: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 63

Deployment ConsiderationsDeployment Considerations

Understand the performance implications of a remote middle tierShort-circuit the ASP.NET pipelineConfigure the memory limitDisable tracing and debuggingEnsure content updates do not cause additional assemblies to be loadedAvoid XCOPY under heavy loadConsider pre-compiling pagesConsider Web garden configurationAvoid unnecessary process hopsConsider using HTTP compressionConsider using perimeter caching

Page 64: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 64

ResourcesResources

Improving .NET Application Performance & Scalability In http://www.gotdotnet.com/Community/Workspaces/Directory.aspx

Page 65: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

.NET技術代言人 林耀珍 2004/03/24 65

SummarySummary

Must have a structured approach

Follow principles, practices, and guidelines

To have a good team is the key

Allocate Budget !!!

.NET Architecture

Patterns & Practices

Page 66: 提昇應用程式的效能 Improving Performance and Scalability Microsoft.NET 技術代言人 林耀珍.

Questions…Questions…

Microsoft .NET 技術代言人林耀珍