[Twisted-Python] Fast RPC
ww at groovy.net
Sat Jul 2 15:37:24 EDT 2005
It looks like this has come up once or twice on the list under the
guyse of "how do I make synchronous calls to PB from another
application" with no clear answer. It seems to be hard to do
because of the design of PB. Use XMLRPC is the usual response.
Here's the situation. I have an embedded python interpreter
running inside of Yate. Because of the way Yate deals with
threads and signals, it seems to be hard to get a twisted
reactor to run inside the embedded interpreter. I also have a
twisted process that wraps an API around a database and
exposes it over XMLRPC and PB. The embedded interpreter needs
to get at various bits of data by making RPC calls to this API.
Using XMLRPC works. But it is very slow. Especially since
xmlrpclib wants to make a new TCP connection for each call.
Using a test PB client, PB calls are much faster, since
there is a persistant TCP connection and simpler encoding.
I have toyed with the idea of using Sun RPC or something
similar to have the embedded interpreter talk to a local
twisted process that then would talk over the network, and
perhaps this is not a bad option.
Any suggestions for a way to make RPC calls over the network
with the speed of the PB and the synchronicity of XMLRPC?
More information about the Twisted-Python