jes at nl.demon.net
Fri Nov 4 18:15:22 CET 2005
In article <dkfqhb$l1l$1 at opal.futuro.pl>, Skink <spam at me.please> wrote:
>I'm preparing a python server that sends java classes and resources to
>custom java class loader. In order to make it faster I don't want to use
>URLClassLoader that uses HTTP protocol 1.0 and for each class/resource
>creates own connection.
>Instead I'd like to use raw sockets with simple protocol:
> - class loader sends a line terminated with \n with resource to get
> - python server reads that line, gets the file and sends back an
>integer with file length and then the file itself
> - class loader reads a lenght integer and then reads the remainig data
>The problem is when I try to read several files the first one is read
>quite fast, but the rest is read 40 x slower. For example (time is in
>% python client.py client.py client.py client.py server.py server.py
>what's wrong here?
At a guess, what you've measured is how long it takes to transfer the
data to the underlying OS socket buffers. The first transfer fills the
buffers, subsequent ones have to wait until the data has been put on
the wire and acknowledged before there's space for the writes.
Jim Segrave (jes at jes-2.demon.nl)
More information about the Python-list