Not only that, it consumes a webware thread that could be used for other requests.

All in all, that implementation was flawed.

I've got a new implementation that solves both of these problems, but I can't seen to get in to the wiki to post it. The basic idea, though, is to move the work from the server to the client. The client, running the javascript, will wait for some amount of time and then call ajax_response() on the server. The server will see if anything is available for that client. If not, ajax_response() can return immediately and wait for the next connection from a client. To avoid any synchronization of client connections to the server, the wait period on the client side is not constant (random between 3 and 8 seconds). Also, the server can send back what the timeout should be until the next connection. This will allow the server control how often the client connects (maybe depending on the page the user is looking at).

In the short term, by adding a time.sleep(2) to the current implementation of ajax_response(), you can avoid all CPU cycles being consumed.

--John

Geoffrey Talvola wrote:
I just tried out the AjaxSuggest example servlet that was added to
Subversion last month.  It works, but unfortunately it seems to gobble up
100% of the CPU.

It looks to me like the problem is in the ajax_response method of AjaxPage.
It uses an inefficient polling loop; instead, it needs to use a
threading.Event or Queue or something along those lines that it can
efficiently wait on.

- Geoff


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

______________________________________________________________________
This e-mail has been scanned by MCI Managed Email Content Service, using 
Skeptic(tm) technology powered by MessageLabs. For more information on MCI's 
Managed Email Content Service, visit http://www.mci.com.
______________________________________________________________________




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to