You need to record the execution time of web service calls, page loads,and expensive code blocks before you can identify scalability issues.Example shows a way to calculate the execution time of a code block.
Record executing time of code block for instrumentation
private void SomeFunction( )
using (new TimedLog(Profile.UserName,"Some Function"))
You can measure the execution time of a function and a smaller block of code.Whatever is inside the using block is timed and logged, and you get an output like Example
Output from TimedLog class6/14/2006 10:58:26 AM [email protected] SomeFunction 9.578125
The TimedLog class measures execution time of code blocks as shown in Example
The TimedLog class records the time of its creation and disposal.The execution time is the difference between these two timestamps.
public class TimedLog : IDisposable
private string _Message;
private long _StartTicks;
public TimedLog(string userName, string message)
this._Message = userName + 't' + message;
this._StartTicks = DateTime.Now.Ticks;
#region IDisposable Members
void IDisposable.Dispose( )
Debug.WriteLine(this._Message + 't' + TimeSpan.FromTicks(DateTime.Now.Ticks -
The benefit of such a log is you get a tab-delimited output, which you can use to do many types of analysis using Microsoft Excel.For example,you can generate graphs to see how the performance goes up and down during peak and nonpeak hours.You can also see whether there are high response times and determine the pattern. All these give you valuable indications of where the bottleneck is.You can also find out which calls take the most time by doing a sort on the duration column.
You can use logging utilities, such as Log4net or the Enterprise Library Logging Application Block, to log text files. Logging has a very small overhead and won’t have a significant effect on the timing of execution.
Logging the code block execution time is an invaluable tool for debugging performance issues.When you have problems with an action being timed out or taking a noticeably long time,open up the logs and analyze the average delay in the code blocks.You can then further narrow the problem down to smaller blocks of code and pinpoint which block is the culprit.It is a good idea to have a timed log added t all web service calls and business layer functions. A timed log has been added to allDash board Facade public functions.So, whenever there’s any performance issue, you can isolate the slow Facade method.
ASP.NET Related Interview Questions
|VB.NET Interview Questions||C#. NET Interview Questions|
|ASP.NET Interview Questions||ADO.Net Interview Questions|
|Windows Presentation Foundation(WPF) Interview Questions||Windows CE .NET Interview Questions|
|Dot Net Framework Interview Questions||Asp Dot Net Mvc 4 Interview Questions|
|Asp Dot Net Mvc Interview Questions|
Introducing Web Portals And Dropthings.com
Architecting The Web Portal And Widgets
Building The Web Layer Using Asp.net Ajax
Building The Data And Business Layers Using .net 3.5
Building Client-side Widgets
Optimizing Asp.net Ajax
Creating Asynchronous, Transactional, Cache-friendly Web Services
Improving Server-side Performance And Scalability
Improving Client-side Performance
Solving Common Deployment, Hosting, And Production Challenges
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.