ringerce
2006-Sep-06 13:18 UTC
Problems with large amounts of data using prototype''s Ajax.Updater class
I have a asp page that generates about 1200+ records of data. When I take the results and insert them into my container div using the Ajax.Updater class the browser crashes or if it does load the browser operates *VERY* slow. I tried to chunk the data out into smaller amounts but I still get the same results. Is this fixable or am I just trying to do too much with AJAX? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
ringerce
2006-Sep-06 13:20 UTC
Problems with large amounts of data using prototype''s Ajax.Updater class
I have a asp page that generates about 1200+ records of data. When I take the results and insert them into my container div using the Ajax.Updater class the browser crashes or if it does load the browser operates *VERY* slow. I tried to chunk the data out into smaller amounts but I still get the same results. Is this fixable or am I just trying to do too much with AJAX? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Ryan Gahl
2006-Sep-06 14:48 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
It''s probably not that your trying to do too much with AJAX, there''s just probably a more efficient way to implement your particular page/functionality than what you''re doing. Having said that, we really like live demos here... put the problem page up somewhere and send us the link so we can dissect it for you. On 9/6/06, ringerce <cringer-FHbQlL4gZshBDgjK7y7TUQ@public.gmane.org> wrote:> > > I have a asp page that generates about 1200+ records of data. When I > take the results and insert them into my container div using the > Ajax.Updater class the browser crashes or if it does load the browser > operates *VERY* slow. I tried to chunk the data out into smaller > amounts but I still get the same results. Is this fixable or am I just > trying to do too much with AJAX? > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-888-919-8700 x2903 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
ringerce
2006-Sep-06 21:55 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Well, the problem with that is that the application that I''m building is mean''t for internal use only and it would be against my companies policies to make it public. I''m really not doing anything outside of the box here. My page does return a lot of html and I think the browser just runs out of memory. It seems to crash when the DOM parser comes into play. Here is the function I wrote though to update my container. Maybe you''ll see something unusual: function ajaxUpdater(mForm,mUrl,mMethod,outputObj) { var params = ''''; if(mForm) { params=customSerializer(mForm)+''&time=''+currentTime(); } else { params = ''?time='' + currentTime(); } var ajax = new Ajax.Updater({ success: outputObj},mUrl,{ evalScripts:true, method: mMethod, parameters: params, onFailure: function(response) { reportError(response.responseText); } }); } ------------------------------------------------------------------------------------------ and I call it like so ------------------------------------------------------------------------------------------ ajaxUpdater('''',''viewer.asp'',''get'',''contentPanel''); ------------------------------------------------------------------------------------------ Pretty simple. Lemme know if you spot anything unusual. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Ryan Gahl
2006-Sep-07 02:05 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Hmm, nothing strikes me. A 1200 row table shouldn''t be that big of a deal (couple of seconds to render maybe depending on table and cell data sizes, but then it should all be good), unless maybe you''re attaching event handlers to every row/cell/element or something like that upon render, in which case I''d say employ a lazy loading technique to delay event wiring until the last possible moment, depending on the event. Investigate how many actual objects you''re creating in memory during each stage of the request/render sequence (remember event handlers take memory too)... try to eliminate anything unnecessary. And also, is this happening the first time the data is loaded or only during subsequent requests (in which case I''d say you have a memory leak to sniff out)? So many things to think about :-) Of course 1200 rows x 30+ columns x 1kb data per cell would be big... lol. You may just have to resort to paging your data (although I''m assuming this option has already been discussed and for whatever reason there is a requirement that all 1200+ rows be served at a time). It''s just hard to say what your problem is without seeing something. I mean, it could even be your machine or network for all we know. Anyway, sorry I have nothing more profound to say than that... On 9/6/06, ringerce <cringer-FHbQlL4gZshBDgjK7y7TUQ@public.gmane.org> wrote:> > > Well, the problem with that is that the application that I''m building > is mean''t for internal use only and it would be against my companies > policies to make it public. I''m really not doing anything outside of > the box here. My page does return a lot of html and I think the browser > just runs out of memory. It seems to crash when the DOM parser comes > into play. > > Here is the function I wrote though to update my container. Maybe > you''ll see something unusual: > > function ajaxUpdater(mForm,mUrl,mMethod,outputObj) { > var params = ''''; > if(mForm) { > params=customSerializer(mForm)+''&time=''+currentTime(); > } else { params = ''?time='' + currentTime(); } > var ajax = new Ajax.Updater({ > success: outputObj},mUrl,{ > evalScripts:true, method: mMethod, parameters: params, > onFailure: function(response) { > reportError(response.responseText); > } > }); > } > > > ------------------------------------------------------------------------------------------ > and I call it like so > > ------------------------------------------------------------------------------------------ > ajaxUpdater('''',''viewer.asp'',''get'',''contentPanel''); > > ------------------------------------------------------------------------------------------ > Pretty simple. Lemme know if you spot anything unusual. > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-888-919-8700 x2903 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Sam Foster
2006-Sep-07 04:01 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
ringerce wrote:>Well, the problem with that is that the application that I''m building >is mean''t for internal use only and it would be against my companies >policies to make it public. I''m really not doing anything outside of >the box here. My page does return a lot of html and I think the browser >just runs out of memory. It seems to crash when the DOM parser comes >into play. > > >So, have you tried just loading up the data in its own page? Rendering a big table taxes the brower - especially IE. That would give you something to compare it with. Also, look at your table code - it should render faster with explicit column widths. I had to troubleshoot a similar problem recently where it turns out a customer was sending 5MB of html tables over the wire and it was freezing up the browser for minutes at a time. That code also happened to have inline event handlers (onmouseover etc) in it. (I actually tried removing those and using a single event handler and event.target filtering to get the same effect, bit counter-intuitively it didnt really have much effect on overall performance.) With large amounts of data, every little inefficiency is magnified - so check all your tags are closed properly, remove unnecessary markup, validate etc.> var ajax = new Ajax.Updater({ > success: outputObj},mUrl,{ > evalScripts:true, method: mMethod, parameters: params, > onFailure: function(response) { > reportError(response.responseText); > } > >Are you actually sending script along with this data? If not, set evalScripts: false and you should see a big speed up. Oh, and check with a fresh browser each time, and keep any eye on your task manager / CPU - if you are leaking memory anywhere, your testing can be skewed by previous versions of the page having crippled your browser. Another thing: debugging. If you are writing debug statements to the same DOM you are trying to measure performance with its going to slow down. Even console.log in Firebug drags appreciably. I''ve also found that render time and network latency arent as seperate as youd like them to be. If latency increases, overall performance can decrease in a non-linear way. hth Sam (-i-am) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
ringerce
2006-Sep-07 13:58 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Thanks for the input fella''s. Mucho appreciation. To answer some of your question: - This is happening when the page first loads and not on subsequent page loads. - I do have some onClick even handlers assigned to href''s in my markup but right now I haven''t attached anything to them as you can see below. I checked IE''s memory usage at runtime it''s at a whopping 150mb .. yikes ... - I do have some js that''s need to be evaluated on that page. I suppose I could break up the page into seperate AJAX calls and just load the data table seperately since it doesn''t contain any js that needs to be evaluated. - Also, I can replicate the problem in all browsers pretty much. IE, Firefox, safari, opera ... Let me show you what the resulting HTML output would be. I''m not using tables. <div id="comment_1"> <div class="tRowHeading bg1"> <div class="float-Left"> <span class="fs12b">beta1</span><br/> <span class="fcdgray">Approved: </span><strong>No</strong><br/> <span class="fcdgray">Resolved: </span><strong>Yes</strong> </div> <div class="float-Left pt6"> <span class="tCell_aligned">Screen: </span> <span class="fs12b">010000000010</span><br clear="all"/> <span class="tCell_aligned">Assigned To: </span> <span class="fs12b">Justin Bailey</span> </div> <div class="dtStamp"> <span class="fcdgray">Last Updated: </span><strong>1/22/2006 7:41:00 AM</strong> </div> </div> <div class="tRow bg1"> <h1>Comment</h1> <div class="tCell"><a onClick="" href="#" class="btnAddComment"><span>Add Comment</span></a></div> <div class="tCell"><strong>Jon Doe</strong><br/>3/10/2006, 12:09:52 PM</div> <div class="tCell c3"><p>wish that at the end of the session you had an option to continue with the next lesson or go back to the table of contents. <BR>Might want to consider having a check box next to the lessoon on the TOC when you have completed that lesson, so its easier to click on the next one that you want. n</p></div> <br clear="all" /> <div class="hr"><hr /></div> <h1>Interal Actions</h1> <div class="tCell"><a onClick="" href="#" class="btnAddComment"><span>Add Comment</span></a></div> <div class="tCell"><strong>Jon Doe</strong><br/>3/10/2006, 12:09:52 PM</div> <div class="tCell c3"><p>Menu will be in place for Beta 3 release and should resolve this issue.</p></div> <br clear="all" /> </div> </div> --------------------------------------------------------------------- So that''s one row of data. All that x1200 is a lot of markup to display. I''ve already implemented the paging system and I think I''m going to create an "EXPORT ALL RECORDS TO EXCEL" or something like that so they can have what they want. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
ringerce
2006-Sep-07 14:03 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Oh, also one more thing. I did try loading the page outside of my AJAX framework by itself. The page still performs slowly on it''s own and still crashes sometimes. If I remove my stylesheet then it loads fine and operates smoothly. Just food for thought. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Ryan Gahl
2006-Sep-07 14:52 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Well then, looks like you''ve isolated the bottleneck. Next step: optimize your stylesheet :-) Also, just a nit picky thing (take with a grain of salt), but you really shouldn''t be sending A tags (or any tags for that matter) with onClick="". I (and most people in this list) recommend getting into the habit of attaching behavior outside of the markup. But even moreso, rendering empty attributes is just bad form (offers no symantic meaning). I''m not saying that necessarily has anything to do with your performance issues (especially if you say that removing the stylesheet solves that)... just something to think about. On 9/7/06, ringerce <cringer-FHbQlL4gZshBDgjK7y7TUQ@public.gmane.org> wrote:> > > Oh, also one more thing. I did try loading the page outside of my AJAX > framework by itself. The page still performs slowly on it''s own and > still crashes sometimes. If I remove my stylesheet then it loads fine > and operates smoothly. > > Just food for thought. > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-888-919-8700 x2903 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Sam Foster
2006-Sep-08 04:04 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
ringerce wrote:>Oh, also one more thing. I did try loading the page outside of my AJAX >framework by itself. The page still performs slowly on it''s own and >still crashes sometimes. If I remove my stylesheet then it loads fine >and operates smoothly. > >I''ve had this kind of trouble before with a floated layout. I think floats are hard work to render. Try it (just for kicks if the idea is offensive) in a table and see if it improves. I''m a css layout fan, but this is part of the trade-off - you leave a lot for the browser to calculate as it draws the page. Sam (-i-am) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
Ryan Gahl
2006-Sep-08 13:29 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
Plus tables are great for tabular data. Not sure why people think any use of tables is offensive. Tables for general layout, yes it''s wrong, for simple tabular data display, not a problem and usually the correct choice over any alternative. On 9/7/06, Sam Foster <sam-WNdku5qRq3FWk0Htik3J/w@public.gmane.org> wrote:> > > ringerce wrote: > > >Oh, also one more thing. I did try loading the page outside of my AJAX > >framework by itself. The page still performs slowly on it''s own and > >still crashes sometimes. If I remove my stylesheet then it loads fine > >and operates smoothly. > > > > > I''ve had this kind of trouble before with a floated layout. I think > floats are hard work to render. Try it (just for kicks if the idea is > offensive) in a table and see if it improves. I''m a css layout fan, but > this is part of the trade-off - you leave a lot for the browser to > calculate as it draws the page. > > Sam (-i-am) > > > > >-- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-888-919-8700 x2903 Blog: http://www.someElement.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---
ringerce
2006-Sep-08 13:50 UTC
Re: Problems with large amounts of data using prototype''s Ajax.Updater class
The data that I''m outputting has some fancy styling so with tables I''m just creating an unmangable mess for myself. Anyway, I''ll try and create a simple table version of my layout and see what happens. Be back later. I cringe to type "<table>". --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~----------~----~----~----~------~----~------~--~---