Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
misc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
misc
Commits
e6f5a7d3
Commit
e6f5a7d3
authored
Apr 27, 2016
by
Elvis Pranskevichus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Equalize server receive buffer sizes for fairness
parent
5f8dce5c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
22 deletions
+21
-22
run_benchmarks
run_benchmarks
+18
-18
servers/asyncioecho.py
servers/asyncioecho.py
+2
-3
servers/curioecho.py
servers/curioecho.py
+1
-1
No files found.
run_benchmarks
View file @
e6f5a7d3
...
...
@@ -50,8 +50,8 @@ benchmarks = [{
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-curio'
,
'title'
:
'TCP echo server (curio)'
,
'name'
:
'tcpecho-curio
-socket
'
,
'title'
:
'TCP echo server (curio
/socket
)'
,
'server'
:
python
+
[
'/usr/src/servers/curioecho.py'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
...
...
@@ -62,64 +62,64 @@ benchmarks = [{
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-asyncio-st
dst
reams'
,
'title'
:
'TCP echo server (asyncio/st
dst
reams)'
,
'name'
:
'tcpecho-asyncio-streams'
,
'title'
:
'TCP echo server (asyncio/streams)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=0.0.0.0:25000'
,
'--streams'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-asyncio-
min
proto'
,
'title'
:
'TCP echo server (asyncio/
min
proto)'
,
'name'
:
'tcpecho-asyncio-proto'
,
'title'
:
'TCP echo server (asyncio/proto)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=0.0.0.0:25000'
,
'--proto'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'unixecho-asyncio-st
dst
reams'
,
'title'
:
'Unix socket echo server (asyncio/st
dst
reams)'
,
'name'
:
'unixecho-asyncio-streams'
,
'title'
:
'Unix socket echo server (asyncio/streams)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=file:/tmp/sockets/server.sock'
,
'--streams'
],
'server_address'
:
unix_address
,
'client'
:
unix_client
,
},
{
'name'
:
'unixecho-asyncio-
min
proto'
,
'title'
:
'Unix socket echo server (asyncio/
min
proto)'
,
'name'
:
'unixecho-asyncio-proto'
,
'title'
:
'Unix socket echo server (asyncio/proto)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=file:/tmp/sockets/server.sock'
,
'--proto'
],
'server_address'
:
unix_address
,
'client'
:
unix_client
,
},
{
'name'
:
'tcpecho-uvloop-st
dst
reams'
,
'title'
:
'TCP echo server (uvloop/st
dst
reams)'
,
'name'
:
'tcpecho-uvloop-streams'
,
'title'
:
'TCP echo server (uvloop/streams)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=0.0.0.0:25000'
,
'--streams'
,
'--uvloop'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-uvloop-
min
proto'
,
'title'
:
'TCP echo server (uvloop/
min
proto)'
,
'name'
:
'tcpecho-uvloop-proto'
,
'title'
:
'TCP echo server (uvloop/proto)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=0.0.0.0:25000'
,
'--proto'
,
'--uvloop'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'unixecho-uvloop-st
dst
reams'
,
'title'
:
'Unix socket echo server (uvloop/st
dst
reams)'
,
'name'
:
'unixecho-uvloop-streams'
,
'title'
:
'Unix socket echo server (uvloop/streams)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=file:/tmp/sockets/server.sock'
,
'--streams'
,
'--uvloop'
],
'server_address'
:
unix_address
,
'client'
:
unix_client
,
},
{
'name'
:
'unixecho-uvloop-
min
proto'
,
'title'
:
'Unix socket echo server (uvloop/
min
proto)'
,
'name'
:
'unixecho-uvloop-proto'
,
'title'
:
'Unix socket echo server (uvloop/proto)'
,
'server'
:
python
+
[
'/usr/src/servers/asyncioecho.py'
,
'--addr=file:/tmp/sockets/server.sock'
,
'--proto'
,
'--uvloop'
],
...
...
servers/asyncioecho.py
View file @
e6f5a7d3
...
...
@@ -3,7 +3,6 @@ import asyncio
import
gc
import
uvloop
import
os.path
import
socket
as
socket_module
from
socket
import
*
...
...
@@ -33,7 +32,7 @@ async def echo_server(loop, address, unix):
async
def
echo_client
(
loop
,
client
):
with
client
:
while
True
:
data
=
await
loop
.
sock_recv
(
client
,
10
0
00
)
data
=
await
loop
.
sock_recv
(
client
,
10
24
00
)
if
not
data
:
break
await
loop
.
sock_sendall
(
client
,
data
)
...
...
@@ -46,7 +45,7 @@ async def echo_client_streams(reader, writer):
sock
=
writer
.
get_extra_info
(
'socket'
)
print
(
'Connection from'
,
sock
.
getpeername
())
while
True
:
data
=
await
reader
.
read
(
10
00
00
)
data
=
await
reader
.
read
(
10
24
00
)
if
not
data
:
break
writer
.
write
(
data
)
...
...
servers/curioecho.py
View file @
e6f5a7d3
...
...
@@ -8,7 +8,7 @@ from curio import Kernel, new_task, run_server
async
def
echo_handler
(
client
,
addr
):
print
(
'Connection from'
,
addr
)
while
True
:
data
=
await
client
.
recv
(
10
0
00
)
data
=
await
client
.
recv
(
10
24
00
)
if
not
data
:
break
await
client
.
sendall
(
data
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment