very slow XMLRPCServer

View: New views
4 Messages — Rating Filter:   Alert me  

very slow XMLRPCServer

by David McNab-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm trying to run an XML-RPC server on my ipaq h4100, based on the
python 'SimpleXMLRPCServer', but it's ridiculously slow to process
requests.

Turnaround for even the simplest client requests is around 30-40
seconds.

Can anyone suggest a cause and maybe a remedy?

(source code to test program below)

Thanks if you can help

Cheers
David

-----------------------

from SimpleXMLRPCServer import SimpleXMLRPCServer

def add(x, y):
    """add(x, y): returns the result of adding x to y"""
    return x + y

class MyXmlRpcServer(SimpleXMLRPCServer):

    def __init__(self, *args, **kw):
        SimpleXMLRPCServer.__init__(self, allow_none=1, *args, **kw)
        self.running = 1

    def serve_forever(self):
        while self.running:
            self.handle_request()

    def stop(self):
        """stop(): stops the server"""
        self.running = 0

server = MyXmlRpcServer(("", 8000))
server.register_function(add)
server.register_function(server.stop)
server.register_introspection_functions()

server.serve_forever()



_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce

Re: very slow XMLRPCServer

by Thomas Heller-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David McNab schrieb:
> Hi,
>
> I'm trying to run an XML-RPC server on my ipaq h4100, based on the
> python 'SimpleXMLRPCServer', but it's ridiculously slow to process
> requests.
>
> Turnaround for even the simplest client requests is around 30-40
> seconds.

I don't know if this will help you or not:

I tried to use XMLRPC betweem a small embedded ARM system runing linux
and a Windows PC.  The performance of a client on the PC and a server on
the embedded system was acceptable (~10 requests per second), but the
server on the PC called by a client running on the embedded system was unacceptable:
1 request took around 5 seconds to complete.

I have since switched to jsonrpc instead of xmlrpc which has a
much better performance: around 70 requests per second, in both
directions.

Thomas

_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce

Re: very slow XMLRPCServer

by elwarren :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sounds like this might be dns related.  If the server is doing reverse
lookups (and subsequent timeouts) for every incoming connection it can
be quite slow.  You might want to add local entries the registry on
the ipaq for hostname lookups.  Windows mobile/ce doesn't have an
/etc/hosts file, but it does support an equiv feature in the registry.

There was a tool I used to have and I thought it was call ceHosts to
update entries, but I'm not finding it in a quick google search.  I
did however find a link to a tip on updating the registry directly

http://windowsmobilepro.blogspot.com/2006/04/etchosts-file-equivalent-in-windows.html

Obviously, the same should be done on the server to ensure ip lookups
on your ipaq device are fast as well.  Even if you're connecting by ip
address, the client or server in a tcpip environment may do a reverse
lookup on connections.

Cheers,
Warren

On Mon, May 18, 2009 at 2:06 PM, Thomas Heller <theller@...> wrote:

> David McNab schrieb:
>> Hi,
>>
>> I'm trying to run an XML-RPC server on my ipaq h4100, based on the
>> python 'SimpleXMLRPCServer', but it's ridiculously slow to process
>> requests.
>>
>> Turnaround for even the simplest client requests is around 30-40
>> seconds.
>
> I don't know if this will help you or not:
>
> I tried to use XMLRPC betweem a small embedded ARM system runing linux
> and a Windows PC.  The performance of a client on the PC and a server on
> the embedded system was acceptable (~10 requests per second), but the
> server on the PC called by a client running on the embedded system was unacceptable:
> 1 request took around 5 seconds to complete.
>
> I have since switched to jsonrpc instead of xmlrpc which has a
> much better performance: around 70 requests per second, in both
> directions.
>
> Thomas
>
> _______________________________________________
> PythonCE mailing list
> PythonCE@...
> http://mail.python.org/mailman/listinfo/pythonce
>
_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce

Re: very slow XMLRPCServer

by David McNab-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-05-18 at 16:17 -0500, Warren Lindsey wrote:
> Sounds like this might be dns related.  If the server is doing reverse
> lookups (and subsequent timeouts) for every incoming connection it can
> be quite slow.

Thanks for the lead.

Turns out that was exactly the problem. The address_string() method in
BaseHTTPRequestHandler does a .getfqdn with each logging call.

I worked around it by overriding .log_message().

Result is that my XML-RPC filesystem is now working, and I can now
'mount' my iPaq into my Linux filesystem via WLAN.

Cheers
David



_______________________________________________
PythonCE mailing list
PythonCE@...
http://mail.python.org/mailman/listinfo/pythonce