New submission from Charles-François Natali: 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). ---------- components: Library (Lib) files: asyncore_buffsize.diff keywords: easy, needs review, patch messages: 178212 nosy: giampaolo.rodola, neologix, xdegaye priority: normal severity: normal stage: patch review status: open title: asyncore.dispatcher_with_send - increase the send buffer size type: performance versions: Python 3.4 Added file: http://bugs.python.org/file28442/asyncore_buffsize.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16787> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com