Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My website is using top menu loaded from db.Ajax. I noticed that my page is loading slow (over 6 sec). I am using asp.net mvc3 and sql server 2008r2. Any ideas ?
Posted

Just some additions to Stephen Hewison's answer:

  • At first run the code is "just in time" compiled to native code, this takes time. During development this happens often
  • When deployed, the time to wake up an apppool takes also time
  • IE is doing more synchronously the javascript processing than chrome for example, thus you should check with different browsers to see
  • You can use Fiddler, IE9+ development toolbar (and other tools) to profile not only DOM manipulation but also network activity. Thus you could get an idea on which side the latency is.
  • De development environment has rarely the same performance than a production server. So server side execution time will highly depend on the infrastructure beneath
  • You might need query optimization and/or index optimization
  • Many things depend on the data access technology you use. EF is fast in general, but you could check it directly with LinqPad for example.
  • If you get your data as json, and you get much data at once, json parsing and DOM manipulation can take considerable time, you can try to optimize how many data you fetch at once
  • You can trick the client side to do the ajax call as soon as possible by fetching data in the head section, but displaying it only after the DOM is ready.
 
Share this answer
 
v2
Without going through all your code, which I don't think would be appropriate on a forum.

There's no way to answer that directly.

But... Telling you how to find the answer is a bit easier.

Profiling is your friend. Using profiling tools I recently slashed the load times for an application by 50%.

If you have Visual Studio Premium or Ultimate editions you have access to the Analyze menu. This includes a number of tools which will show you the amount of time spent executing each bit of your code.

If you don't you can download the evaluation version Ants Profiler from RedGate. But please buy it if you find it useful.

Often delays are also a result of slow SQL queries. Using SQL management studio you can look the execution plan for any given SQL query.

The execution plan will show you the operations being execute to generate the results. Look up each operation type and find out which ones are good, which ones are back and how to improve them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900