From: <mod...@li...> - 2005-04-07 03:37:21
|
A: > xmlBlaster and Activ MQ's HTTP for asynchronous notification either > require polling or a proxy that can accept connections across the > firewall. The beauty (and scariness) of mod-pubsub's approach is the > use of streaming HTTP to keep connections persistent so no polling and > no proxy needed. At what level of granularity is polling not required? The reason I ask is that the Python pubsublib client very much uses polling: while 1: asyncore.poll(scheduler.timeout()) # print "\n\n asyncore.poll \n" scheduler.run() Going back to the original question I had, this is the core of the problem since the while loop is very much blocking and is processor intensive. From the original Medusa documentation on asyncore, I offer the following quote: "Now that you know what select() does, you're ready for the final piece of the puzzle: the main polling loop. This is nothing more than a simple while loop that continually calls select() with a timeout (I usually use a 30-second timeout). Such a program will use virtually no CPU if your server is idle; it spends most of its time letting the operating system do the waiting for it. This is much more efficient than a busy-wait loop." Hence the solution was to do just this: replace the while loop with the loop() command which is much more CPU-friendly. asyncore.loop() Anyone interested in embedding the client in a larger python project will likely need to do this. Ultimately, this is a more efficient implementation and should probably be merged into the code base. Do you want a patch? Brian -- ==== brian lee dae yung biomimetic art and research mux space . com ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. |