0

I am deploying a MVC2 application under IIS7 on a Windows Server 2008 R2 server with plenty of horsepower. It's connecting to a SQL Server 2008 DB and the applications performance is dramatically slower than when running in the debugger on a developer workstation (connecting to the same SQL Server DB). I've already checked network connections and nothing in the eventlogs indicate an issue with Windows. I've also run the Profiler on the DB server and the queries are firing off fast.

Any help with diagnosing this performance issue would be appreciated. I've even built a new 2008 R2 server to test it on in hopes that it was the server itself but the performance was the same.

Thanks

Edit 1:

IIS is running on a Dell R710 server running Windows Server 2008 R2 Standard, 32GB ram. SQL Server 2008 is hosted on a separate R710 running Server 2008 R2 Standard, 12GB ram. Initially I had IIS running on a VM but I moved it to the physical machine to see if performance degradation was due to the VM. I'm experiencing the same performance on both so it looks like it wasn't a factor.

Edit 2:

It appears that opening the connection to the database is part of the bottleneck with the subsequent firing of stored procedures also taking a considerable amount of time:

-Open db connection: 5 sec (subsequent connections are cached so they don’t require 5 seconds)

-First sproc : < 1 sec

-Second sproc: 5 sec

-Third sproc: < 1 sec

-Fourth sproc: < 1 sec

-Fifth sproc: 6 sec

JohnyD
  • 83
  • 1
  • 10
  • 1
    IIS and SQL on same box? Virtualised? – gbn Apr 26 '11 at 19:35
  • No, IIS on a physical Dell R710 server running Windows Server 2008 R2 Standard, 32GB ram. DB on a separate R710 running Server 2008 R2 Standard, 12GB ram. – JohnyD Apr 27 '11 at 11:00

2 Answers2

2

First, Windows Server 2008 R2 has IIS 7.5, not IIS7. Probably doesn't matter. However, it is a different version.

Second, you need to find out where the bottleneck is. Try removing the queries and just using dummy data. Is it still slow? If not, then it has nothing to do with the data access.. if so, then you know it's a data access issue.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
  • I don't think it's data access. I say this because when I run the application in the debugger on my local workstation (Win7 64-bit) while connected to the exact same DB as above... it runs fast. It returns all data (several calls) in a 1/10th of a second. When hosted on Server 2008 (calling to the same DB server) it takes about 10 seconds... with pauses between each call. I just checked and the Win7 box is also running IIS 7.5, same version as the Server 2008. – JohnyD Apr 27 '11 at 11:09
  • @JohnyD - That doesn't change the fact that you have to find the bottleneck. The easiest way to do that (if you don't have a managed code profiler) is to take pieces out until the problem goes away. – Erik Funkenbusch Apr 27 '11 at 21:15
  • It appears that opening the connection to the database is part of the bottleneck with the subsequent firing of stored procedures also taking a considerable amount of time: -Open db connection: 5 sec (subsequent connections are cached so they don’t require 5 seconds) -First sproc : < 1 sec -Second sproc: 5 sec -Third sproc: < 1 sec -Fourth sproc: < 1 sec -Fifth sproc: 6 sec – JohnyD Apr 29 '11 at 00:43
  • we've switched the code to use the server's ip address now... so we've ruled out a dns issue. – JohnyD Apr 29 '11 at 12:51
  • My next guess would be an Active Directory issue, assuming you're using servers joined to the domain. Check the event log, and run dcdiag and other network diagnosis tools. – Erik Funkenbusch Apr 29 '11 at 22:34
1

Here are slides from a presentation about optimizing ASP.NET MVC applications. They were able to improve their app's performance from 8 req/sec to 400 req/sec.

They mention in the slides how they profiled it and identified bottlenecks (query compilation, many calls to RenderPartial, url generation etc.) and give some tips at the end of the presentation.

mak
  • 13,267
  • 5
  • 41
  • 47
  • 1
    Yeah I wouldn't place too much credence in that - they didn't use release mode when doing the benchmarks - doh! It's also concerns an older version. Much more likely this is a DB issue. – UpTheCreek Apr 27 '11 at 05:44