Commit e6f5a7d3 authored by Elvis Pranskevichus's avatar Elvis Pranskevichus

Equalize server receive buffer sizes for fairness

parent 5f8dce5c
...@@ -50,8 +50,8 @@ benchmarks = [{ ...@@ -50,8 +50,8 @@ benchmarks = [{
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'tcpecho-curio', 'name': 'tcpecho-curio-socket',
'title': 'TCP echo server (curio)', 'title': 'TCP echo server (curio/socket)',
'server': python + ['/usr/src/servers/curioecho.py'], 'server': python + ['/usr/src/servers/curioecho.py'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
...@@ -62,64 +62,64 @@ benchmarks = [{ ...@@ -62,64 +62,64 @@ benchmarks = [{
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'tcpecho-asyncio-stdstreams', 'name': 'tcpecho-asyncio-streams',
'title': 'TCP echo server (asyncio/stdstreams)', 'title': 'TCP echo server (asyncio/streams)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=0.0.0.0:25000', '--addr=0.0.0.0:25000',
'--streams'], '--streams'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'tcpecho-asyncio-minproto', 'name': 'tcpecho-asyncio-proto',
'title': 'TCP echo server (asyncio/minproto)', 'title': 'TCP echo server (asyncio/proto)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=0.0.0.0:25000', '--addr=0.0.0.0:25000',
'--proto'], '--proto'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'unixecho-asyncio-stdstreams', 'name': 'unixecho-asyncio-streams',
'title': 'Unix socket echo server (asyncio/stdstreams)', 'title': 'Unix socket echo server (asyncio/streams)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=file:/tmp/sockets/server.sock', '--addr=file:/tmp/sockets/server.sock',
'--streams'], '--streams'],
'server_address': unix_address, 'server_address': unix_address,
'client': unix_client, 'client': unix_client,
}, { }, {
'name': 'unixecho-asyncio-minproto', 'name': 'unixecho-asyncio-proto',
'title': 'Unix socket echo server (asyncio/minproto)', 'title': 'Unix socket echo server (asyncio/proto)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=file:/tmp/sockets/server.sock', '--addr=file:/tmp/sockets/server.sock',
'--proto'], '--proto'],
'server_address': unix_address, 'server_address': unix_address,
'client': unix_client, 'client': unix_client,
}, { }, {
'name': 'tcpecho-uvloop-stdstreams', 'name': 'tcpecho-uvloop-streams',
'title': 'TCP echo server (uvloop/stdstreams)', 'title': 'TCP echo server (uvloop/streams)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=0.0.0.0:25000', '--addr=0.0.0.0:25000',
'--streams', '--uvloop'], '--streams', '--uvloop'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'tcpecho-uvloop-minproto', 'name': 'tcpecho-uvloop-proto',
'title': 'TCP echo server (uvloop/minproto)', 'title': 'TCP echo server (uvloop/proto)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=0.0.0.0:25000', '--addr=0.0.0.0:25000',
'--proto', '--uvloop'], '--proto', '--uvloop'],
'server_address': tcp_address, 'server_address': tcp_address,
'client': tcp_client, 'client': tcp_client,
}, { }, {
'name': 'unixecho-uvloop-stdstreams', 'name': 'unixecho-uvloop-streams',
'title': 'Unix socket echo server (uvloop/stdstreams)', 'title': 'Unix socket echo server (uvloop/streams)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=file:/tmp/sockets/server.sock', '--addr=file:/tmp/sockets/server.sock',
'--streams', '--uvloop'], '--streams', '--uvloop'],
'server_address': unix_address, 'server_address': unix_address,
'client': unix_client, 'client': unix_client,
}, { }, {
'name': 'unixecho-uvloop-minproto', 'name': 'unixecho-uvloop-proto',
'title': 'Unix socket echo server (uvloop/minproto)', 'title': 'Unix socket echo server (uvloop/proto)',
'server': python + ['/usr/src/servers/asyncioecho.py', 'server': python + ['/usr/src/servers/asyncioecho.py',
'--addr=file:/tmp/sockets/server.sock', '--addr=file:/tmp/sockets/server.sock',
'--proto', '--uvloop'], '--proto', '--uvloop'],
......
...@@ -3,7 +3,6 @@ import asyncio ...@@ -3,7 +3,6 @@ import asyncio
import gc import gc
import uvloop import uvloop
import os.path import os.path
import socket as socket_module
from socket import * from socket import *
...@@ -33,7 +32,7 @@ async def echo_server(loop, address, unix): ...@@ -33,7 +32,7 @@ async def echo_server(loop, address, unix):
async def echo_client(loop, client): async def echo_client(loop, client):
with client: with client:
while True: while True:
data = await loop.sock_recv(client, 10000) data = await loop.sock_recv(client, 102400)
if not data: if not data:
break break
await loop.sock_sendall(client, data) await loop.sock_sendall(client, data)
...@@ -46,7 +45,7 @@ async def echo_client_streams(reader, writer): ...@@ -46,7 +45,7 @@ async def echo_client_streams(reader, writer):
sock = writer.get_extra_info('socket') sock = writer.get_extra_info('socket')
print('Connection from', sock.getpeername()) print('Connection from', sock.getpeername())
while True: while True:
data = await reader.read(100000) data = await reader.read(102400)
if not data: if not data:
break break
writer.write(data) writer.write(data)
......
...@@ -8,7 +8,7 @@ from curio import Kernel, new_task, run_server ...@@ -8,7 +8,7 @@ from curio import Kernel, new_task, run_server
async def echo_handler(client, addr): async def echo_handler(client, addr):
print('Connection from', addr) print('Connection from', addr)
while True: while True:
data = await client.recv(10000) data = await client.recv(102400)
if not data: if not data:
break break
await client.sendall(data) await client.sendall(data)
......
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