问题
Been building a website in MVC 5, Framework 4.6.1. but I'm having a problem with the loading speeds.
After running fiddler (never used it), i found the delay is between ServerGotRequest and ServerBeginResponse, and this is running in localhost.
Request Count: 1
Bytes Sent: 545 (headers:545; body:0)
Bytes Received: 6,263 (headers:428; body:5,835)
ACTUAL PERFORMANCE -------------- ClientConnected: 16:24:37.533
ClientBeginRequest: 16:24:37.533
GotRequestHeaders: 16:24:37.533
ClientDoneRequest: 16:24:37.533
Determine Gateway: 0ms
DNS Lookup: 0ms
TCP/IP Connect: 0ms
HTTPS Handshake: 0ms
ServerConnected: 16:24:37.535
FiddlerBeginRequest: 16:24:37.535
ServerGotRequest: 16:24:37.535
ServerBeginResponse: 16:25:50.469
GotResponseHeaders: 16:25:50.469
ServerDoneResponse: 16:25:50.469
ClientBeginResponse: 16:25:50.469
ClientDoneResponse: 16:25:50.470
Overall Elapsed: 0:01:12.937
RESPONSE BYTES (by Content-Type) -------------- text/html: 5,835 ~headers~: 428
I'm at a loss as to why this is happening :| this happens in Debug and in Release mode.
Any suggestion on where to look for the cause?
回答1:
This is quite a performance issue.
ServerGotRequest
is telling you that the request from the client to the server has been received and the server is going to start processing your request.
ServerBeginResponse
is telling you that the server has been processing your request and is now finished and is beginning to send the response stream back to the client.
What is happening in between is anybody's guess and you won't get a good answer from the group on this one since you haven't included code or even an explanation as what your application is trying to do.
There are some tools you can use to try to narrow it down.
You can enable tracing: https://msdn.microsoft.com/en-us/library/0x5wc973.aspx You can implement glimpse: https://www.nuget.org/packages/glimpse
Or if you're using MVC (I assume you are) then simply comment out everything in your action and see what that does to performance then uncomment your code one or two lines at a time until you find the offender.
I'm guessing you discover a slow DB stored proc, calls to the database inside of a loop, multiple nested loops, or a combination of any of the three above.
Good luck!
来源:https://stackoverflow.com/questions/35729292/mvc-website-servergotrequest-serverbeginresponse