Click Here to Install Silverlight*
IndiaChange|All Microsoft Sites
MSDN
|Developer Centers|Library|Downloads|How To Buy|Subscribers|My MSDN
 
Chat Transcript
 
ASP.NET Performance
Host
: Madhu Gopinathan, Architect Evangelist - Microsoft India
June 20, 2003
 
Deepak_MS: Hi friends

Deepak_MS: welcome to MSDN India chat...

Deepak_MS: today we have with us Madhu Gopinathan who works for Microsoft who will discuss with you features of ASP.NET with special focus on performance..

Deepak_MS: Madhu, lets start with some basics, what is in ASP.NET that makes it better in terms of performance than classic ASP

madhug_ms: Good evening friends

madhug_ms: Welcome to ASP.NET performance chat

madhug_ms: We'll discuss about the following:

madhug_ms: Understand the cost of writing code, in the managed code world, how to understand the cost and how to measure it

madhug_ms: After all, the code that you write in ASP.NET is managed code!!

madhug_ms: Second, we'll talk about performance considerations while using various ASP.NET features

madhug_ms: Thirdly, how to monitor performance for ASP.NET apps in production

Deepak_MS: (123456789): Hi can u tell me as performance wise what is better ... I want to fill a dropdown list with data from a sql table. 1) Dataadapter->dataset->fill it 2) sqlcommand->datareader->iterate and add item in dropdown ... OR is there a better method

madhug_ms: Use data reader for fast, forward, read-only access. If this data is used several times, then it makes sense to cache it. Caching can be done at several levels: Cache the page itself, or cache a fragment of the page.

madhug_ms: In IIS6, this cache sits at the kernel level and this can give you excellent performance

madhug_ms: Or you can use the Cache class to store read-only data in the middle tier

madhug_ms: I know this answer is long, but it depends on whether the data you're populating is reference data, i.e. changes infrequently or whether it changes every time the page is loaded

madhug_ms: Based on these considerations, you should use one of the above mechanisms

Deepak_MS: (Neo-Reloaded): There is a famous question about inline and code behind code...about performance...which one is better?

madhug_ms: w.r.t. performance, there is no difference. Both are compiled.

madhug_ms: w.r.t. maintenance, there is big difference. Code behind is a much better way to write real world applications

madhug_ms: Let me give you references to some excellent articles on managed code performance

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/fastmanagedcode.asp

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/highperfmanagedapps.asp

madhug_ms: I would recommend using CLRProfiler (see the above articles) to understand characteristics of your code better

Deepak_MS: (venu): My Question: When I run an aspx page, the server generates lots of scripts and HTML which increases the size of the page and takes lots of time to download...is there a way to overcome this?

madhug_ms: There are several things to consider here:

madhug_ms: Do you really need to use an ASP.NET control or HTML control?

madhug_ms: Do you really need viewstate turned on for all controls? Viewstate is enabled by default

madhug_ms: Instead of data grid, can you use repeater control?

madhug_ms: These are some of the things to consider when looking at the size of the page. Turn on tracing and look at the size of each of the elements.

madhug_ms: See how these can be optimized.

madhug_ms: In special scenarios, you might want to look at user controls to cut down on html generation

Deepak_MS: To add to that, here are times when you really don't need view state..

Deepak_MS: classic example - a data grid being used to display 2000 records..

Deepak_MS: now if you are not going to be doing anything else other than displaying the data, it makes sense to disable the viewstate for the datagrid, because in effect, you are doubling the data that is being transferred to the client - redundant data that is not being used.

Deepak_MS: (Neo-Reloaded): Is there any security issues to be measured in kernel caching? It is like isolated cache per app?

madhug_ms: NO. There is one cache in the kernel level driver (HTTP.SYS). There is no code here, it is data being cached.

Deepak_MS: (Biswajit): In caching, there is no API support for caching user controls, we have to use outputcache directive. Is that addressed in 1.1?

madhug_ms: Use fragment caching to cache individual user controls

madhug_ms: See this article

madhug_ms: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B308378

Deepak_MS: (seshu): Hey, I need to design a web page using ASP.NET and the menus for it must be taken from a SQL DB?

madhug_ms: Menus are typically reference data - do not change often. So cache them in the application cache

madhug_ms: You can even try using a user control and fragment caching to improve the performance

madhug_ms: See this article on some of the best practices to improve ASP.NET performance

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondevelopinghigh-performanceaspnetapplications.asp

madhug_ms: Done

Deepak_MS: (Neo-Reloaded): the scenario: if one application has more 500 aspx pages, and some 100 assemblies does this effect the performance of the website? (if we bundle all in to a single assembly)?

madhug_ms: For a large web application, consider performing pre-batch compilation

madhug_ms: See this article for details:

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondevelopinghigh-performanceaspnetapplications.asp

Deepak_MS: (YKK): What is the maximum number of simultaneous users that can be allowed to be connected to an asp.net application. And how to avoid crash of application errors like too many users connected.?

madhug_ms: There is no hard limit like that.

madhug_ms: For an application that needs to support a very large number of users, use a web farm with network load balancing. This will distribute the load to all members in the cluster.

madhug_ms: I mentioned an article previously which discusses how to measure ASP.NET performance. This mentions performance counters to measure various aspects of your application performance. Using these, you should design your system appropriately (with adequate hardware, resources etc)

madhug_ms: To scale out as the users increase, add more members to your web farm.

madhug_ms: This way you can support a very large number of users

Deepak_MS: (rajiv11882): OleDbAdapter.Update() takes hell lot of time. With OleDbCommand object I can execute faster. But it is required to be executed for each minor data change. How to speed up OleDbAdapter.Update()?

madhug_ms: Haven't heard this before.

madhug_ms: If this is a concern, you could use just commands to update data and not use a dataset.

Deepak_MS: (YKK): Can I have reference of your article on ASP.NET performance?

madhug_ms: Here it is

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpcondevelopinghigh-performanceaspnetapplications.asp

Deepak_MS: (Kiran): which is the best way to retrieve the data from database, like in ADO recordset is used But in ADO.NET there are two ways to retrieve the data that is oledbAdapter and oledbReader...(I used these ways)..

madhug_ms: Ask yourself this question: Am I using this data in a read-only fashion or one-time use?

madhug_ms: If so, use reader.

madhug_ms: If you want to keep the data around, do incremental modifications etc. use adapter and a dataset.

madhug_ms: Dataset is similar to the disconnected recordset of old ADO days.

madhug_ms: When monitoring ASP.NET application performance, the following counters should be observed at a minimum

madhug_ms: Processor(_Total)\% Processor Time

madhug_ms: Process(aspnet_wp)\% Processor Time Process(aspnet_wp)\Private Bytes Process(aspnet_wp)\Virtual Bytes Process(aspnet_wp)\Handle Count .NET CLR Exceptions\# Exceps thrown / sec ASP.NET\Application Restarts ASP.NET\Requests Rejected ASP.NET\Worker Process R

madhug_ms: ASP.NET\Application Restarts ASP.NET\Requests Rejected ASP.NET\Worker Process Restarts Memory\Available Mbytes Web Service\Current Connections Web Service\ISAPI Extension Requests/sec

madhug_ms: To debug performance and memory related issues, please look at

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/DBGch03.asp

madhug_ms: This has walkthroughs, tools etc to debug performance issues

Deepak_MS: (Lotus): In Visual Studio IDE, How do we debug the Web application step by step?

madhug_ms: VS.NET documentation itself has debugging walkthroughs

madhug_ms: Also, for production debugging instructions, see this:

madhug_ms: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/DBGch03.asp

Deepak_MS: (YKK): Can I have a reference article from where we can get information to develop installer exe for a web application, that can create virtual directory ,DSN connections etc. as we see in sample application provided by ASP.net site?

madhug_ms: See installer walkthroughs in VS.NET documentation

Deepak_MS: With that we come to end of today's chat session...

Deepak_MS: Do join us next week for a session on developing and using COM+ 1.5
     

©2009 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement
Microsoft