1 / 66

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

提昇應用程式的效能 Improving Performance and Scalability. Microsoft .NET 技術代言人 林耀珍. 林耀珍. 經歷 第三波資訊 技術總監 育碁數位科技 總經理 專業認證與專長 微軟 .NET 技術 軟體開發流程,資訊系統規劃 Microsoft MCSD/MCSE/MCDBA 物件導向技術, Rational OOAD 認證講師 Lotus Notes principle CLP/CLI J2EE. 目標與對象. 對象 技術平台的決策人員 軟體建構師 系統分析師 專案經理 應用程式開發人員

xantha-beck
Download Presentation

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

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. 林耀珍 • 經歷 第三波資訊 技術總監 育碁數位科技 總經理 • 專業認證與專長 微軟 .NET 技術 軟體開發流程,資訊系統規劃 Microsoft MCSD/MCSE/MCDBA 物件導向技術,Rational OOAD 認證講師 Lotus Notes principle CLP/CLI J2EE .NET技術代言人 林耀珍 2004/03/24

  3. 目標與對象 對象 • 技術平台的決策人員 • 軟體建構師 • 系統分析師 • 專案經理 • 應用程式開發人員 目標 • 開發高效能的應用程式 .NET技術代言人 林耀珍 2004/03/24

  4. Agenda Overview Framework for improving Performance Performance Modeling Testing Process Design Guidelines Improving ASP.NET Performance .NET技術代言人 林耀珍 2004/03/24

  5. 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? .NET技術代言人 林耀珍 2004/03/24

  6. Tough Challenges • Simple -> High Performance • Monolithic program runs on a huge machine • Life is not so simple • More demands • Security issues • Internet makes things more complex • Scalable 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. .NET技術代言人 林耀珍 2004/03/24

  7. Common 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. .NET技術代言人 林耀珍 2004/03/24

  8. Common Pitfall - Make 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 .NET技術代言人 林耀珍 2004/03/24

  9. Need a better way • Defining performance targets • Measuring performance • Troubleshooting performance problems • 80/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 .NET技術代言人 林耀珍 2004/03/24

  10. Framework for improving Performance .NET技術代言人 林耀珍 2004/03/24

  11. #1 Principle Less Impact .NET技術代言人 林耀珍 2004/03/24

  12. Plan & Design with Perf & Scale • Common issues .NET技術代言人 林耀珍 2004/03/24

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

  14. Measure, 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 .NET技術代言人 林耀珍 2004/03/24

  15. Testing Pre-Requisites Fixing Collecting Analyzing Tune Iteratively • Test, Collect, Analyze and Fix .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 .NET技術代言人 林耀珍 2004/03/24

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

  18. 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 • … .NET技術代言人 林耀珍 2004/03/24

  19. Performance Modeling Two parts of Performance model • An information structure • Performance objectives • Budgets • Workloads • Itemized scenarios with goals • Test cases with goals • A process .NET技術代言人 林耀珍 2004/03/24

  20. Information Category in the performance model • Application Description • Scenarios • Performance Objectives • Budgets • Measurements • Workload Goals • Baseline Hardware • Quality of Service Requirements • security, maintainability, and interoperability • Workload Requirements • Total # of users, concurrent users, data volumes, expected usages .NET技術代言人 林耀珍 2004/03/24

  21. Performance Modeling Process • Identify Use Cases • Identify workload • Identify Performance Objectives • Identify Budget • Identify Steps of User Activities • Allocate Budget • Evaluate • Validate .NET技術代言人 林耀珍 2004/03/24

  22. 1. Identify Use Cases • Critical use cases • Use cases with performance expectations or requirements, such as service level agreements • Submit an order • Process a message • Significant use cases • Use cases that represent the majority of interaction or activity • Search for products • Browse catalog .NET技術代言人 林耀珍 2004/03/24

  23. 2. Identify workload • Total users • Concurrently active users • Data volumes • Transaction volumes and transaction mix Ex: • 100 concurrent users browsing • 10 concurrent users placing orders .NET技術代言人 林耀珍 2004/03/24

  24. 3. Identify Performance Objectives • Response time • Time 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 .NET技術代言人 林耀珍 2004/03/24

  25. 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 .NET技術代言人 林耀珍 2004/03/24

  26. 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 .NET技術代言人 林耀珍 2004/03/24

  27. 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. .NET技術代言人 林耀珍 2004/03/24

  28. 5. Identify Steps of User Activities • Users have different activities and steps. .NET技術代言人 林耀珍 2004/03/24

  29. 6. Allocate Budget • Assigning Execution Time • Assigning Resources .NET技術代言人 林耀珍 2004/03/24

  30. 7. 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 .NET技術代言人 林耀珍 2004/03/24

  31. 8. Validate • Continue to create prototypes and measure the performance of the use cases by capturing metrics. .NET技術代言人 林耀珍 2004/03/24

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

  33. Load Testing Process • Identify key scenarios • Identify workload • Identify metrics • Create test cases • Process test • Analyze the results • Report .NET技術代言人 林耀珍 2004/03/24

  34. 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. .NET技術代言人 林耀珍 2004/03/24

  35. Identify Workload • Numbers of users • The total number of concurrent users accessing the application in a given time frame • Rate of requests • Patterns of requests .NET技術代言人 林耀珍 2004/03/24

  36. Identify Metrics • Network specific metrics • System related metrics • Platform specific metrics • Application specific metrics • Service level metrics .NET技術代言人 林耀珍 2004/03/24

  37. Create Test Cases • Sample E-Commerce Application • Expected Results under the load profile below • Throughput: 100 Requests/sec • Requests Executing: 45 Requests executing • Response Time: 2.5 sec Response time • Resource utilization thresholds: • Processor\% Processor Time: 75 % • Memory\ Available MBytes: 25 % of total physical RAM .NET技術代言人 林耀珍 2004/03/24

  38. Process test • Create scripts • Modify Scripts or configure scripts • User delays • User patterns: different paths • Groups of users: customer, sales, admins • Distribution of Activities: ex. start time • Abandon ratio • Avoid script failures • Data • Navigation • Data Correlation • Security issues: Authorization/Authentication • Load Data • Run the tests and Collect Data .NET技術代言人 林耀珍 2004/03/24

  39. 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. .NET技術代言人 林耀珍 2004/03/24

  40. Analysis • Potential Bottlenecks .NET技術代言人 林耀珍 2004/03/24

  41. Analyze Results • Proper design and execution of tests as well as proper measurement of system and/or component activities make the analysis easier .NET技術代言人 林耀珍 2004/03/24

  42. Investigate root causes • Multiple Performance Index .NET技術代言人 林耀珍 2004/03/24

  43. Reporting • Hardware Details • Software details • Configuration Details • Workload Profile • Performance Objectives • Metrics • System Metrics • Web Server Metrics • SQL Server Metrics • Analysis .NET技術代言人 林耀珍 2004/03/24

  44. Load Trend • Good for high level presentation .NET技術代言人 林耀珍 2004/03/24

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

  46. Improve Components Performance • Managed Code • Data Access Component • ASP.NET • Web Services • .NET Remoting Component • Enterprise Services Component • Interop Component .NET技術代言人 林耀珍 2004/03/24

  47. Common Categories • Data Structures and Algorithms • Communication • Concurrency • Resource Management • Coupling and Cohesion • Caching • State Management • Security • Deployment .NET技術代言人 林耀珍 2004/03/24

  48. Design Principles • Design coarse-grained services • Minimize roundtrips and batch work • Acquire late and release early • Evaluate affinity with processing resources • Put the processing closer to the resources • Pool shared resources • Avoid unnecessary work • Reduce contention • Use smart recalculation • Concurrently process independent tasks .NET技術代言人 林耀珍 2004/03/24

  49. Improving ASP.NET Performance • Architecture .NET技術代言人 林耀珍 2004/03/24

  50. Performance and Scalability Issues • Resource affinity • Failure to share expensive resources • Blocking operations • Misusing threads • Making late bound calls • Misusing COM Interop • Large pages • Improper data caching • Failure to use output caching properly • Inefficient rendering .NET技術代言人 林耀珍 2004/03/24

More Related