On Mar 13, 9:33 am, "Brian Smith" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Sent: Wednesday, March 12, 2008 9:47 PM > > To: [EMAIL PROTECTED] > > Subject: Socket Performance > > > Can anyone explain why socket performance (throughput) varies > > depending on the amount of data send and recv are called with? > > > For example: try creating a local client/server (running on the same > > computer) where the server sends the client a fixed amount of data. > > Using method A, recv(8192) and sendall( ) with 8192 bytes > > worth of data. Do this 100 times. Using method B, recv(1) and > > sendall( ) with 1 byte worth of data. Do this 819200 times. > > > If you time both methods, method A has much greater > > throughput than method B. > > Why is it faster to drink a liter of water a cupful at a time than to > drink it out of an eyedropper? > > - Brian
Well, lets say you have a situation where you're going to be alternating between sending large and small chunks of data. Is the solution to create a NetworkBuffer class and only call send when the buffer is full, always recv(8192)? -- http://mail.python.org/mailman/listinfo/python-list