Re: Socket performance

2010-07-25 Thread Roy Smith
In article 4c4bd0b1$0$1624$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: 1. When writing to a TCP socket, write everything you have to write with one send or write operation if at all possible. Don't write a little at a time. That results in sending small

Re: Socket performance

2010-07-25 Thread Navkirat Singh
On 25-Jul-2010, at 5:52 PM, Roy Smith wrote: In article 4c4bd0b1$0$1624$742ec...@news.sonic.net, John Nagle na...@animats.com wrote: 1. When writing to a TCP socket, write everything you have to write with one send or write operation if at all possible. Don't write a

Re: Socket performance

2010-07-24 Thread Lawrence D'Oliveiro
In message mailman.1097.1279930004.1673.python-l...@python.org, Navkirat Singh wrote: I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost? Remember the old saying, “premature optimization is the root of all

Re: Socket performance

2010-07-24 Thread Navkirat Singh
On 25-Jul-2010, at 6:45 AM, Lawrence D'Oliveiro wrote: In message mailman.1097.1279930004.1673.python-l...@python.org, Navkirat Singh wrote: I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost?

Re: Socket performance

2010-07-24 Thread John Nagle
On 7/23/2010 5:06 PM, Navkirat Singh wrote: Hey Everyone, I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost? I would also appreciate being pointed to some formal documentation or article. 1. When

Re: Socket performance

2010-07-23 Thread MRAB
Navkirat Singh wrote: Hey Everyone, I had a question, programming sockets, what are the things that would degrade performance and what steps could help in a performance boost? I would also appreciate being pointed to some formal documentation or article. I am new to this. Interleaving

Re: Socket performance

2010-07-23 Thread Navkirat Singh
Thanks for the info : ). I will look into it ! Right now I am having a strange problem. I am trying to use cookies and the import function returns an error: I am using python 3: from http import cookies importError: No module named http Is it my configuration or has something changed

Re: Socket performance

2010-07-23 Thread MRAB
Navkirat Singh wrote: Thanks for the info : ). I will look into it ! Right now I am having a strange problem. I am trying to use cookies and the import function returns an error: I am using python 3: from http import cookies *importError:* No module named http Is it my configuration or has

Re: Socket Performance

2008-03-16 Thread Gabriel Genellina
En Sat, 15 Mar 2008 20:08:05 -0200, [EMAIL PROTECTED] escribi�: On Mar 15, 8:18 am, Bryan Olson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Newbie question:  Can you write to the 'file-like object' a pickle, and receive it intact-- as one string with nothing else? Yes, but there's a

Re: Socket Performance

2008-03-16 Thread castironpi
On Mar 16, 1:29 pm, Gabriel Genellina [EMAIL PROTECTED] wrote: En Sat, 15 Mar 2008 20:08:05 -0200, [EMAIL PROTECTED] escribi�: On Mar 15, 8:18 am, Bryan Olson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Newbie question:  Can you write to the 'file-like object' a pickle, and

Re: Socket Performance

2008-03-15 Thread Gabriel Genellina
En Thu, 13 Mar 2008 15:18:44 -0200, [EMAIL PROTECTED] escribió: 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

Re: Socket Performance

2008-03-15 Thread castironpi
On Mar 15, 3:33 am, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 13 Mar 2008 15:18:44 -0200, [EMAIL PROTECTED] escribió: 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

Re: Socket Performance

2008-03-15 Thread Bryan Olson
[EMAIL PROTECTED] wrote: Gabriel Genellina wrote: No need to reinvent the wheel. socket objects already have a makefile method returning a file-like object, which behaves like a buffered socket. That wheel is far from round, and needs some reinvention. Python's file-like objects do not play

Re: Socket Performance

2008-03-15 Thread castironpi
On Mar 15, 8:18 am, Bryan Olson [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: No need to reinvent the wheel. socket objects already have a makefile   method returning a file-like object, which behaves like a buffered socket. That wheel is far from round, and

Re: Socket Performance

2008-03-14 Thread castironpi
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)?         Or create a protocol where the first 16 bits (in

Re: Socket Performance

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: [Dennis Lee Bieber had written:] Or create a protocol where the first 16 bits (in network byte order) contain a length value for the subsequent data, and use a receive process that consists of: leng = ntoh(socket.recv(2)) data = socket.receive(leng) (the

Re: Socket Performance

2008-03-14 Thread Bryan Olson
[EMAIL PROTECTED] wrote: 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)? Buffering can often improve

RE: Socket Performance

2008-03-13 Thread Brian Smith
[EMAIL PROTECTED] wrote: Sent: Wednesday, March 12, 2008 9:47 PM To: python-list@python.org 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

Re: Socket Performance

2008-03-13 Thread sleddd
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

Re: Socket Performance

2008-03-13 Thread Grant Edwards
On 2008-03-13, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 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.