Results 1 to 20 of 20

Thread: Webpage speed issues

  1. #1

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Webpage speed issues

    hi Guys,

    I have a fairly big aspx page. 2468 lines of markup. 2057 lines of code in the code behind.

    I'm using an ajaxcontroltoolkit TabPanel. I have 7 tabs in total. In 4 of the tabs I have gridviews which are in UpdatePanels.

    For editing records I have a Formview control in an updatepanel.

    Each updatepanels Updatemode = Conditional.

    I was using the ajaxcontroltoolkit ModalPopupExtender. I thought that was the culprit because it takes like 10 seconds to popup on the clients pc.

    I changes over to JQuery dialog over the weekend. On my pc the jquery dialog pops up instantly and it takes roughly 1.3 - 2 seconds to go back to the server and populate the formview with the record to update.

    Clicking the save button takes roughly 1.5 seconds.

    Now I uploaded the page to the clients live server and when i do the exact same thing it takes 8.5 seconds

    I've been trying to implement a fix for months but nothing is working for me. I tried disabling viewstate on the gridviews etc but i still have the issue.

    I uploaded a test page with just a single gridview and formview in updatepanels and it takes 1.5 seconds to popup and go back to the server.

    I'm led to believe it's the size of my page that is an issue then. I don't have the best spec pc but even when I am changing the markup in visual studio on this particular page it freezes for 2 seconds before i can get the intellisense to popup.

    Please help me here. I thought the jquery way would work but i'm back to square one

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Hello,

    In order to figure out what is taking so long, and there are a number of tools that can do this for you.

    The first is YSlow:

    http://developer.yahoo.com/yslow/

    This will tell you if anything on your page is taking a long time to download to the client.

    From there you could enable ASP.Net Trace which will allow you to see which methods on the server are taking a long time to execute. You could also "instrument" your code, i.e. add logging, which would allow you to figure out what is taking a long time.

    Gary

  3. #3
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    5,951

    Re: Webpage speed issues

    I think your problem is not with Jquery as (correct me if i'm wrong) you don't manipulate any data with Jquery and a web service.
    I think your problem is with the data transaction.You said you uploaded a test page and it works fast.So i think that the problem may be with the original data transaction.
    How exactly are you doing the transaction?Is the db server on you local machine and you test it there and after that you test it on a remote live db server?
    How are you passing your data?Are you using SqlDataSource?On the test you did, you passed the record to the server as you would pass it on the real page?I mean you passed one record but in the real page you use a more complex query?
    It would be nice to show us one of the ContentTemplates markup for one gridview.
    .

  4. #4
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Webpage speed issues

    I think first it's important to isolate where the main problem/s are.

    Is it a file size issue - the html document size + js + css + images etc.
    Is it a code issue - tracing will give the breakdown of time to complete page events

    As a test you can copy the page source from the browser and paste it into a html file and upload that to the server. When you view that page if it's fast then you know it's the code.

    If the jquery callbacks are slow then you can use tracing on the webmethods to see how they are performing.

    You can also try viewing in a different browser, if you use IE try Firefox and if there is a difference you may have some bad tags, script the IE glitches on.

    Lastly it could be a server load issue. If the sites on shared hosting then the initual request and subsequent callbacks may be impacted by the host sharing the bandwidth over all sites and or sharing server/network/database resource between sites. If you rule out everything else then maybe a premium hosting plan with limited sites on the server is an option.

    Gook luck
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  5. #5

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    thanks all. it seems related to page size and the update panels. I copied the exact same page. Removed 4 of the 7 tabs. and now it takes 4.7 seconds to load the popup.

    Yslow gives me these stats on the original page:

    Code:
    HTTP Requests - 57
    Total Weight - 502.0K
     
    	1	HTML/Text	71.1K
     
    	22	JavaScript File	334.7K
     
    	7	Stylesheet File	15.3K
     
    	1	Flash Object	58.0K
     
    	9	CSS Image	4.2K
     
    	15	Image	16.4K
     
    	1	Favicon	1.6K
     
    	1	XMLHttpRequest	0.3K
    how can I achieve what I am doing without an updatepanel. I need to populate the formview inside the jquery modal popup. then if a user saves the gridview must be refreshed via ajax. please help

  6. #6

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    hey guys, i'm at my wits end here. tried almost everything. I added this to my webconfig so embedded js files like the ajaxcontroltoolkit ones get compressed and cached:

    Code:
     <system.web.extensions>
        <scripting>
          <scriptResourceHandler enableCompression="true" enableCaching ="true"/>      
        </scripting> 
      </system.web.extensions>
    I found a class that allows me to compress viewstate. I got at most a second quicker.

    I noticed the CPU usage hits 100% when the updatepanels.update method is called. Gary asked me to check that out in a previous post but I never noticed it at that time. please help me

  7. #7
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Webpage speed issues

    Looking at the Yslow stats (image and swf aside) the JS file is the the bulk of the initual download. From what I read asp.net ajax (update pannels) are renowned for being slow, especially when they have lots of controls in them.

    I would get a thrid party gridview control that does what you want. Maybe the same for the form if your not wanting to script that.

    For jquery tabs etc I use jquery tools (http://flowplayer.org/tools/). It's free, easy and packs alot of punch in one library
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  8. #8

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    hey brin351. thanks for the link. That looks so awesome. I wish I had come across it when i started this project. I'm a bit worried to change now as the client is getting anxious

  9. #9
    Frenzied Member brin351's Avatar
    Join Date
    Mar 2007
    Location
    Land Down Under
    Posts
    1,293

    Re: Webpage speed issues

    The page you describe is complex, perhaps the client can accept what improvements you can make as it is with a view to a rebuild with different technology in the future..... OR instead of packing so much into 1 page split it accross several, it is a web form not a win form after all.
    The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.

  10. #10

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    now i've really tried everything. Removed all whitespaces in my aspx page but still takes 8 seconds on the live site. Compressed Viewstate. set enableviewstate to False for all controls that don't need it like Labels. Set the required properties of the ToolKitScriptManage like CombineScripts etc:

    Code:
    ScriptMode="Release" LoadScriptsBeforeUI="false" EnablePartialRendering="true" EnablePageMethods="true" EnableScriptGlobalization="true" EnableScriptLocalization="true" CombineScripts="true"
    problem is I don't know any other way of loading a Formview and then updating the gridview in an ajax manner

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,173

    Re: Webpage speed issues

    Start Fiddler2 and have it running when you do your AJAX/JQuery postbacks. It's probable that you're transferring too much data when all you need is something simpler.

    You've also got too many controls on your page and should consider using separate pages instead of separate tabs on the same page. After a certain point, your optimizations aren't going to be worth it if the context in which you're working has been overloaded.

  12. #12
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Nitesh,

    Is it possible that you can provide a sample application that shows these problems, or are you able to point us at the live site to take a look at?

    Gary

  13. #13
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Hello,

    Just had a look at a few things, and I suspect that the problem is to do with the fact that every single tab is already populated on the page, even if they are not visible.

    During the partial post back to the server, are the methods for populating these tabs being called? You should be able to verify this by enabling trace on the website.

    I suspect that this might be the issue that you are seeing.

    Gary

  14. #14

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    thanks so much gary. I appreciate you taking the time to have a look. All the tabs are populated on form load. I have objectdatasources hooked up to all those grids, they use the querystring parameter for the select statement.

    I'm not sure if they would be repopulated on every partial postback. If they are what can i do to change that? Please let me know how to enable trace. I know I have to do it at page level, i tried last week but I don't know where to go to view the trace information.

  15. #15
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Hello,

    In order to trace through to see what, if anything is being called, you can use some of the events of the ObjectDataSource, i.e the Selecting, Updating events, etc. You could put some log statements in here to see when it is getting called.

    Rather than loading them up every time the form loads, you could have them load in the click of a tab item.

    You can either switch trace on so that it always shows, or, after viewing a page you can load up trace.axd to see the results.

    Have a look here for a complete set of documentation:

    http://msdn.microsoft.com/en-us/libr...(v=vs.71).aspx

    Gary

  16. #16

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    thanks gary,

    will try and post back

  17. #17

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    hey Gary,

    I found this neat little extender:

    http://www.imaginativeuniversal.com/...y-Loading.aspx

    Using this I am able to set the objectdatasource's select parameter on the server side event, rebind the gridview and update the updatepanel.

    It works great. I only did it for one tab so far but hardly any speed improvements. Also, using this method will rebind the grid etc, each time the tab is selected

  18. #18
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Hello,

    Sounds like this should definitely help out.

    To test that this is indeed part of the speed issue, you could always remove all of the tabs, leaving just one, and see how long that takes to load the page. Then, you could gradually add them back in, one by one, to find out which one is taking the longest.

    Gary

  19. #19

    Thread Starter
    PowerPoster Nitesh's Avatar
    Join Date
    Mar 2007
    Location
    Death Valley
    Posts
    2,556

    Re: Webpage speed issues

    Quote Originally Posted by gep13 View Post
    Hello,

    Sounds like this should definitely help out.

    To test that this is indeed part of the speed issue, you could always remove all of the tabs, leaving just one, and see how long that takes to load the page. Then, you could gradually add them back in, one by one, to find out which one is taking the longest.

    Gary
    hey Gary,

    Tried that approach the whole morning. Unfortunately there is not musch difference. The popup always takes about 7-8 seconds to populate. The problem is the Updatepanels. The CPU usage shoots up to 100%. However, I don't know of any other way to populate a popup and update a gridview without a refresh, other than using updatepanels back to square 1

  20. #20
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Webpage speed issues

    Hello,

    Ok, so there are still two things left in order to see what is going on.

    Firstly, open Fiddler and watch what HTTP Traffic is going on. What is taking a long time?

    Next, if you haven't already, enable Trace on your page. If it is a server method that is taking a long time to return, then Trace will show you where the bottle neck is.

    Gary

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width