Pin pointing website slowness
At work I've got an issue with a website I've been working on and it's got me a bit stumped. It's an Microsoft MVC 2 site running on IIS6 on Windows Server 2003 against a SQL Server database thats on a different server.
The issue presents itself as extreme slowness when trying to log in, I wrote a quick script to call the log in page 100 times and the times varied between 3 seconds and 14 seconds, but it was rather erratic.
I've ran sql profiler while performing the log in and the behaviour is you'll hit submit, a second or too will pass, you'll see the sql profiler log the connection then execute the sql in milliseconds then a couple of more seconds pass before being redirected.
As a sanity check we deployed to another server on a cloud hosting service that we have access too and the site performs speedily, the same login script x100 the full request consistently takes 1-2 seconds.
So just to run through everything we've ruled out:
It's not the server hardware as the processor and memory use is hardly anything. It's not the bandwidth as once connected to Sql Server the scripts that execute sequentially are very fast. It's not the Sql being execute or any indexing issues, the sql executes very quickly.
At this stage it feels like a problem with how the application is making op开发者_JAVA技巧ening and closing the initial connection to sql server. Like the handshake between servers is taking up all the time, because once connected the interaction with the database is very fast.
I just cant figure out what the difference between this server and the cloud server where it runs fine would be.
Any suggestions of tools or tests i could perform would be extremely appreciated.
Thanks.
Try using something like Red Gate Ants Profiler - it'll show you timings of all the managed code (even the Framework stuff you don't have source for - just make sure you choose the filter to show it). (The trial should work fine).
This should give you an idea if the time is spent on the managed-side. If it's not, it'll be harder to track down, but here's a few ideas:
- DNS
- Authentication (could it be authenticating externally, like against a domain controller?)
- Network connection between servers
- Failing to connect with one protocol, falling back to another (Firewall?)
- LLMNR?
Hope this helps
精彩评论