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

lightway-app-utils: iouring: Make sqpoll idle time configurable #125

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

xv-ian-c
Copy link
Contributor

Description

Make it configurable and plumb it all the way through to the config file. The default remains 100ms.

Motivation and Context

This is a useful tunable to play with when trading CPU use vs performance.

How Has This Been Tested?

Observing the behaviour using htop and in particular observing that with it set to 0 no kernel thread is created.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • The correct base branch is being used, if not main

@xv-ian-c xv-ian-c requested a review from a team as a code owner November 13, 2024 10:11
Copy link

github-actions bot commented Nov 13, 2024

Code coverage summary for 2755fac:

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lightway-app-utils/src/args/cipher.rs                              7                 7     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
lightway-app-utils/src/args/connection_type.rs                     7                 7     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
lightway-app-utils/src/args/duration.rs                           10                10     0.00%           7                 7     0.00%          15                15     0.00%           0                 0         -
lightway-app-utils/src/args/ip_map.rs                             11                11     0.00%           3                 3     0.00%          15                15     0.00%           0                 0         -
lightway-app-utils/src/args/logging.rs                            20                20     0.00%           4                 4     0.00%          18                18     0.00%           0                 0         -
lightway-app-utils/src/connection_ticker.rs                       44                 4    90.91%          17                 2    88.24%         156                 5    96.79%           0                 0         -
lightway-app-utils/src/dplpmtud_timer.rs                          70                 7    90.00%          22                 4    81.82%         282                11    96.10%           0                 0         -
lightway-app-utils/src/event_stream.rs                             6                 0   100.00%           3                 0   100.00%          13                 0   100.00%           0                 0         -
lightway-app-utils/src/iouring.rs                                170               149    12.35%          26                17    34.62%         328               300     8.54%           0                 0         -
lightway-app-utils/src/metrics.rs                                 18                18     0.00%          18                18     0.00%          36                36     0.00%           0                 0         -
lightway-app-utils/src/sockopt/ip_mtu_discover.rs                 23                23     0.00%           4                 4     0.00%          93                93     0.00%           0                 0         -
lightway-app-utils/src/sockopt/ip_pktinfo.rs                       4                 4     0.00%           1                 1     0.00%          16                16     0.00%           0                 0         -
lightway-app-utils/src/tun.rs                                     82                82     0.00%          22                22     0.00%          94                94     0.00%           0                 0         -
lightway-app-utils/src/utils.rs                                   13                13     0.00%           1                 1     0.00%          11                11     0.00%           0                 0         -
lightway-client/src/args.rs                                       35                35     0.00%          29                29     0.00%          36                36     0.00%           0                 0         -
lightway-client/src/io/inside/tun.rs                              42                42     0.00%           7                 7     0.00%          48                48     0.00%           0                 0         -
lightway-client/src/io/outside/tcp.rs                             50                50     0.00%          10                10     0.00%          45                45     0.00%           0                 0         -
lightway-client/src/io/outside/udp.rs                             63                63     0.00%          12                12     0.00%          61                61     0.00%           0                 0         -
lightway-client/src/keepalive.rs                                 277                49    82.31%          56                 8    85.71%         372                26    93.01%           0                 0         -
lightway-client/src/lib.rs                                       188               188     0.00%          20                20     0.00%         273               273     0.00%           0                 0         -
lightway-client/src/main.rs                                       49                49     0.00%           7                 7     0.00%         166               166     0.00%           0                 0         -
lightway-core/src/borrowed_bytesmut.rs                            87                 1    98.85%          24                 0   100.00%         196                 1    99.49%           0                 0         -
lightway-core/src/builder_predicates.rs                           20                10    50.00%           4                 2    50.00%          32                16    50.00%           0                 0         -
lightway-core/src/cipher.rs                                       10                 0   100.00%           4                 0   100.00%          14                 0   100.00%           0                 0         -
lightway-core/src/connection.rs                                  481               233    51.56%          48                19    60.42%         660               278    57.88%           0                 0         -
lightway-core/src/connection/builders.rs                          63                23    63.49%          18                 7    61.11%         223                54    75.78%           0                 0         -
lightway-core/src/connection/dplpmtud.rs                         767                90    88.27%          69                 1    98.55%         950                11    98.84%           0                 0         -
lightway-core/src/connection/fragment_map.rs                     139                11    92.09%          29                 0   100.00%         292                 7    97.60%           0                 0         -
lightway-core/src/connection/io_adapter.rs                       149                17    88.59%          42                 5    88.10%         319                23    92.79%           0                 0         -
lightway-core/src/connection/key_update.rs                        23                 7    69.57%           5                 0   100.00%          38                19    50.00%           0                 0         -
lightway-core/src/context.rs                                      93                25    73.12%          26                 7    73.08%         199                40    79.90%           0                 0         -
lightway-core/src/context/ip_pool.rs                               7                 3    57.14%           1                 0   100.00%           6                 0   100.00%           0                 0         -
lightway-core/src/context/server_auth.rs                          14                11    21.43%           4                 3    25.00%          24                20    16.67%           0                 0         -
lightway-core/src/io.rs                                            3                 3     0.00%           3                 3     0.00%          10                10     0.00%           0                 0         -
lightway-core/src/lib.rs                                           9                 6    33.33%           4                 1    75.00%          18                 9    50.00%           0                 0         -
lightway-core/src/metrics.rs                                       9                 9     0.00%           7                 7     0.00%          17                17     0.00%           0                 0         -
lightway-core/src/packet.rs                                       27                 7    74.07%           4                 1    75.00%          30                 6    80.00%           0                 0         -
lightway-core/src/plugin.rs                                       70                 8    88.57%          25                 5    80.00%         162                 9    94.44%           0                 0         -
lightway-core/src/utils.rs                                       111                19    82.88%          26                 0   100.00%         184                11    94.02%           0                 0         -
lightway-core/src/version.rs                                      49                 0   100.00%          24                 0   100.00%          94                 0   100.00%           0                 0         -
lightway-core/src/wire.rs                                        154                19    87.66%          39                 0   100.00%         263                 2    99.24%           0                 0         -
lightway-core/src/wire/auth_failure.rs                             9                 1    88.89%           3                 0   100.00%          19                 0   100.00%           0                 0         -
lightway-core/src/wire/auth_request.rs                           152                12    92.11%          37                 0   100.00%         290                 0   100.00%           0                 0         -
lightway-core/src/wire/auth_success_with_config_ipv4.rs           69                 4    94.20%          13                 0   100.00%         145                 0   100.00%           0                 0         -
lightway-core/src/wire/data.rs                                    21                 1    95.24%           7                 0   100.00%          43                 0   100.00%           0                 0         -
lightway-core/src/wire/data_frag.rs                               47                 1    97.87%          19                 0   100.00%          94                 0   100.00%           0                 0         -
lightway-core/src/wire/ping.rs                                    24                 3    87.50%           8                 0   100.00%          69                 0   100.00%           0                 0         -
lightway-core/src/wire/pong.rs                                    15                 2    86.67%           5                 0   100.00%          34                 0   100.00%           0                 0         -
lightway-core/src/wire/server_config.rs                           20                 2    90.00%           5                 0   100.00%          44                 0   100.00%           0                 0         -
lightway-server/src/args.rs                                       30                30     0.00%          28                28     0.00%          28                28     0.00%           0                 0         -
lightway-server/src/auth.rs                                      109                36    66.97%          21                 5    76.19%         150                28    81.33%           0                 0         -
lightway-server/src/connection.rs                                 50                50     0.00%          23                23     0.00%         107               107     0.00%           0                 0         -
lightway-server/src/connection_manager.rs                        105               105     0.00%          34                34     0.00%         217               217     0.00%           0                 0         -
lightway-server/src/connection_manager/connection_map.rs          90                 9    90.00%          27                 2    92.59%         274                 9    96.72%           0                 0         -
lightway-server/src/io/inside/tun.rs                              28                28     0.00%           8                 8     0.00%          34                34     0.00%           0                 0         -
lightway-server/src/io/outside/tcp.rs                             78                78     0.00%          10                10     0.00%          85                85     0.00%           0                 0         -
lightway-server/src/io/outside/udp.rs                            136               136     0.00%          18                18     0.00%         247               247     0.00%           0                 0         -
lightway-server/src/io/outside/udp/cmsg.rs                        47                16    65.96%          14                 5    64.29%         233                56    75.97%           0                 0         -
lightway-server/src/ip_manager.rs                                 82                25    69.51%          19                 4    78.95%         254                28    88.98%           0                 0         -
lightway-server/src/ip_manager/ip_pool.rs                        101                 1    99.01%          32                 0   100.00%         305                 0   100.00%           0                 0         -
lightway-server/src/lib.rs                                        94                94     0.00%          11                11     0.00%         143               143     0.00%           0                 0         -
lightway-server/src/main.rs                                       67                67     0.00%           9                 9     0.00%         171               171     0.00%           0                 0         -
lightway-server/src/metrics.rs                                    84                82     2.38%          75                73     2.67%         193               189     2.07%           0                 0         -
lightway-server/src/statistics.rs                                 56                24    57.14%           9                 4    55.56%         104                42    59.62%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                           4988              2140    57.10%        1114               475    57.36%        9104              3198    64.87%           0                 0         -

✅ Region coverage 57% passes
✅ Line coverage 64% passes

This is a useful tunable to play with when trading CPU use vs performance.
@xv-ian-c xv-ian-c force-pushed the CVPN-1590-uring-configure-sqpoll branch from 665e62c to 2755fac Compare November 13, 2024 10:25
/// IO-uring sqpoll idle time. If non-zero use a kernel thread to
/// perform submission queue polling. After the given idle time
/// the thread will go to sleep.
#[clap(long, default_value = "100ms")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Think it is better if we should do a sanity check for this value for upper bound like 1 or 2 seconds.
Setting this as large value will make CPU run 100% for longer time.

What do you think ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think sysadmins need to understand the consequences of fiddling with these kinds of low level tunables.

Copy link
Contributor

@kp-mariappan-ramasamy kp-mariappan-ramasamy left a comment

Choose a reason for hiding this comment

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

LGTM except boundary check

@xv-ian-c xv-ian-c merged commit f624e71 into main Nov 14, 2024
11 checks passed
@xv-ian-c xv-ian-c deleted the CVPN-1590-uring-configure-sqpoll branch November 14, 2024 08:12
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.

3 participants