[Twisted-Python] Use of twisted as web app core
Hi there, I am trying to evaluate the possible use of twisted as the event framework around which my web app will hang. I would like my app to be run under mod_fastcgi as I like the process control this brings as well as the automatic load balancing across processes. I would also like to use the spread communication toolkit (not twisted spread) to act as a control console to be able to send messages such as "flush cache" to all active processes, even if they are on multiple machines. This asynchronous requirement seems ideal for twisted as both of these mechanisms use sockets or file descriptors for communication. The questions I have are: fastcgi communicates by using the stdio stream as a socket. Is there a way in twisted of treating a fd number as is it were a socket? Has anyone written a fastcgi protocol object? I have looked at the fcgi.py (http://alldunn.com/python/fcgi.py) project and it seems like the project should be relatively easy to port. Has anyone used spread with twisted? I think you can use select to see if there is a message waiting, but then you have to use the spread api to actually access the message. Is twisted the way to go or should I use the simpler code of asyncore (although I have heard bad things about that) Cheers, Ben
Ben.Young@risk.sungard.com wrote:
fastcgi communicates by using the stdio stream as a socket. Is there a way in twisted of treating a fd number as is it were a socket?
twisted.internet.stdio
Has anyone used spread with twisted? I think you can use select to see if there is a message waiting, but then you have to use the spread api to actually access the message.
That is unlikely to work, unless spread actually does non-blocking reads and is happy to receive messages in multiple reads.
On Fri, 11 Feb 2005 18:11:53 +0200, Tommi Virtanen
Ben.Young@risk.sungard.com wrote:
fastcgi communicates by using the stdio stream as a socket. Is there a way in twisted of treating a fd number as is it were a socket?
twisted.internet.stdio
Has anyone used spread with twisted? I think you can use select to see if there is a message waiting, but then you have to use the spread api to actually access the message.
That is unlikely to work, unless spread actually does non-blocking reads and is happy to receive messages in multiple reads.
What about just running the spread client via deferToThread and schedule how often it runs with LoopingCall? The callback could set some stateful variables based on the results. Chris
participants (3)
-
Ben.Young@risk.sungard.com
-
snacktime
-
Tommi Virtanen