How would I solve this .net web server performance profiling issue?

I am using redgate performance profiler to test my mvc 2 application. One of the things I found out was the XMLSerializer was taking too much of the CPU time so referring from this post. I changed it to where it uses XmlSerializerCache now.

Now the XmlSerializer issue is no longer there and I am profiling the application by simulating 80 users at the same time using the website with Jmeter. So now the top methods which take time are doing a FirstOrDefault() on some data I am pulling I will give example-

var values=(from c in DataContext.Table1
           join s in DataContext.Table2 on new { c.Id, } 
            equals new { s.Id, } into list
                          where c.Id== Id && == date
                          from s in list.DefaultIfEmpty()
                          select new DayDTO()
                              Points = c.points,
                              Points1 = c.points1,
                              Points2 = c.points2,
                              Points3 = c.points3,
                              Points4 = c.points4

Can anyone suggest me what I can do to improve this ? The current times are 25 secs and 16 secs for the top 2 methods .. Is it just because I am simulating 80 user at the same time and there are some issues on database (sql server 2005) side like the table being too large and indexing etc...and I will look into that but currently I am trying to identify any issues you see with the code i.e. issues on C# side..

I would appreciate any help thanks !


This assumes that the top time is the "inclusive time", not the "exclusive time".

Inclusive time means that it includes any code called by the method, in this case the FirstOrDefault will execute the database call. Database calls are expensive in the context of latency, but the CPU thread is blocked and not using the CPU while waiting for the database call.

First you should ask yourself if this is a problem, it does not significantly affect throughput (assuming the database server can handle the load), but latency of your calls.

If this is a problem you need to speed up the actual SQL query. You should start SQL profiler, catch the actual question, then run it in SQL management studio. Look at the execution plan to see if the query is slower than expected and try to figure out why. If it is too slow you might check your indexing to start with.

Need Your Help

Qt. undefined reference to '_time32'

c++ qt compilation include linker-error

I compiled static Qt with static OpenSSL and now get following errors while compiling my project:

How to play wav audio byte array via javascript/html5?

javascript html5 gwt wav audiocontext

I'm using the following method to play a byte array containing wav data. The function is being called from a GWT project. This function plays back sound, but it sounds like some kind of Hellish

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.