views:

19

answers:

1

I need to do some performance testing for an ASP.NET MVC application and specifically want to measure how many databsae queries each HTTP request results in. The data access layer is using LINQ-to-SQL.

I'd like to be able to automate the tests so am looking for a good way to be able to do a before and after count of the number of SQL queries. The possibilites I can think of are:

  • A performance monitor counter for the ASP.NET process,
  • A system table in the MSSQL database that can be queried before and after each page request,
  • A property somewhere in the System.Data.SQLClient namespace that tracks the number of queries executed by the process.

Has anyone done this before and can perhaps point my down the right path?

A: 

The best approach I've been able to come up with so far is to use SQL Server Profiler to profile the db connections while the test app is running and get it to save the results to a database table (File->Properties->General). My test app can then query that table to see what and how many TSQL statements were executed.

sipwiz