Returning hug results
Moderator: General Moderators
Returning hug results
I'm currently developing a web application that handles huge contents. In my main page i have 3 panes, each with different functions to show dynamic results (from a search template).
I have a problem in loading the entire page because it first waits for all of the 3 divisions to be processed before showing their results. I would like to load the first two panes first, cause the last one is not that necessary and has the function that returns the largest result.
Im thinking of using AJAX but is it advisable in this case? Tnx!
I have a problem in loading the entire page because it first waits for all of the 3 divisions to be processed before showing their results. I would like to load the first two panes first, cause the last one is not that necessary and has the function that returns the largest result.
Im thinking of using AJAX but is it advisable in this case? Tnx!
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Returning hug results
You would use AJAX for something like that...although I would suggest pagination as well to minimize the strain on your entire LAMP stack...
Keep it to 25 items per page and it should load just fine.
Keep it to 25 items per page and it should load just fine.
Re: Returning hug results
Thanks for your reply, my code has paging in it, the process is just taking too long i think because of the huge contents. Think of them like short stories, and the div that has the longest loading time is the one that displays the highlighted search results hits per line of the story.
Would ajax assure me that the other divs would load first and won't wait for the slowest div? And my functions are all located on that page, so if i use ajax, should i transfer the function to the server request file? How about its parameters? Im sorry as i just made my first simple ajax app minutes ago. Thanks for your time.
Would ajax assure me that the other divs would load first and won't wait for the slowest div? And my functions are all located on that page, so if i use ajax, should i transfer the function to the server request file? How about its parameters? Im sorry as i just made my first simple ajax app minutes ago. Thanks for your time.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Returning hug results
When you say "huge contents" what size do you mean 1Mb, 10Mb, 100Mb, 1Gb?
(#10850)
Re: Returning hug results
More than 1gb if the database is populated completely, but right now i have more than 50MB and the total time it takes the page to load is 8 seconds (local ftp server). And i could just imagine how long it will take when the database is complete and in a live site.
Re: Returning hug results
I think you need to have another look at the architecture that would require that much data. I would expect that you would exceed allowable string lengths in Ajax responses.
Re: Returning hug results
So ajax responses have max allowable string lengths? Tt would be then harder for me to consider ajax..
Re: Returning hug results
I don't actually know, but a 1GB string length blows my mind.jsky wrote:So ajax responses have max allowable string lengths? Tt would be then harder for me to consider ajax..
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Returning hug results
AJAX is limited by only what GET/POST allow and what the browser implements...I guess
If your sending that much data to the screen for rendering...you absolutely need to re-think your design. If it's the queries which are just taking a long time...how are you retreiving the results???
Are you skipping through each record one bye one or are you dumping the resultset into a native PHP array and then iterating it?
Have you determined where the bottleneck is? Is it your PHP code, PHP memory consumption or maybe the database itself? You could probably optimize the query relatively easily with a little homework and asking questions here in the database forum.
If your sending that much data to the screen for rendering...you absolutely need to re-think your design. If it's the queries which are just taking a long time...how are you retreiving the results???
Are you skipping through each record one bye one or are you dumping the resultset into a native PHP array and then iterating it?
Have you determined where the bottleneck is? Is it your PHP code, PHP memory consumption or maybe the database itself? You could probably optimize the query relatively easily with a little homework and asking questions here in the database forum.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Returning hug results
Wait a second ... is that the size of the whole database, or the size of one record of data sent to the browser for one page?jsky wrote:More than 1gb if the database is populated completely, but right now i have more than 50MB
8 seconds is not that bad for a large page. Having more records will not necessarily make your site any slower. Especially because you are probably using TEXT or BLOB fields which are stored separately from the row, so your rows are probably fairly small.jsky wrote: and the total time it takes the page to load is 8 seconds (local ftp server). And i could just imagine how long it will take when the database is complete and in a live site.
(#10850)
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Returning hug results
Is there even a database field which would hold 1GB???is that the size of the whole database, or the size of one record of data sent to the browser for one page?