Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.3] Improve handling of slow websocket clients #6606

Merged
merged 3 commits into from
Jul 13, 2020
Merged

[4.3] Improve handling of slow websocket clients #6606

merged 3 commits into from
Jul 13, 2020

Conversation

jamesaimonetti
Copy link
Member

When a websocket client is having trouble reading messages off its
socket, backpressure will cause the mailbox of the
blackhole_socket_handler to start to fill up with {send_data, _}
tuples from blackhole_data_emitter. This is due to the sending of data
being stuck in prim_inet:send/3.

We add two mechnisms to try to avoid the server being harshly impacted
by slow clients:

  1. Reduce the send_timeout blackhole uses to more quickly terminate
    the socket in the event of slow sends
  2. Check the mailbox of blackhole_socket_handler from
    blackhole_data_emitter before sending the {send_data, _} tuple, opting
    to shed the load while waiting.

When a websocket client is having trouble reading messages off its
socket, backpressure will cause the mailbox of the
blackhole_socket_handler to start to fill up with {send_data, _}
tuples from blackhole_data_emitter. This is due to the sending of data
being stuck in prim_inet:send/3.

We add two mechnisms to try to avoid the server being harshly impacted
by slow clients:

1. Reduce the send_timeout blackhole uses to more quickly terminate
the socket in the event of slow sends
2. Check the mailbox of blackhole_socket_handler from
blackhole_data_emitter before sending the {send_data, _} tuple, opting
to shed the load while waiting.
@mark2600 mark2600 merged commit 72c5328 into 4.3 Jul 13, 2020
@mark2600 mark2600 deleted the bh-load-shed branch July 13, 2020 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants