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

mobile: Add an option to set the UDP socket send and receive buffer sizes #35190

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

fredyw
Copy link
Member

@fredyw fredyw commented Jul 15, 2024

This PR adds an option in the EngineBuilder to set the UDP socket send buffer size. By default it will use the same value as the one set in Chromium: https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=790-793;drc=7f04a8e033c23dede6beae129cd212e6d4473d72

This PR also updates the code to only apply the default receive buffer size to UDP and not TCP given that the code in https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=766;drc=7f04a8e033c23dede6beae129cd212e6d4473d72 only applies the socket option to UDP only.

Risk Level: low
Testing: unit tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: mobile

Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #35190 was opened by fredyw.

see: more, trace.

@fredyw
Copy link
Member Author

fredyw commented Jul 15, 2024

/retest

2 similar comments
@fredyw
Copy link
Member Author

fredyw commented Jul 15, 2024

/retest

@fredyw
Copy link
Member Author

fredyw commented Jul 15, 2024

/retest

@fredyw fredyw force-pushed the send_buffer_size branch 7 times, most recently from b1b56de to 2d5bf8e Compare July 17, 2024 16:19
@fredyw
Copy link
Member Author

fredyw commented Jul 17, 2024

/retest

@fredyw fredyw force-pushed the send_buffer_size branch 13 times, most recently from 87c8057 to a084d8d Compare July 18, 2024 23:22
@fredyw
Copy link
Member Author

fredyw commented Jul 18, 2024

/retest

1 similar comment
@fredyw
Copy link
Member Author

fredyw commented Jul 19, 2024

/retest

@fredyw fredyw force-pushed the send_buffer_size branch 2 times, most recently from a0b0820 to 5b5f1c1 Compare July 19, 2024 21:03
@fredyw fredyw changed the title mobile: Add an option to set the socket buffer size mobile: Add an option to set the UDP socket send buffer size Jul 24, 2024
@fredyw
Copy link
Member Author

fredyw commented Jul 25, 2024

/retest

@fredyw fredyw marked this pull request as ready for review July 25, 2024 14:24
@fredyw
Copy link
Member Author

fredyw commented Jul 25, 2024

/assign @alyssawilk

Copy link
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

nice!

mobile/library/cc/engine_builder.cc Show resolved Hide resolved
udp_snd_buf_sock_opt->set_name(SO_SNDBUF);
udp_snd_buf_sock_opt->set_level(SOL_SOCKET);
udp_snd_buf_sock_opt->set_int_value(udp_socket_send_buffer_size_);
udp_snd_buf_sock_opt->mutable_type()->mutable_datagram();
Copy link
Contributor

Choose a reason for hiding this comment

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

Mind adding a comment
// Make sure this option is only applied to UDP sockets and not TCP

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@@ -734,6 +739,15 @@ std::unique_ptr<envoy::config::bootstrap::v3::Bootstrap> EngineBuilder::generate
rcv_buf_sock_opt->set_int_value(socket_receive_buffer_size_);
Copy link
Contributor

Choose a reason for hiding this comment

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

change this to datagram only?

Copy link
Member Author

Choose a reason for hiding this comment

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

Initially I wanted to do it in a separate PR, but the change is small enough that I can do it in this PR. Done.

Signed-off-by: Fredy Wijaya <[email protected]>
@fredyw fredyw changed the title mobile: Add an option to set the UDP socket send buffer size mobile: Add an option to set the UDP socket send and receive buffer sizes Jul 25, 2024
@alyssawilk alyssawilk enabled auto-merge (squash) July 25, 2024 16:27
@alyssawilk alyssawilk merged commit ddaa2c3 into envoyproxy:main Jul 25, 2024
32 of 33 checks passed
@fredyw fredyw deleted the send_buffer_size branch July 25, 2024 18:29
martinduke pushed a commit to martinduke/envoy that referenced this pull request Aug 8, 2024
…izes (envoyproxy#35190)

This PR adds an option in the `EngineBuilder` to set the UDP socket send
buffer size. By default it will use the same value as the one set in
Chromium:
https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=790-793;drc=7f04a8e033c23dede6beae129cd212e6d4473d72

This PR also updates the code to only apply the default receive buffer
size to UDP and not TCP given that the code in
https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=766;drc=7f04a8e033c23dede6beae129cd212e6d4473d72
only applies the socket option to UDP only.

Risk Level: low
Testing: unit tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: mobile

---------

Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: Martin Duke <[email protected]>
asingh-g pushed a commit to asingh-g/envoy that referenced this pull request Aug 20, 2024
…izes (envoyproxy#35190)

This PR adds an option in the `EngineBuilder` to set the UDP socket send
buffer size. By default it will use the same value as the one set in
Chromium:
https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=790-793;drc=7f04a8e033c23dede6beae129cd212e6d4473d72

This PR also updates the code to only apply the default receive buffer
size to UDP and not TCP given that the code in
https://source.chromium.org/chromium/chromium/src/+/main:net/quic/quic_session_pool.cc;l=766;drc=7f04a8e033c23dede6beae129cd212e6d4473d72
only applies the socket option to UDP only.

Risk Level: low
Testing: unit tests
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: mobile

---------

Signed-off-by: Fredy Wijaya <[email protected]>
Signed-off-by: asingh-g <[email protected]>
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