Tune socket receive buffer sizes to fix false positive backpressure

This commit is contained in:
Сергей Прохоров 2019-03-08 00:27:21 +01:00
parent 23ef74a551
commit efafd37ca9
No known key found for this signature in database
GPG key ID: 1C570244E4EF3337
2 changed files with 5 additions and 0 deletions

View file

@ -19,6 +19,7 @@ connect(Host, Port, Secret, DcId, Protocol) ->
Opts = [{packet, raw},
{mode, binary},
{active, false},
{buffer, 1024},
{send_timeout, 5000}],
{ok, Sock} = gen_tcp:connect(Host, Port, Opts, 1000),
{Header, _, _, CryptoLayer} = mtp_obfuscated:client_create(Secret, Protocol, DcId),

View file

@ -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
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),
%% Disable upstream healthchecks
application:set_env(?APP, upstream_healthchecks, []),