Chrome network Timing , how to improve Content Download

ぐ巨炮叔叔 提交于 2019-12-20 14:12:51

问题


I was checking for XHR calls timing in Chrome DevTools to improve slow requests but I found out that 99% of the response time is wasted on content download even though the content size is less than 5 KB and the application is running on localhost(Working on my local machine so no Network issues).

But when replaying the call using Replay XHR menu, the Content download period drops dramatically from 2.13 s to 2.11 ms(as shown in the screen shots below). Data is not cached at browser level.

  • Example of Call Timing

  • Same Example Replayed

Can someone explain why the content download timing is slow and how to improve it?

The Application is an ASP.NET mvc 5 solution combined with angularJS.

The Web Server Details: - Windows Server 2012 R2 - IIS 8

Thank you in advance for your support!


回答1:


I can't conclusively tell you the cause of this, but I can offer some variables that you can investigate, which might help you figure out what's going on.

Caching

I know you said that the data is not getting cached at the browser level, but I'd suggest checking that again. Because the fact that the initial request takes 2s, and then the repeat request only takes 2ms really does sound like caching.

How to check:

  1. Go to Network panel.
  2. Look at Size column for the request. If you see from memory or from disk cache, it was served from the cache.

Slow development server or machine

My initial thought was that you're doing more work on your development machine than it can handle. Maybe the server requires more resources than your machine can handle. Maybe you have a lot of other programs running and your memory / CPU is getting maxed.

How to check:

  1. Run your app on a more powerful server and see if the pattern persists.

Frontend app is doing too much work

I'm not sure this last one actually makes sense, but it's worth a check. Perhaps your Angular app is doing a crazy amount of JS work during the initial request, and it's maxing out your CPU. So the entire browser is stalling when you make the initial request.

How to check:

  1. Go to Performance panel.
  2. Start recording.
  3. Do the action that causes your app to make the initial request.
  4. Stop recording.
  5. Check the CPU chart. If it's completely maxed out, then your app is indeed doing a bunch of work.

Please leave a comment and let me know if any of these helped.



来源:https://stackoverflow.com/questions/46689410/chrome-network-timing-how-to-improve-content-download

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!