Download presentation
Presentation is loading. Please wait.
Published byЗоя Сумарокова Modified over 5 years ago
1
DEV315 Best Practices for running IIS 6.0 and ASP.NET
7/29/2019 7:45 AM DEV315 Best Practices for running IIS 6.0 and ASP.NET Rob Howard Program Manager Web Platform & Tools Team © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
2
ASP.NET Community Contact: ASP.NET Resources rhoward@devadvice.com
ASP.NET Resources
3
Agenda www.asp.net Vital Statistics Hardware & Infrastructure
Recommendations & Resources
4
7/29/2019 7:45 AM Live Site © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
5
www.asp.net – Vital Stats
General statistics (hosted by OrcsWeb) Over 4,000 files 23% ASP.NET Page files (.aspx) 46% Code-behind / BLL / DAL 31% Resource files: images, etc. Server cluster hosts many applications (plus online starter kits) weblogs.asp.net / blogs.msdn.com forums.asp.net /
6
www.asp.net Year-Year May 2003 May 2004
~485GB bandwidth usage 2mm Unique visitors 42K downloads of .NET Framework 23K Forum Posts May 2004 ~1.5TB bandwidth usage* 2.9mm Unique visitors 62K downloads of .NET Framework 28K Forum Posts * With HTTP Compression / traffic due to blogs
7
Hardware & Infrastructure
8
Network Hardware Web 2 Web 1 SQL Load Balancer Web servers
7/29/2019 7:45 AM Load Balancer Network Hardware Web servers Web 1 Web 2 Internet Information Server 6.0 ASP.NET 1.1 Business Logic Tier Data Access Tier Process Boundary Database server SQL SQL Server 2000 Data Tier – Stored Procedures © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
9
Original Hardware Specs.
7/29/2019 7:45 AM Original Hardware Specs. 2 Web Servers Windows Server 2000 Dual-750 MHZ Processors 500 MB RAM 1 Database Server Single 750 MHZ Processor 1 GB RAM © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
10
Original Hardware Site was highly Database bound
7/29/2019 7:45 AM Original Hardware Site was highly Database bound CPU ~95% utilization on database server File IO bound on Database Highly transactional / dynamic site Lots of database updates from Forums Lots of TempDB usage This was our own fault Database & logs on single disk OS on single disk © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
11
Web Server Upgrade Replaced Web Servers Windows Server 2003 Notable
7/29/2019 7:45 AM Web Server Upgrade Replaced Web Servers Upgraded to Windows Server 2003 2 dual-processor 2.2 GHZ + 1 GB RAM Windows Server 2003 More secure & easier to isolate Better performance & scale capability Fault tolerance & configuration Notable Performance improved with no code changes A year later … still under-utilized © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
12
IIS 5 Request Processing
7/29/2019 7:45 AM IIS 5 Request Processing X INETINFO.exe DLLHOST.exe X X Metabase X DLLHOST.exe Kernel mode User mode TCP/IP Request Response © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
13
IIS 6.0 Request Processing
7/29/2019 7:45 AM IIS 6.0 Request Processing Inetinfo Administration & Monitoring WWW Service Application Pools XML Metabase X … Kernel mode User mode HTTP Cache Queue Request Response © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
14
Database Design Changes
7/29/2019 7:45 AM Database Design Changes ASP.NET Forums was biggest culprit Highly transactional tables Lots of updates (read, last visit, …) Posts table Stores a list of all messages Clustered index on PostID Denormalized data Tracked top-level posts Clustered index on ForumID © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
15
Database Hardware Upgrade
7/29/2019 7:45 AM Database Hardware Upgrade Single Database Server Windows Server 2000 2 dual-processor 2.8 GHZ (Hyper-threaded) 2 GB Memory Performance changes Faster disks, more CPU, more memory RAID-0 disk arrays Separate controllers for OS, database, logs © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
16
Database Hardware Upgrade
7/29/2019 7:45 AM Database Hardware Upgrade Database no longer impacting performance CPU utilization ~6% / avg (2003) CPU utilization ~18% / avg (2004) SQL is a memory hog ~1.5 GB Memory is inexpensive, buy lots for SQL © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
17
Site Performance 7/29/2019 7:45 AM
© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
18
HTTP Compression Reduces bandwidth usage Not like IIS 5 compression
Not enabled by default Uses gzip compression Not like IIS 5 compression Compression was built-in, but… …most people purchased Steps to enable: Good write-up at:
19
HTTP Compression IIS Web Service extensions Add required file
Add new Web Service extension Http Compression (name doesn’t matter) Add required file \Windows\System32\inetsrv\gzip.dll Set extension status to ‘allowed’ Edit the metabase Requires IIS shut-down \Windows\System32\inetsrv\MetaBase.xml Find IIsCompressionScheme (add aspx)
20
Disable Process Recycle
7/29/2019 7:45 AM Disable Process Recycle Too aggressive …unless leaks …or desired © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
21
Tune Maximum Memory Set this value Recommended settings
7/29/2019 7:45 AM Tune Maximum Memory Set this value Risk paging to disk Recommended settings No more than 60% Physical Using 2GB address space No higher than 800MB If 3GB+ address space No higher than 1800MB © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
22
Data Abstraction Layer Controlling Access to the Database
7/29/2019 7:45 AM Data Abstraction Layer Controlling Access to the Database © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
23
Data Access Layer Class to entity relationship Data exchange
7/29/2019 7:45 AM Data Access Layer Class to entity relationship [Area]DB ControlGalleryDB Data exchange No DataReaders passed Populated class instances returned Connection string Stored within configuration No embedded connection strings in the app. © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
24
Business Logic Layer 7/29/2019 7:45 AM
© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
25
Everything is a Module HTML Module HTML Module Article Module Survey
HTML Rotator Article Module © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
26
Evolution of IBuySpy Portal
7/29/2019 7:45 AM Evolution of IBuySpy Portal Originally code named ‘Calypso’ Based off original IBuySpy portal Dynamic user control loading into page Minor architecture changes Configuration read from file Updated Starter Kit reflects this change © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
27
BLL Code Location All code is inline Extensive user of User Controls
7/29/2019 7:45 AM BLL Code Location All code is inline Negative: No design-time support in VS Positive: Isolation & easy updates Extensive user of User Controls Page is a frame for User Controls Dynamically loaded / cached Languages used C# is primary language Some VB code © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
28
Recommendations & Resources
7/29/2019 7:45 AM Recommendations & Resources © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
29
Key Performance Counters
7/29/2019 7:45 AM Key Performance Counters Processor: % Processor Time Processor time of all processors System: Processor Queue Length Exceeds 2 / CPU > 5 min. potential bottleneck Physical Disk: Avg. Queue Length Exceeds 2 / Drive > 5 min. potential bottleneck Physical Disk: % Disk Time General picture of how busy the disk is Memory: Pages / Sec Memory paged to disk © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
30
Key Performance Counters
7/29/2019 7:45 AM Key Performance Counters Processor, CPU % Utilization Low numbers = blocking or lock contention ASP.NET, Requests Queued Linear growth here indicates server maxed ASP.NET Applications, Requests/Sec Dynamic throughput (should be consistent) ASP.NET Application, Errors Total Indicates functional problems (should be 0) ASP.NET App/Worker Process Restarts Indicates serious functional problems © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
31
Tools / Resources Recommended Reading Query Analyzer SQL Profiler
7/29/2019 7:45 AM Tools / Resources Recommended Reading Microsoft SQL Server 2000 Performance Optimization and Tuning Handbook by Ken England, published by Digital Press Query Analyzer Execution Plan Trace SQL Profiler Live profiling of database Track down expensive procedures © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
32
Recommendations De-normalize in some cases
7/29/2019 7:45 AM Recommendations De-normalize in some cases Normalization can affect performance Understand clustered indexes Common data stored together physically on disk Understand covered queries All data stored in index – faster lookups Use separate SQL accounts Makes tracing / security easier Know where you’re slow Likely database Definitely network © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
33
Recommendations Cache aggressively Data Readers vs. DataSet
7/29/2019 7:45 AM Recommendations Cache aggressively Per-Request or other time duration Data Readers vs. DataSet DataSet used when data can be cached Return multiple results Batch common work together Use stored procedures Security & Efficiency Close connections Ensure any open connections are closed © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
34
Recommendations Process hop as little as possible
7/29/2019 7:45 AM Recommendations Process hop as little as possible BLL / DAL in the same process ASP.NET 1.1 / IIS 6 Whitepaper Per-Request or other time duration Using Session State on server farm Mark as read-only if you don’t update IIS 6 Kernel Cache Can dramatically improve performance ViewState size Increases total size of page © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
35
Lessons Learnt Hardware is inexpensive, people aren’t
7/29/2019 7:45 AM Lessons Learnt Hardware is inexpensive, people aren’t Database background is critical Database de-normalization is ok Robots.txt file Cross-site scripting attacks No Ad-Hoc SQL (SQL script attacks) HttpContext.Items (per-Request Cache) © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
36
Summary www.asp.net Invest in hardware
7/29/2019 7:45 AM Summary Real world web site Community Portal Invest in hardware It’s ok to de-normalize for performance Stay in the same process Cache as much as possible © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
37
© 2004 Microsoft Corporation. All rights reserved.
7/29/2019 7:45 AM © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.