Funny xmlrpc / linux problem

Hans Müller HeinTest at web.de
Tue Jun 16 16:41:09 CEST 2009


Hello,

I found a timing problem while playing with the xmlrpx stuff.

I created a very simple server, running on a network node on windows.
The client runs on windows or linux. It runs a very simple test function on the server
which just echos a passed string. The trip time is beeing measured.
When I use a 1024 char test string I get a trip time in the 10-20ms range on windows and linux.
But for small arguments the trip time explodes - why on earth ?!

May be this problem is here off topic and tcp/ip stack related.

Here is the very very simply test server:

#!/usr/bin/python
# -*- coding: cp1250 -*-
# xmlrpc test server

import SimpleXMLRPCServer
import xmlrpclib
import time

# the test function - justs echos the argument
def RunTest(buffer):
	return buffer


print "Starting RPC Server..."

# Create server
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("node01", 10000))
server.register_function(RunTest)

# Run the server's main loop
server.serve_forever()


This is the test client:

#!/usr/bin/python
# -*- coding: cp1250 -*-
# Test for Roundtrip Time xmlrpc calls

import SimpleXMLRPCServer
import xmlrpclib
import datetime

print "started..."


s = xmlrpclib.ServerProxy('http://laptvm:10000')        # place here your server address

for scale in (100240, 10240, 1024, 512, 256, 128, 64, 32, 16, 10, 1):
         print "Checking with", scale
         buffer = "0123456789" * scale
         now = datetime.datetime.now()
         for i in range(10):
                 res = s.RunTest(buffer)
                 if buffer != res:
                         print "data error"
         later = datetime.datetime.now()
         dt = later - now

         print "time for 10 loops: %f" % (dt.seconds + (0.000001 * dt.microseconds))



Some results from my tests here:

started...
Checking with 100240
time for 10 loops: 3.282000
Checking with 10240
time for 10 loops: 0.360000
Checking with 1024
time for 10 loops: 0.078000
Checking with 512
time for 10 loops: 0.047000
Checking with 256
time for 10 loops: 0.046000
Checking with 128
time for 10 loops: 0.047000
Checking with 64
time for 10 loops: 1.985000	' Whats this ?! - smaler packets, more time ?!
Checking with 32
time for 10 loops: 2.000000
Checking with 16
time for 10 loops: 2.000000
Checking with 10
time for 10 loops: 2.000000
Checking with 1
time for 10 loops: 2.000000



Tanks a lot,
Hans



More information about the Python-list mailing list