A variation on what Lee suggested:

* client calls mason page
* mason page spawns child to do the slow processing and returns page
* child writes every ... let's say 20 (or less, if it's slow) results to
cache and
* child updates a cache with the cache keys of each of the result segments,
and keys this cache to the session id, so more than one request would be
allowed to run
* the returned page has a Ajax script that periodically calls another Mason
page that checks the keys cache for result segments that were not loaded and
loads and displays them in the page ( this way you don't have to refresh the
whole 200 records ) and when all the result segments were loaded invalidates
their caches.


Or, if the search is fast but building each of the 200+ items is what takes
so much time, you could cache each of them and refresh the cache for those
that change when you modify the data. I used this for an app. dealing with
bibliographic info: when the data for one item changed, had the app.
regenerate the caches (short info, detailed info, renderings for the most
common bib. styles used) for that item.


On Tue, Jul 8, 2008 at 9:54 PM, Lee Carmichael <[EMAIL PROTECTED]> wrote:

> Hello Michael,
>
> I don't think trying to write the results out over a period a few minutes
> is best. You'll run into server timeouts, clients not receiving enough of
> the page to render and more.
>
> I think your best approach to do the following:
>     * client calls mason page
>     * mason page spawns child to do the slow processing
>     * mason page returns page with key and refresh header
>     * child writes results to a cache with key
>     * client calls new/same mason page with key that reads the current
> results from the cache. Then renders pages with refresh if child is still
> processing.
>
> You may want to read the following articles:
>    * http://www.stonehenge.com/merlyn/LinuxMag/col39.html
>    *
> http://modperlbook.org/html/10-2-Forking-and-Executing-Subprocessesfrom-mod_perl.html#pmodperl-CHP-10-ITERM-4837
>    *
> http://modperlbook.org/html/18-1-Sharing-the-Read-Only-Data-in-and-Between-Processes.html
>
> Randal's article covers this approach with CGI. The next couple detail how
> to share data and fork a process under mod_perl, since they are different
> than doing the same thing with a CGI.
>
> Good Luck,
>
> Lee
>
>
>
>
> ----- Original Message ----
> From: Michael Jensen <[EMAIL PROTECTED]>
> To: Mason List <mason-users@lists.sourceforge.net>
> Sent: Tuesday, July 8, 2008 1:07:41 PM
> Subject: [Mason] Print results in real-time with Mason?
>
> I have a tool that returns over 200 results over the course of a few
> minutes, and so I would like to start printing out results to the
> browser immediately as it processes it. Is this possible in Mason?
>
> -Michael
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users
>
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to