4

Possible Duplicate:
Python XMLRPC with concurrent requests

I'm writing a python application which will act as xml-rpc server, using SimpleXMLRPCServer class.

Now my question is: what happens if 2 or more clients send a request at the same time? Are they queued? Do I have the guarantee that if two clients call the same or different functions they are executed one after another and not at the same time?

Community
  • 1
  • 1
Emiliano
  • 22,232
  • 11
  • 45
  • 59
  • The answer depends on a ton of architectural features. Please provide more information on what you're doing. For example, if your server is part of Apache (via mod_wsgi) you have multiple Apache processes each with multiple concurrent wsgi threads, all independent of your application. – S.Lott Feb 17 '11 at 18:56
  • I'm talking about a standalone server with a code similar to this: http://docs.python.org/library/simplexmlrpcserver.html (20.24.1.1). So NOT the CGI implementation (explained in 20.24.2). I'm creating a stand alone server and I even don't have Apache installed. – Emiliano Feb 17 '11 at 19:08

2 Answers2

8

I believe the library implementation of SimpleXMLRPCServer is indeed single-threaded. You have to add a mixin to make it serve requests in a multi-threaded way:

from SocketServer import ThreadingMixIn
from SimpleXMLRPCServer import SimpleXMLRPCServer

class MyXMLRPCServer(ThreadingMixIn, SimpleXMLRPCServer):
    """..."""
Santa
  • 11,381
  • 8
  • 51
  • 64
1

If you just need your application to process XML-RPC requests (more than one at a time if needed) you may take a look at Pythomnic framework.