Skip to content

[improve][broker] Failed to start broker when Linux load balancer can't get NIC speed - #14648

Merged
eolivelli merged 11 commits into
apache:masterfrom
mattisonchao:loadbalance_fast_fail
Apr 13, 2022
Merged

eolivelli merged 11 commits into
apache:masterfrom
mattisonchao:loadbalance_fast_fail

Conversation

@mattisonchao

Copy link
Copy Markdown
Member

Motivation

The context here: #14537

The current design is frequently logging an error while ignoring the NIC. The only real course of action for an operator is to reconfigure the broker. It seems like a better course of action to fail on startup so that operators know immediately that they need to fix the configuration instead of finding out sometime later when observing the logs.

Modifications

  • Verify whether VM has NIC speed.
  • Refactor LinuxBrokerHostUsageImpl and extract some Linux operate to another class.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • no-need-doc

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Mar 11, 2022
@gaozhangmin

Copy link
Copy Markdown
Contributor

linux host has many NICs, There are some NIC that are of type 1 that doesn't expose the speed.

I think if let broker fail it's not a good idea. @mattisonchao

@mattisonchao

Copy link
Copy Markdown
Member Author

@gaozhangmin

If the Linux host has a legitimate NIC but doesn't have the speed. Regardless of how many NICs have speed, we should notify the user to set loadBalancerOverrideBrokerNicSpeedGbps to ensure that the user gets what they expect.

@mattisonchao

Copy link
Copy Markdown
Member Author

@nicoloboschi @eolivelli @michaeljmarshall please continue to take a look from #14537.

@nicoloboschi nicoloboschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall LGTM, but I have few questions:

  1. We should add unit tests for checking the logic
  2. What if I run the Pulsar tests within a machina with NIC without 'speed' file? The test will fail ?
    For instance, I've seen this kind of NIC inside a ubuntu VM with docker installed

@Nicklee007

Copy link
Copy Markdown
Contributor

@gaozhangmin

If the Linux host has a legitimate NIC but doesn't have the speed. Regardless of how many NICs have speed, we should notify the user to set loadBalancerOverrideBrokerNicSpeedGbps to ensure that the user gets what they expect.

@mattisonchao
I think that we need check all NIC's speed configuration is too strict to start server. In some case we only used eth0 and the eth1 eth2 ... ... not active, but those /sys/class/net/eth1/type configured '1' and read 'speed' file is 'Invalid argument';
Maybe those not active NIC need excluded from the NICs list which is checked 'speed' file and calculated speed.

@mattisonchao mattisonchao changed the title Failed to start broker when Linux load balancer can't get NIC speed [enh][broker] Failed to start broker when Linux load balancer can't get NIC speed Mar 18, 2022
@mattisonchao
mattisonchao marked this pull request as draft March 26, 2022 05:44
@mattisonchao
mattisonchao marked this pull request as ready for review April 5, 2022 02:49
@mattisonchao

mattisonchao commented Apr 5, 2022 •

Copy link
Copy Markdown
Member Author

Hi, @Nicklee007 @gaozhangmin @nicoloboschi

I changed the logic to fail to start the broker when we can't get the NIC speed (<= 0).

@Jason918
Jason918 self-requested a review April 5, 2022 03:07
@mattisonchao mattisonchao changed the title [enh][broker] Failed to start broker when Linux load balancer can't get NIC speed [improve][broker] Failed to start broker when Linux load balancer can't get NIC speed Apr 5, 2022
@mattisonchao

Copy link
Copy Markdown
Member Author

Hi, @nicoloboschi
I have already added tests for this logic.

@Jason918 Jason918 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall LGTM

@mattisonchao

Copy link
Copy Markdown
Member Author

/pulsarbot rerun-failure-checks

@mattisonchao

Copy link
Copy Markdown
Member Author

@nicoloboschi @gaozhangmin PTAL:)

@codelipenghui codelipenghui added this to the 2.11.0 milestone Apr 12, 2022

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Great work

@eolivelli
eolivelli merged commit f3ad09e into apache:master Apr 13, 2022
aparajita89 pushed a commit to aparajita89/pulsar that referenced this pull request Apr 18, 2022
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
@ZiyaoWei

Copy link
Copy Markdown
Contributor

I'm trying to set up a dev environment using an AWS EC2 instance (tired of fighting my M1 MBP 🥲), but (as @nicoloboschi mentioned) the tests are failing due to not having NIC speed information:

ubuntu@ip-172-31-68-254:~/pulsar$ cat /sys/class/net/eth0/speed
cat: /sys/class/net/eth0/speed: Invalid argument

I opened #15263 trying to fix the tests but there are way too many of them - I prefer having the tests not depending on external factors, so maybe we should either fix the tests (which isn't too practical since people would add new tests without specifying NIC speed information) or somehow let the tests skip this check?

lhotari added a commit to lhotari/pulsar that referenced this pull request Apr 28, 2022
- changes in apache#14648 broke running of tests on Linux when there's no ethernet connection
@lhotari

lhotari commented Apr 28, 2022

Copy link
Copy Markdown
Member

This broke unit tests on Linux when there's no ethernet connection. I fixed the problem for all unit tests in #15365 .

lhotari added a commit to lhotari/pulsar that referenced this pull request Apr 28, 2022
- changes in apache#14648 broke running of tests on Linux when there's no ethernet connection
lhotari added a commit that referenced this pull request Apr 29, 2022
…5365)

- changes in #14648 broke running of tests on Linux when there's no ethernet connection
@duxugang

Copy link
Copy Markdown

I ran into the same problem with version 2.10

@mattisonchao

Copy link
Copy Markdown
Member Author

@duxugang Hi, this PR does not cherry-pick to branch-2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants