Tips And Tricks For Your ASP'NET Applications - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Tips And Tricks For Your ASP'NET Applications

Description:

Enterprise Architect with Security and Performance specialties ... Use ClientID of Server Control. Page.RegisterStartupScript() Script that runs when page starts ... – PowerPoint PPT presentation

Number of Views:102
Avg rating:3.0/5.0
Slides: 19
Provided by: rido7
Category:

less

Transcript and Presenter's Notes

Title: Tips And Tricks For Your ASP'NET Applications


1
Tips And Tricks For Your ASP.NET Applications
Patrick J. Hynds CTO, CriticalSites, Boston and
New York Microsoft Regional Director for Boston
MCSEI, MCSD, MCDBA, MCT
2
Patrick Hynds
  • Enterprise Architect with Security and
    Performance specialties
  • Regularly speak at technical conferences
  • TechEd US and Hong Kong
  • MDC in Cairo, Egypt
  • DevTeach in Montreal
  • DevDays in Boston and Hartford
  • Security Summit in Boston and NYC
  • Team lead for first Windows Logo Certified .Net
    application in the world
  • Security Editor of .Net Developers Journal

3
Agenda
  • Building an intermediate page
  • Set focus
  • Outputcache (duration and page size)
  • Reflection caching
  • Returning multiple result sets
  • SQL record paging
  • Database cache invalidation

4
Intermediate Page
  • Problem
  • Long running, expensive operation
  • Prevent Refresh or Re-Submit
  • Display temporary processing UI
  • Client is still waiting for work to complete
  • Server is still processing
  • Perception is not reality
  • Client is re-activated
  • Multiple techniques, client script easiest

5
Intermediate Page
6
Set Focus
  • Problem
  • Large HTML Form
  • Set initial focus of the Form, e.g. Button
  • Enable dynamic control selection
  • JavaScript focus() method
  • Use ClientID of Server Control
  • Page.RegisterStartupScript()
  • Script that runs when page starts

7
Set Focus
8
Duration And Page Size
  • Problem
  • How much data to return
  • How large should page be
  • Page size does affect performance
  • Larger pages slow down server
  • Aim for 30K (Google is 2K!)
  • Duration for OutputCache
  • More tunable than most people think
  • Even 1Sec duration makes a difference

9
Page Size And Duration
10
Reflection Caching
  • Problem
  • Reflection is powerful, but expensive
  • 3-4 times cost of normal object creation
  • Dynamic Class Loading
  • Inspect or load classes at runtime
  • Used by new Provider pattern
  • Cache the constructor of the class
  • 1/3 Cost of non-Cached
  • Technique used in Forums Provider

11
Reflection Caching
12
Multiple Result Sets
  • Problem
  • Database operations are expensive
  • Network IO is very costly
  • Be as efficient as possible
  • Use SPROCs or Parameterized SQL
  • Batch Result Sets
  • SqlDataReader.NextResult()
  • Not as evident on local SQL (no network)

13
Batched Result Set
14
SQL Record Paging
  • Problem
  • DataGrid paging requests all records
  • Only shows requested, discards others
  • Return only the data you need
  • Reduces time spent with DB
  • Increases application throughput
  • Stored Procedure paging
  • Uses temporary table
  • Requires knowledge of SQL indexes

15
Paging Data In SQL Server
16
DB Cache Invalidation
  • Problem
  • Keeping Cache and Database in sync
  • Cache for period of time
  • Optimally invalidate on data changes
  • Built-in feature of ASP.NET 2.0
  • Several bad techniques for ASP.NET 1.X
  • Uses background thread
  • Poll for database changes
  • Similar model used in ASP.NET 2.0

17
Database Cache Invalidation
18
Summary
  • Tips and Tricks to make your app better
  • Tune and optimize your application
  • Control data from the database
  • Off-load work
  • Cache as much as possible
Write a Comment
User Comments (0)
About PowerShow.com