Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

c# - MVC Website - ServerGotRequest ServerBeginResponse

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...