Tune socket receive buffer sizes to fix false positive backpressure

parent 23ef74a5
...@@ -19,6 +19,7 @@ connect(Host, Port, Secret, DcId, Protocol) -> ...@@ -19,6 +19,7 @@ connect(Host, Port, Secret, DcId, Protocol) ->
Opts = [{packet, raw}, Opts = [{packet, raw},
{mode, binary}, {mode, binary},
{active, false}, {active, false},
{buffer, 1024},
{send_timeout, 5000}], {send_timeout, 5000}],
{ok, Sock} = gen_tcp:connect(Host, Port, Opts, 1000), {ok, Sock} = gen_tcp:connect(Host, Port, Opts, 1000),
{Header, _, _, CryptoLayer} = mtp_obfuscated:client_create(Secret, Protocol, DcId), {Header, _, _, CryptoLayer} = mtp_obfuscated:client_create(Secret, Protocol, DcId),
......
...@@ -169,6 +169,10 @@ downstream_size_backpressure_case(Cfg) when is_list(Cfg) -> ...@@ -169,6 +169,10 @@ downstream_size_backpressure_case(Cfg) when is_list(Cfg) ->
%% @doc test downstream backpressure when count of non-acknowledged packets grows above threshold %% @doc test downstream backpressure when count of non-acknowledged packets grows above threshold
downstream_qlen_backpressure_case({pre, Cfg}) -> downstream_qlen_backpressure_case({pre, Cfg}) ->
application:load(mtproto_proxy),
%% Reducing downstream socket buffer size. Otherwise we can get queue overflow from just single
%% socket data packet
application:set_env(mtproto_proxy, downstream_socket_buffer_size, 1024),
Cfg1 = setup_single(?FUNCTION_NAME, ?LINE, #{rpc_handler => mtp_test_cmd_rpc}, Cfg), Cfg1 = setup_single(?FUNCTION_NAME, ?LINE, #{rpc_handler => mtp_test_cmd_rpc}, Cfg),
%% Disable upstream healthchecks %% Disable upstream healthchecks
application:set_env(?APP, upstream_healthchecks, []), application:set_env(?APP, upstream_healthchecks, []),
......
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