Python XMLRPC With Concurrent Requests
Solution 1:
I think python SimpleXMLRPCServer module is what you want. I believe the default behavior of that model is blocking new requests when current request is processing. The default behavior gave me lots of trouble and I changed that behavior by mix in ThreadingMixIn class so that my xmlrpc server could respond multiple requests in the same time.
class RPCThreading(SocketServer.ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer):
pass
If I understand your question correctly, SimpleXMLRPCServer is the solution. Just use it directly.
Solution 2:
Can you have another communication channel? If yes, then have a "call me back when it is my turn" protocol running between the server and the clients.
In other words, each client would register its intention to issue requests to the server and the said server would "callback" the next-up client when it is ready.
Solution 3:
There are several choices:
- Use single-process-single-thread server like
SimpleXMLRPCServer
to process requests subsequently. - Use
threading.Lock()
in threaded server. - You some external locking mechanism (like
lockfile
module orGET_LOCK()
function in mysql) in multiprocess server.
Post a Comment for "Python XMLRPC With Concurrent Requests"