fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40126?usp=email )
Change subject: osmo_dia2gsup: disable Nagle for TCP/SCTP by default
......................................................................
osmo_dia2gsup: disable Nagle for TCP/SCTP by default
Disable the Nagle's algorithm by default in order to reduce latency
of the DIAMETER peer. Allow re-enabling it via the environment
parameter 'diameter_nodelay' (false enables the Nagle).
Change-Id: I1e62cdbcbbdb29a0a98f390b33cf14592079d579
---
M src/osmo_dia2gsup.erl
1 file changed, 15 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/26/40126/1
diff --git a/src/osmo_dia2gsup.erl b/src/osmo_dia2gsup.erl
index 98a766c..1739360 100644
--- a/src/osmo_dia2gsup.erl
+++ b/src/osmo_dia2gsup.erl
@@ -47,6 +47,7 @@
-export([code_change/3, terminate/2]).
-define(SERVER, ?MODULE).
+-define(ENV_DEFAULT_SCTP_NODELAY, true).
% Diameter application definitions
@@ -147,9 +148,7 @@
Proto = get_env(diameter_proto, sctp),
ConnectTimer = get_env(diameter_connect_timer, 30000),
TransOpts = [{transport_module, tmod(Proto)},
- {transport_config, [{ip, parse_addr(LAddr)},
- {port, LPort},
- {reuseaddr, true}]},
+ {transport_config, tcfg(Proto, LAddr, LPort)},
{connect_timer, ConnectTimer}],
{ok, _} = diameter:add_transport(Name, {listen, TransOpts}),
lager:info("Diameter HSS Application started on IP ~s, ~p port ~p~n",
@@ -158,6 +157,19 @@
tmod(tcp) -> diameter_tcp;
tmod(sctp) -> diameter_sctp.
+tcfg(tcp, LAddr, LPort) ->
+ Cfg = #{nodelay => get_env(diameter_nodelay, ?ENV_DEFAULT_SCTP_NODELAY)},
+ tcfg(Cfg, LAddr, LPort);
+
+tcfg(sctp, LAddr, LPort) ->
+ Cfg = #{sctp_nodelay => get_env(diameter_nodelay, ?ENV_DEFAULT_SCTP_NODELAY)},
+ tcfg(Cfg, LAddr, LPort);
+
+tcfg(Cfg, LAddr, LPort) when is_map(Cfg) ->
+ maps:to_list(Cfg#{ip => parse_addr(LAddr),
+ port => LPort,
+ reuseaddr => true}).
+
parse_addr(AddrStr) when is_list(AddrStr) ->
{ok, Addr} = inet:parse_address(AddrStr),
Addr;
--
To view, visit
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/40126?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I1e62cdbcbbdb29a0a98f390b33cf14592079d579
Gerrit-Change-Number: 40126
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>