Advanced Performance Techniques in ASP.NET 2.0 William Zhang, Ph.D. Senior Consultant Microsoft Consulting Services.

Slides:



Advertisements
Similar presentations
Introduction to NHibernate By Andrew Smith. The Basics Object Relation Mapper Maps POCOs to database tables Based on Java Hibernate. V stable Generates.
Advertisements

Malek Kemmou Technology Architect, Application Platform Microsoft Middle East and Africa Overview of ASP.NET 2.0.
SQL Server 2005 Query Notifications
DEV411 ASP.NET: Best Practices For Performance Stephen Walther
ASP.NET Ajax Supplementary Tutorial. Why Use ASP.NET AJAX? - I ASP.NET AJAX enables you to build rich Web applications that have many advantages over.
Overview and Demonstration of declarative workflows in SharePoint using Microsoft SharePoint Designer 2007 Kevin Hughes MCT, MCITP, MCSA, MCTS, MCP, Network+,
ADO vs ADO.NET ADOADO.NET Client/server coupledDisconnected collection of data from data server Uses RECORDSET object (contains one table) Uses DATASET.
Forms Authentication, Users, Roles, Membership Ventsislav Popov Crossroad Ltd.
ASP.NET Best Practices Dawit Wubshet Park University.
1.NET Web Forms DataGrid © 2002 by Jerry Post. 2 Data Grid Has Many Uses  The grid uses HTML tables to display multiple rows of data. It is flexible.
Internetteknologi (ITNET2) Presentation 21: ASP.NET Advanced.
Microsoft Dynamics AX 2009 Integration and Development with.NET Framework Enterprise Portal.
Turners SharePoint Web Site How we did it. 2 Page Anatomy Custom Search Web Part Custom Search Web Part Data Form Web Parts Content Query Web Part HTML.
ManageEngine TM Applications Manager 8 Monitoring Custom Applications.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
.NET Health Monitoring Jonathan Franco ITD Application Services.
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Arvind Gupta Professional Software Developer C#.net Portfolio  N-tier layered application  Defining a class object  Use of iComparable, iEnumerable.
Philip Wolfe Senior Consultant Sogeti Session 3 - Leveraging Data in ASP.NET 2.0 (Level 200)
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
ASP.NET Whidbey Overview  Wallace B. McClure  Scalable Development, Inc. Scalable Development, Inc. Building systems today that perform tomorrow.
An Introduction to ASP.NET Ed Dunhill blogs.msdn.com/edunhill SLIDE7.
Chapter 10 Managing Data with ASP.NET. ASP.NET 2.0, Third Edition2.
Sofia, Bulgaria | 9-10 October Asynchronous Programming for ASP.NET 2.0 Developers Julie Lerman The Data Farm Julie Lerman The Data Farm.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
Windows Azure Tour Benjamin Day Benjamin Day Consulting, Inc.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Phone: Mega AS Consulting Ltd © 2007  CAT – the problem & the solution  Using the CAT - Administrator  Mega.
Searching Business Data with MOSS 2007 Enterprise Search Presenter: Corey Roth Enterprise Consultant Stonebridge Blog:
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 Working with Disconnected Data The DataSet and SqlDataAdapter ADO.NET - Lesson.
Caching Chapter 12. Caching For high-performance apps Caching: storing frequently-used items in memory –Accessed more quickly Cached Web Form bypasses:
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
ASP.NET OPTIMIZATION. Why Optimize? $$$ Whether you build applications for customers or not, enhanced applications save money.
Database Handling, Sessions, and AJAX. Post Back ASP.NET Functionality The IsPostBack method in ASP.NET is similar to the BlackBerry.refresh method –IsPostBack.
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Office Server Specific Web content management –Page structure, layouts, and controls –Publishing.
Web Services Error Handling and Debugging. Agenda Simple SOAP faults Advanced SOAP faults SOAP headers and faults Error handling From a Service Perspective.
Virtual techdays INDIA │ 9-11 February 2011 Caching Enhancement in ASP.NET 4.0 Abhijit Jana │ Consultant, Microsoft
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
The business logic engine for Microsoft IIS Speaker T.M. Arnett.
IT533 Lectures ASP.NET AJAX.
1 Database Programming with ADO.NET Kashef Mughal.
WaveMaker Visual AJAX Studio 4.0 Training Java Script Events.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Ch 12. Replication. Replication Place copies of data to a different location Use: Reduce locking conflict when multiple sites want to work on same set.
DEV414 Black-belt ASP.NET Tips And Tricks For Your ASP.NET Applications Rob Howard Program Manager Web Platform and Tools Team.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
Raina NEC Application Object Describes the methods, properties, and collections of the object that stores information related to the entire Web.
Building web applications with the Windows Azure Platform Ido Flatow | Senior Architect | Sela | This session.
Developing Custom ASP.NET Providers For Membership And Role Manager Stefan Schackow PRS404 Program Manager – Web Platform and Tools Microsoft Corporation.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Database Processing with ADO.NET
ASP.NET Caching.
Haritha Dasari Josue Balandrano Coronel -
Searching Business Data with MOSS 2007 Enterprise Search
Searching Business Data with MOSS 2007 Enterprise Search
Chapter 23 – ASP.NET Outline 23.1 Introduction NET Overview
The Request & Response object
IS 4506 Server Configuration (HTTP Server)
ASP.NET Module Subtitle.
ASP.NET 4.0 State Management Improvements – Deep Dive
Presentation transcript:

Advanced Performance Techniques in ASP.NET 2.0 William Zhang, Ph.D. Senior Consultant Microsoft Consulting Services

Agenda SQL Server cache dependency (SqlCacheDependency) Custom cache dependency (CacheDependency) Post-cache substitution Asynchronous page with parallel- processed tasks Data paging via stored procedure Returning multiple result sets from DB Script callback (out of band call)

SqlCacheDependency System.Web.Caching SQL 7 & 2000 Support Table change dependencies on SQL 7 & 2000 Requires configuration settings One-time setup of SQL Server database Polling model SQL Server “Yukon” Result Set dependencies for SQL Yukon Supported through ADO.NET SqlCommand No setup required Notification model

SQL Server 7 & 2000 Table level notifications only Notification when data in table changes Row-level notification is not supported Requires one time setup of SQL 7 / 2000 Triggers on tables that participate Stored procedures called to check Of Note: Entries in cache table < # of tables in DB Entries in cache = # items in cache table

aspnet_regsqlcache.exe Enable database aspnet_regsqlcache.exe -S. -E -d Northwind – ed Enable table aspnet_regsqlcache.exe -S. -E -t Products -d Northwind – et List enabled tables aspnet_regsqlcache.exe -S. -E -d Northwind -lt

Use code in place of aspnet_regsql.exe

How it works: SQL ‘Yukon’ ASP.NET SQL Server ‘Yukon’ IIS Northwind HttpListener Http.sys Notification Delivery Service TCP Port 80 SqlCommandSqlCommand SqlCacheDependency Page DataSet Cache Change Detection

Example: Yukon Notifications

SQL Server Cache Dependency (SQL Server 2000) Source: SqlCacheDependencyTest.aspx for SQL Server 2000

Custom Cache Dependencies

CacheDependency Changes System.Web.Caching No breaking changes to CacheDependency Backwards compatible with v1.X code ASP.NET 2.0 CacheDependency class: New virtual properties/methods Public default constructor Class can be derived, i.e. unsealed

Custom Cache Dependencies Anyone can create a dependency WebServiceDependencyOracleCacheDependency This is just what we did for SqlCacheDependencyAggregateDependency

Custom Cache Dependency (Event Log change invalidates cache) Source: CustomCacheDependency.aspx

Post-Cache Substitution

ASP.NET 2.0 Post-Cache Substitution Output cache entire page Identify regions that are dynamic Uses a PlaceHolder buffer

Post-Cache Substitution New Response.WriteSubstitution() Wires-up substitution event on page Adds a substitution buffer to the response Substitution event returns string value to add New control Drag-drop where content should go Set the MethodName property built-in support built-in support

Post-Cache Substitution Source: PostCacheSubstitution.aspx

Asynchronous ASPX Page and Parallel Tasks

Asynchronous ASPX Page By default, page processing in ASP.NET is synchronous Assigned thread does nothing else until the request completes ASP.NET has a limited number of threads at its disposal to process requests Requests are rejected with 503 "Server Unavailable" errors when queue is filled up to its capacity (100) Asynchronous ASPX page is for this

Effect of processing in parallel (calling a web method 3 times each taking 3 seconds)

Asynchronous ASPX Page with parallel processing Source: AsynchronousPage.aspx

Data Paging via Stored Procedure

Data Paging via SP DataGrid (ver 1.1) and GridView(ver 2.0) both do data paging However, the price is large ViewState. Your data layer will need to return all of the data and then the DataGrid will filter all the displayed records based on the current page. Use SP to return proper page of data, only, not all data.

Temp table holds Order table key and an IDENTITY column, which is used for paging Lower Bound<Temp.IndexId < Upper Bound

Data paging using stored procedure Source: DataPaging.aspx and DataPagingClient.aspx

Returning Multiple Resultsets

Improve scalability by reducing cross process/network requests Both DataSet and SqlDataReader allow you to return multiple resultsets

Using SqlDataReader to return multiple resultsets

Using DataSet to return multiple resultsets

Returning multiple resultsets Source: MultipleResultSets.aspx

Script Callback

Making server round trip without page postback

Script Callback Implementation Implement interface System.Web.UI.ICallbackEventHandler Implement public virtual string RaiseCallbackEvent(string eventArgument) Bind jscript string to HTML controls (not input type) using Page.ClientScript.GetCallbackEventRef erence() method

Implement the interface Implement the virtual method Bind jscript to HTML controls Script Callback Implementation

Script callback (out of band call) Source: ScriptCallback.aspx

Summary SQL Server cache dependency (SqlCacheDependency) Custom cache dependency (CacheDependency) Post-cache substitution Asynchronous page with parallel-processed tasks Data paging via stored procedure Returning multiple result sets from DB Server round trip without postback: script callback OTHERS (not covered in this talk): Windows Server 2003 features Kernel mode caching in IIS 6.0 Gzip compression Use mscorsvr.dll instead of mscorwks.dll In stored procedures Use Set NOCOUNT ON to prevent DONE_IN_PROC messages Do not use sp_prefix in stored proc names to prevent checking into master db Connection pooling

Q&A