Socket performance

John Nagle nagle at animats.com
Sun Jul 25 01:50:25 EDT 2010


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 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
 packets, because sockets are "flushed" after each write.
 2. Wait for input from multiple sources by using "select". (But
 be aware that "select" doesn't work for Windows pipes.)
				John Nagle


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /