SimpleXMLRPCServer performance issue in MSWin
danu kusmana
danu_milis at yahoo.com
Tue Jun 1 03:29:16 EDT 2004
I have sent these scripts on my first email before,
but I send it again. The ServerTest.py is the server
side script that when it is ran on Windows platform it
run very much slower compared when it ran on Linux
platform. I cannot send the captured of the log from
Windows, but I assume you can help me test it so you
can see the different.
The ClientTest.py is the client script that can access
the server.
These scripts is for my thesis about distributed
system by finding prime numbers.
I hope you can help me to explain what causes the
server script run slower in Windows platform.
ServerTest.py:
#! /usr/bin/env python
import SocketServer
from SimpleXMLRPCServer import *
import xmlrpclib
class Metode:
def __init__(self):
self.nilai = 0
def ambil(self):
self.nilai += 1
return self.nilai
def terima(self, NilaiBaru):
return xmlrpclib.True
class ServerTest(SocketServer.ThreadingMixIn,
SimpleXMLRPCServer):
pass
server = ServerTest(('192.168.1.108', 7777))
server.register_instance(Metode())
server.serve_forever()
ClientTest.py:
#! /usr/bin/env python
import xmlrpclib
BilPrima = 0
conn = xmlrpclib.Server("http://192.168.1.108:7777")
def prima(x):
global BilPrima
for TestFactor in range(2, x):
if (x % TestFactor == 0):
break
elif (TestFactor != x - 1):
continue
else:
BilPrima = x
return BilPrima
while(1):
nilai = conn.ambil()
if nilai <= 1000000:
temp = prima(nilai)
if temp == None:
continue
else:
print temp
conn.terima(temp)
else:
break
--- Brian Quinlan <brian at sweetapp.com> wrote:
> danu kusmana wrote:
> > When I ran the server script on Windows platform
> is
> > running very slow. The log printed automatically
> by
> > the SimpleXMLRPCServer class; I assumed, is
> processing
> > every 5 second each process if 1 client connected.
> If
> > 1 more client accessed the time is decreasing half
> of
> > the first. But compared when the server script
> running
> > on Linux is much to slow.
>
> Can't you post some code with timings so we can see
> what data types you
> are using and what the performance difference is?
>
> > Maybe I also forgot mention before that if the
> script
> > running on Windows its only processing 1
> thread/Main
> > thread are being processed, even when 2 or more
> > clients are connected.
>
> SimpleXMLRPCServer is single threaded. If you want
> to create a
> multi-threaded version then create a subclass like
> this:
>
> class ThreadedServer(SocketServer.ThreadingMixIn,
> SimpleXMLRPCServer):
> pass
>
> > Is it the class it self or something else I should
> > have know?
>
> You really aren't providing very much information
> here, so it's hard to
> saw. Trying doing this in Python on your Linux
> machine and on Windows:
>
> import sgmlop
>
> What did that do on each?
>
> Cheers,
> Brian
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
More information about the Python-list
mailing list