How to decrease the page load time in ASP.NET application?

前端 未结 11 600
独厮守ぢ
独厮守ぢ 2020-12-25 08:33

How to decrease the page load time in ASP.NET application? What should be the precautions and specially when we are interacting with databases

e.g.

  1. w
相关标签:
11条回答
  • 2020-12-25 09:30
    1. Never ever Deploy asp.net application under debug configuration on production. Find out here what scottgu has to say about this.

    2. Use Cookie-less domains to serve static resources like images, scripts, styles etc. Each client request is sent along with whole bunch of cookies, you don't need cookies while serving pictures or scripts. So host those resources on a cookie-less domain.

    3. Minify scripts, stylesheets and HTML response from the server. Removing unnecessary line-breaks and white-spaces can improve the time-to-load and bandwidth optimization.

    You'll find many tips from here.

    0 讨论(0)
  • 2020-12-25 09:32

    80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc.

    http://developer.yahoo.com/performance/rules.html

    I'm not suggesting ignore the view state and database caching suggestions in the answers already provided. I'm pointing that for what I've found to be simplier alterations is to go for turning on GZip Compression in IIS, setting expiry headers on static elements to reduce server requests, optimize images using a tool such as smush.it

    Run a report of your site using Zoompf for a very detailed report with estimate impact and easy of implementation ratings.

    0 讨论(0)
  • 2020-12-25 09:33

    You could always trigger an async database action and have the page updated asynchronously - AJAX update panel comes to mind.

    There is also Page Output Caching, useful if the page is largely static. It can also be done based on parameters, so you could potentially cache the page created for a given database search.

    You can also take the over-the-top approach and reduce the "wordiness" of a page. I did this once for fun on a products page by shrinking the names of elements etc, managed to cut over 50% of page size, but it makes the markup entirely unreadable lol

    Along this same route, apply reduction tools to css/javascript files - merge them too if you compress as compression becomes more efficient over fewer larger files.

    0 讨论(0)
  • 2020-12-25 09:35

    There is an interesting article on MSDN with 10 tips to optimize ASP.Net apps. Its at

    http://msdn.microsoft.com/en-us/magazine/cc163854.aspx

    0 讨论(0)
  • 2020-12-25 09:39
    • Cache as much db reads as possible
    • reduce/disable viewstate
    • do less (if possible)
    0 讨论(0)
提交回复
热议问题