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
aaac5a11
Commit
aaac5a11
authored
Apr 27, 2016
by
Elvis Pranskevichus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add golang echo server
parent
f9aa2e26
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
30 deletions
+93
-30
Dockerfile
Dockerfile
+5
-1
echo_client
echo_client
+20
-23
run_benchmarks
run_benchmarks
+6
-0
servers/.gitignore
servers/.gitignore
+1
-0
servers/goecho.go
servers/goecho.go
+54
-0
servers/requirements.txt
servers/requirements.txt
+7
-6
No files found.
Dockerfile
View file @
aaac5a11
...
@@ -7,22 +7,26 @@ RUN DEBIAN_FRONTEND=noninteractive \
...
@@ -7,22 +7,26 @@ RUN DEBIAN_FRONTEND=noninteractive \
ENV
LANG en_US.UTF-8
ENV
LANG en_US.UTF-8
ENV
WORKON_HOME /usr/local/python-venvs
ENV
WORKON_HOME /usr/local/python-venvs
ENV
GOMAXPROCS 1
RUN
mkdir
-p
/usr/local/python-venvs
RUN
mkdir
-p
/usr/local/python-venvs
RUN
DEBIAN_FRONTEND
=
noninteractive
\
RUN
DEBIAN_FRONTEND
=
noninteractive
\
apt-get update
&&
apt-get
install
-y
\
apt-get update
&&
apt-get
install
-y
\
autoconf automake libtool build-essential
\
autoconf automake libtool build-essential
\
python3 python3-pip git nodejs gosu
python3 python3-pip git nodejs go
lang go
su
RUN
pip3
install
vex
RUN
pip3
install
vex
RUN
vex
--python
=
python3.5
-m
bench pip
install
-U
pip
RUN
vex
--python
=
python3.5
-m
bench pip
install
-U
pip
RUN
mkdir
-p
/var/lib/cache/pip
RUN
mkdir
-p
/var/lib/cache/pip
ADD
servers /usr/src/servers
ADD
servers /usr/src/servers
RUN
go build /usr/src/servers/goecho.go
RUN
vex bench pip
--cache-dir
=
/var/lib/cache/pip
\
RUN
vex bench pip
--cache-dir
=
/var/lib/cache/pip
\
install
-r
/usr/src/servers/requirements.txt
install
-r
/usr/src/servers/requirements.txt
RUN
vex bench pip freeze
-r
/usr/src/servers/requirements.txt
EXPOSE
25000
EXPOSE
25000
VOLUME
/var/lib/cache
VOLUME
/var/lib/cache
...
...
echo_client
View file @
aaac5a11
...
@@ -42,8 +42,6 @@ if __name__ == '__main__':
...
@@ -42,8 +42,6 @@ if __name__ == '__main__':
help
=
'message size in bytes'
)
help
=
'message size in bytes'
)
parser
.
add_argument
(
'--duration'
,
'-T'
,
default
=
30
,
type
=
int
,
parser
.
add_argument
(
'--duration'
,
'-T'
,
default
=
30
,
type
=
int
,
help
=
'duration of test in seconds'
)
help
=
'duration of test in seconds'
)
parser
.
add_argument
(
'--times'
,
default
=
1
,
type
=
int
,
help
=
'number of times to run the test'
)
parser
.
add_argument
(
'--concurrency'
,
default
=
3
,
type
=
int
,
parser
.
add_argument
(
'--concurrency'
,
default
=
3
,
type
=
int
,
help
=
'request concurrency'
)
help
=
'request concurrency'
)
parser
.
add_argument
(
'--timeout'
,
default
=
2
,
type
=
int
,
parser
.
add_argument
(
'--timeout'
,
default
=
2
,
type
=
int
,
...
@@ -75,7 +73,7 @@ if __name__ == '__main__':
...
@@ -75,7 +73,7 @@ if __name__ == '__main__':
else
:
else
:
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
sock
.
settimeout
(
15
)
sock
.
settimeout
(
timeout
/
1000
)
sock
.
connect
(
addr
)
sock
.
connect
(
addr
)
n
=
0
n
=
0
...
@@ -102,7 +100,6 @@ if __name__ == '__main__':
...
@@ -102,7 +100,6 @@ if __name__ == '__main__':
return
n
,
latency_stats
,
min_latency
,
max_latency
return
n
,
latency_stats
,
min_latency
,
max_latency
TIMES
=
args
.
times
N
=
args
.
concurrency
N
=
args
.
concurrency
DURATION
=
args
.
duration
DURATION
=
args
.
duration
...
@@ -111,7 +108,7 @@ if __name__ == '__main__':
...
@@ -111,7 +108,7 @@ if __name__ == '__main__':
messages
=
0
messages
=
0
latency_stats
=
None
latency_stats
=
None
start
=
time
.
monotonic
()
start
=
time
.
monotonic
()
for
_
in
range
(
TIMES
):
with
futures
.
ProcessPoolExecutor
(
max_workers
=
N
)
as
e
:
with
futures
.
ProcessPoolExecutor
(
max_workers
=
N
)
as
e
:
fs
=
[]
fs
=
[]
for
_
in
range
(
N
):
for
_
in
range
(
N
):
...
...
run_benchmarks
View file @
aaac5a11
...
@@ -73,6 +73,12 @@ benchmarks = [{
...
@@ -73,6 +73,12 @@ benchmarks = [{
'server'
:
nodejs
+
[
'/usr/src/servers/nodeecho.js'
],
'server'
:
nodejs
+
[
'/usr/src/servers/nodeecho.js'
],
'server_address'
:
tcp_address
,
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-golang'
,
'title'
:
'TCP echo server (golang)'
,
'server'
:
[
'/usr/src/servers/goecho'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
},
{
'name'
:
'tcpecho-asyncio-streams'
,
'name'
:
'tcpecho-asyncio-streams'
,
'title'
:
'TCP echo server (asyncio/streams)'
,
'title'
:
'TCP echo server (asyncio/streams)'
,
...
...
servers/.gitignore
0 → 100644
View file @
aaac5a11
/goecho
servers/goecho.go
0 → 100644
View file @
aaac5a11
// Taken from https://gist.github.com/paulsmith/775764#file-echo-go
package
main
import
(
"net"
"strconv"
"fmt"
)
const
PORT
=
25000
func
main
()
{
server
,
err
:=
net
.
Listen
(
"tcp"
,
":"
+
strconv
.
Itoa
(
PORT
))
if
server
==
nil
{
panic
(
"couldn't start listening: "
+
err
.
Error
())
}
conns
:=
clientConns
(
server
)
for
{
go
handleConn
(
<-
conns
)
}
}
func
clientConns
(
listener
net
.
Listener
)
chan
net
.
Conn
{
ch
:=
make
(
chan
net
.
Conn
)
i
:=
0
go
func
()
{
for
{
client
,
err
:=
listener
.
Accept
()
if
client
==
nil
{
fmt
.
Printf
(
"couldn't accept: "
+
err
.
Error
())
continue
}
i
++
fmt
.
Printf
(
"%d: %v <-> %v
\n
"
,
i
,
client
.
LocalAddr
(),
client
.
RemoteAddr
())
ch
<-
client
}
}()
return
ch
}
func
handleConn
(
client
net
.
Conn
)
{
buf
:=
make
([]
byte
,
102400
)
for
{
reqLen
,
err
:=
client
.
Read
(
buf
)
if
err
!=
nil
{
break
}
if
reqLen
>
0
{
client
.
Write
(
buf
[
:
reqLen
])
}
}
}
servers/requirements.txt
View file @
aaac5a11
uvloop
curio==0.1
curio
aiohttp==0.21.5
aiohttp
gevent==1.1.1
httptools
tornado==4.3
gevent
Twisted==16.1.1
tornado
httptools==0.0.4
uvloop==0.4.7
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