Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
stressgrid
dummies
Commits
ae3be721
Commit
ae3be721
authored
Feb 25, 2019
by
KT315
Browse files
Use SO_REUSEPORT
parent
aeb3cb26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
elixir_dummy/lib/elixir_dummy/application.ex
elixir_dummy/lib/elixir_dummy/application.ex
+12
-5
No files found.
elixir_dummy/lib/elixir_dummy/application.ex
View file @
ae3be721
...
...
@@ -3,6 +3,11 @@ defmodule Dummy.Application do
use
Application
@sol_socket
1
@so_reuseport
15
@socket_num
36
def
start
(
_type
,
_args
)
do
dispatch
=
:cowboy_router
.
compile
([
...
...
@@ -12,21 +17,23 @@ defmodule Dummy.Application do
]}
])
children
=
[
children
=
0
..
@socket_num
-
1
|>
Enum
.
map
(
fn
i
->
id
=
:"dummy
#{
i
}
"
%{
id:
:dummy
,
id:
id
,
start:
{
:cowboy
,
:start_clear
,
[
:dummy
,
%{
max_connections:
999_999
,
socket_opts:
[
port
:
5000
]},
id
,
%{
max_connections:
1_000_000
,
socket_opts:
[
{
:
port
,
5000
},
{
:raw
,
@sol_socket
,
@so_reuseport
,
<<
1
::
size
(
32
)
>>
}
]},
%{
max_keepalive:
1_000
,
env:
%{
dispatch:
dispatch
}}
]},
restart:
:permanent
,
shutdown:
:infinity
,
type:
:supervisor
}
]
end
)
opts
=
[
strategy:
:one_for_one
,
name:
Dummy
.
Supervisor
]
Supervisor
.
start_link
(
children
,
opts
)
...
...
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