Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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. wise use of viewstate
  2. Set in web.config when deploying the app

    etc

like image 780
Azhar Avatar asked Jun 30 '10 11:06

Azhar


4 Answers

Some of the key "take-aways" from TechEd 2010 North America:

  • Caching is key to performance, consider your caching strategy very carefully.
  • Disable viewstate if possible.
  • Set <compilation debug=”false"> in web.config when deploying the app.
  • Consider CDN's or subdomains for graphics and other static content.
  • Place javascript at the bottom of the page, CSS at the top.
  • Consider CSS sprites for icons and other "small" graphics.

You can watch the sessions online here, they're both highly recommended:

  • My Web Site Is So Slow...and I Don’t Know What to Do about It! with Thomas Deml
  • Web Load Testing with Microsoft Visual Studio 2010 with Richard Campbell
like image 183
Jakob Gade Avatar answered Oct 20 '22 10:10

Jakob Gade


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.

like image 30
Duncan Avatar answered Oct 20 '22 12:10

Duncan


  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.

like image 3
this. __curious_geek Avatar answered Oct 20 '22 10:10

this. __curious_geek


  • Try to minimize ViewState as much as possible or keep it on the server
  • Use caching of data or portions on your page by using outputcaching of user controls
  • Bundle scripts and css as much as possible

Always measure after you refactored something to see if it makes a difference.

Also please take a look here for more information.

  • Improving ASP.NET performance from Microsoft Patterns & Practices.

Grz, Kris.

like image 2
Kris van der Mast Avatar answered Oct 20 '22 12:10

Kris van der Mast