Author neologix
Recipients giampaolo.rodola, neologix, xdegaye
Date 2012-12-26.13:51:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1356529865.78.0.746318746855.issue16787@psf.upfronthosting.co.za>
In-reply-to
Content
As noted in issue #12498, asyncore.dispatcher_with_send only sends 512 bytes at a time: this is 1/3 of the Ethernet MTU, which reduces greatly the attainable bandwidth and increases the CPU usage.
Here's a patch bumping it to 8192 (and making it a class member so that derived classes can customize it if needed, although not documented).

Here's the result of a simplistic benchmark using asyncore.dispatcher_with_send to send data to a server:
Without patch:
"""
$ time ./python ~/test_asyncore.py localhost 4242

real    0m6.098s
user    0m4.472s
sys     0m1.436s
"""

With patch:
"""
$ time ./python ~/test_asyncore.py localhost 4242

real    0m0.937s
user    0m0.796s
sys     0m0.112s
"""

Of course, this is using the loopback interface, but it shows that the performance gain can non negligible. The test script is attached (use "netcat -l -p 4242" as server).
History
Date User Action Args
2012-12-26 13:51:05neologixsetrecipients: + neologix, giampaolo.rodola, xdegaye
2012-12-26 13:51:05neologixsetmessageid: <1356529865.78.0.746318746855.issue16787@psf.upfronthosting.co.za>
2012-12-26 13:51:05neologixlinkissue16787 messages
2012-12-26 13:51:04neologixcreate