Skip to content

[fix][broker] Revert #14829 Filter the virtual NIC with relative path - #18812

Merged
Technoboy- merged 3 commits into
apache:masterfrom
mattisonchao:revert_14829
Dec 8, 2022
Merged

Technoboy- merged 3 commits into
apache:masterfrom
mattisonchao:revert_14829

Conversation

@mattisonchao

@mattisonchao mattisonchao commented Dec 8, 2022 •

Copy link
Copy Markdown
Member

Motivation

As #14820 (comment) mentioned, we need to revert this change to fix regression.

For the original issue, the workaround fix is he can divide the target by two. for the fixing, I would like to start a discussion, and I suggest introducing the new config to fix this problem.

Modifications

  • Revert 14829

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

I'm not sure if we need to notice this problem.

  • doc-not-needed

@github-actions

github-actions Bot commented Dec 8, 2022

Copy link
Copy Markdown

@mattisonchao Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@mattisonchao

Copy link
Copy Markdown
Member Author

@codelipenghui @eolivelli @lhotari @Jason918 @Technoboy- @zengguan Please take a look.

@mattisonchao mattisonchao added release/blocker Indicate the PR or issue that should block the release until it gets resolved and removed doc-label-missing labels Dec 8, 2022
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Dec 8, 2022
@mattisonchao mattisonchao added release/2.11.1 release/2.10.3 release/2.9.5 and removed doc-not-needed Your PR changes do not impact docs labels Dec 8, 2022
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Dec 8, 2022
@mattisonchao mattisonchao added this to the 2.12.0 milestone Dec 8, 2022
@Technoboy- Technoboy- changed the title Revert #14829 Filter the virtual NIC with relative path [fix][broker] Revert #14829 Filter the virtual NIC with relative path Dec 8, 2022
@Technoboy- Technoboy- closed this Dec 8, 2022
@Technoboy- Technoboy- reopened this Dec 8, 2022
@codecov-commenter

codecov-commenter commented Dec 8, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #18812 (2624a2a) into master (68ca60c) will decrease coverage by 3.12%.
The diff coverage is 16.66%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18812      +/-   ##
============================================
- Coverage     50.05%   46.93%   -3.13%     
- Complexity    11024    11169     +145     
============================================
  Files           703      763      +60     
  Lines         68814    73622    +4808     
  Branches       7378     7923     +545     
============================================
+ Hits          34446    34552     +106     
- Misses        30621    35237    +4616     
- Partials       3747     3833      +86     
Flag Coverage Δ
unittests 46.93% <16.66%> (-3.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ache/pulsar/broker/loadbalance/LinuxInfoUtils.java 26.74% <0.00%> (-8.14%) ⬇️
...r/stats/prometheus/PrometheusMetricsGenerator.java 0.00% <0.00%> (-67.40%) ⬇️
...ersistentStickyKeyDispatcherMultipleConsumers.java 55.39% <25.00%> (-6.99%) ⬇️
...n/java/org/apache/pulsar/broker/admin/v3/Sink.java 0.00% <0.00%> (-100.00%) ⬇️
...java/org/apache/pulsar/broker/admin/v3/Source.java 0.00% <0.00%> (-100.00%) ⬇️
...a/org/apache/pulsar/broker/admin/v3/Functions.java 0.00% <0.00%> (-100.00%) ⬇️
...ar/broker/stats/prometheus/ManagedLedgerStats.java 0.00% <0.00%> (-100.00%) ⬇️
...oker/stats/prometheus/PrometheusMetricStreams.java 0.00% <0.00%> (-100.00%) ⬇️
.../stats/prometheus/AggregatedSubscriptionStats.java 0.00% <0.00%> (-100.00%) ⬇️
...metheus/AggregatedTransactionCoordinatorStats.java 0.00% <0.00%> (-100.00%) ⬇️
... and 159 more

@grssam

grssam commented Dec 8, 2022

Copy link
Copy Markdown
Contributor

@mattisonchao Hello. As I understand the core issue --

the property loadBalancerOverrideBrokerNicSpeedGbps was introduced because certain VM (and also true for k8s world) the max nic speed reported in the /sys/class/net/%s/speed was incorrect, so the property helped define the max speed limit. Then it was later found out that using all of the nics present inside the /sys/class/net/%s do not correctly represent the actual rx and tx of the broker and thus the /virtual/ ones were removed.

These assumptions are actually correct most of the times. For instance, with the change introduced in this PR, now both of the eth0 and lo would be counted towards current rx and tx of the broker host.. which is also incorrect, as the lo represents internal local rx/tx between processes and 127.0.0.1 and thus, only eth0's rx and tx should be counted towards network io.

My suggestion to fix this would be following:

  • Keep relying on loadBalancerOverrideBrokerNicSpeedGbps config for max rx/tx of the broker.
  • Keep filtering out /virtual/ nics.
  • Introduce another config loadBalancerOverrideBrokerWhitelistedNics as a comma separated list of nics to be considered for calculating actual rx/tx.

that way, in our example :

pulsar@pulsar-broker-6:~$ ls -larth /sys/class/net/
total 0
drwxr-xr-x 29 root root 0 Oct 31 18:08 ..
drwxr-xr-x  2 root root 0 Oct 31 18:08 .
lrwxrwxrwx  1 root root 0 Oct 31 18:08 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx  1 root root 0 Oct 31 18:08 eth0 -> ../../devices/virtual/net/eth0

we will set the config loadBalancerOverrideBrokerWhitelistedNics to eth0 (even this name is not fixed across debian versions for us) and the config loadBalancerOverrideBrokerNicSpeedGbps to the correct software (k8s) imposed network limits.

Please let me know if this sounds good?

@mattisonchao

Copy link
Copy Markdown
Member Author

@grssam

Oh, sorry, I missed the RX and TX.

Please let me know if this sounds good?

Yes, I like this approach. and It would be better if we could set different NIC speeds.

By the way, I revert this PR just want to ensure the load balancer can work like before. Because the current behaviour of this component looks like isn't working in k8s env. (I do not very confirm this problem, please correct me if I missing something)

@grssam

grssam commented Dec 8, 2022

Copy link
Copy Markdown
Contributor

Yes, I like this approach. and It would be better if we could set different NIC speeds.

Yes, would be good to have different NIC speed override. Since the config loadBalancerOverrideBrokerNicSpeedGbps gets multiplied by number of nics, which is also incorrect in k8s world. the lo is just a loopback interface as the packets are addressed to localhost and they are generally not limited by any max limit.

By the way, I revert this PR just want to ensure the load balancer can work like before. Because the current behaviour of this component looks like isn't working in k8s env. (I do not very confirm this problem, please correct me if I missing something)

Sure, please go ahead with the revert, and your understanding is correct that currently, in k8s pods, the network speeds are not monitored.

@mattisonchao

Copy link
Copy Markdown
Member Author

@grssam

Thanks a lot for your professional suggestion. I will point out this approach in ML after this PR gets merged.

@grssam

grssam commented Dec 8, 2022

Copy link
Copy Markdown
Contributor

Thanks a lot for your professional suggestion. I will point out this approach in ML after this PR gets merged.

@mattisonchao Sorry for the confusion, but what is ML? :)

@mattisonchao

Copy link
Copy Markdown
Member Author

@grssam

Sorry for the confusion, but what is ML

Apache pulsar mail list, https://lists.apache.org/[email protected]

@mattisonchao

Copy link
Copy Markdown
Member Author

wait for #18818

@grssam

grssam commented Dec 11, 2022

Copy link
Copy Markdown
Contributor

Should this and related change #18818 not go into 2.9 and 2.10 branches as well?

@mattisonchao

Copy link
Copy Markdown
Member Author

@grssam No, #18818 just affect 2.11+

@grssam

grssam commented Dec 12, 2022

Copy link
Copy Markdown
Contributor

@mattisonchao I see, yes that one seem to be 2.11+ only, but this one should be cherry-picked to 2.9 and 2.10

@Technoboy- Technoboy- added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Dec 12, 2022
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Dec 26, 2022
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Dec 29, 2022
lifepuzzlefun pushed a commit to lifepuzzlefun/pulsar that referenced this pull request Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/branch-2.9 Archived: 2.9 is end of life cherry-picked/branch-2.10 cherry-picked/branch-2.11 doc-not-needed Your PR changes do not impact docs ready-to-test release/blocker Indicate the PR or issue that should block the release until it gets resolved release/2.9.5 release/2.10.3 release/2.11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants