Determine the best buffer sizes when using socket.send() and socket.recv()

Giampaolo Rodola' gnewsg at gmail.com
Fri Nov 14 10:56:07 EST 2008


Hi,
I'd like to know if there's a way to determine which is the best
buffer size to use when you have to send() and recv() some data over
the network.
I have an FTP server application which, on data channel, uses 8192
bytes as buffer for both incoming and outgoing data.
Some time ago I received a report from a guy [1] who stated that
changing the buffers from 8192 to 4096 results in a drastical speed
improvement.
I tried to make some tests by using different buffer sizes, from 4 Kb
to 256 Kb, but I'm not sure which one to use as default in my
application since I noticed they can vary from different OSes.
Is there a recommended way to determine the best buffer size to use?

Thanks in advance

[1] http://groups.google.com/group/pyftpdlib/browse_thread/thread/f13a82b...


--- Giampaolo
http://code.google.com/p/pyftpdlib/




More information about the Python-list mailing list