James
James

Reputation: 2033

c# website - analysing code and queries

I am working on a pre-existing c#/asp website and I am attempting to optimize it.

To do this I want to find out how many SQL queries are made on each page. If possible, find out how much load it's putting on the server or if that's not possible, the amount of time it's taking to perform the requests.

What tools are available to me and how can I do this?

I am using Visual Studio 2012 Ultimate and I am connecting to SQL Server 2005.

Upvotes: 2

Views: 181

Answers (2)

Ryan McDonough
Ryan McDonough

Reputation: 10012

I might also suggest New Relic, it's a commercial service with a free trial to begin with, then moves you onto the free tier of app performance checking if you don't want to pay for it.

I used it to check for bottlenecks in my application and it does help find issues. It will tell you where in your code that the most time is being spent on.

n.b You will need full access to the server to install the monitoring service.

Upvotes: 1

Manish Mishra
Manish Mishra

Reputation: 12375

if you want to know, how many sql queries go to your db server, on a given page, the best way to analyze that is to use SQL Profiler.

SQL Profiler is a graphical tool that allows system administrators to monitor 
events in an instance of Microsoft® SQL Server™. You can capture and save data 
about each event to a file or SQL Server table to analyze later. For example,
you can monitor a production environment to see which stored procedures are 
hampering performance by executing too slowly.

read more about this here and here

Now, if you want to analyze the performance of your page, based on its XHTML markup, there are plenty of tools for that. The one that I used, and considered very useful was Firefox plugin YSlow

YSlow analyzes web pages and suggests ways to improve their performance based 
on a set of rules for high performance web pages.

Now, if you want to optimize your C# code in terms of semantics, performance, code construct, use this free available tool with Microsoft.NET called FxCop.

FxCop is an application that analyzes managed code assemblies (code that 
targets the .NET Framework common language runtime) and reports information 
about the assemblies, such as possible design, localization, performance, 
and security improvements. Many of the issues concern violations of the 
programming and design rules set forth in the Design Guidelines, which are 
the Microsoft guidelines for writing robust and easily maintainable code by 
using the .NET Framework.

Upvotes: 3

Related Questions