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

Fix inet driver realloc bug #1876

Merged
merged 2 commits into from
Aug 3, 2018

Conversation

garazdawi
Copy link
Contributor

This PR fixed the performance issues found in the erlang-questions discussion here: http://erlang.org/pipermail/erlang-questions/2018-May/095494.html

The PR does two things:

  • Fixes a performance bug when the inet UDP implementation gets EAGAIN from recvmsg
  • Limits the max user-space buffer size of UDP to the theoretical max MTU

Only SCPT should keep the recv buffer when going into
select. If UDP does it, it will result in many more
memory allocations than there should be which can be
very detrimental to performance.
@garazdawi garazdawi added team:VM Assigned to OTP team VM fix labels Jul 16, 2018
@garazdawi garazdawi self-assigned this Jul 16, 2018
Kernel socket buffers. It is recommended
to have <c>val(buffer) &gt;= max(val(sndbuf),val(recbuf))</c> to
Kernel socket buffers. For TCP it is recommended
to have <c>val(buffer) &gt;= max(val(recbuf))</c> to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for max here when there is only one value.

There is no reason to have a larger buffer than this as
the recvmsg call will never return more data.

OTP-15206
@garazdawi garazdawi force-pushed the lukas/erts/fix_udp_realloc_bug branch from 4e8f1d1 to a9d361b Compare July 30, 2018 14:55
@garazdawi garazdawi merged commit a9d361b into erlang:maint Aug 3, 2018
@garazdawi garazdawi deleted the lukas/erts/fix_udp_realloc_bug branch October 24, 2019 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants