Commit 95fdc01d authored by Julien Muchembled's avatar Julien Muchembled

Increase connector buffer size for receiving

When receiving 1 byte, benchmarking shows no visible difference with values
between 4096 and 65536 for the buffer size. With higher values, it becomes
significantly slower.

On the other side, a 64k buffer is faster with bigger packets.
Time to run testBasicStore with MySQL:

            4096        65536
    real    0m51.115s   0m21.592s
    user    0m41.857s   0m13.540s
    sys     0m8.700s    0m2.687s
parent b4317e4e
...@@ -145,7 +145,7 @@ class SocketConnector(object): ...@@ -145,7 +145,7 @@ class SocketConnector(object):
def receive(self, read_buf): def receive(self, read_buf):
try: try:
data = self.socket.recv(4096) data = self.socket.recv(65536)
except socket.error, e: except socket.error, e:
self._error('recv', e) self._error('recv', e)
if data: if data:
...@@ -155,6 +155,7 @@ class SocketConnector(object): ...@@ -155,6 +155,7 @@ class SocketConnector(object):
raise ConnectorException raise ConnectorException
def send(self): def send(self):
# XXX: unefficient for big packets
msg = ''.join(self.queued) msg = ''.join(self.queued)
if msg: if msg:
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment