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

Support max-connection and max-connection-per-IP #10754

Merged
merged 24 commits into from
Jul 7, 2021

Conversation

315157973
Copy link
Contributor

@315157973 315157973 commented May 31, 2021

Motivation

Pulsar supports multi-tenant, and there may be one single user occupying all connections.
Maybe novice user incorrectly used SDK, or we are being attacked.
In order to avoid a single user to affect entire cluster, I think it is important to limit the number of connections.
For simplicity, I did not use radix tree to save IPs.

Modifications

Verifying this change

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

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

Great work!

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

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

I have some concerns, if connections reach the limitation, the rejected client will re-connect many times and this may confuse users.

Maybe we could make clients receive this connection limit exception and cancel the retry operation, this will also make users know why the client failed to connect with the broker.

@315157973 315157973 self-assigned this May 31, 2021
@315157973
Copy link
Contributor Author

I have some concerns, if connections reach the limitation, the rejected client will re-connect many times and this may confuse users.

Maybe we could make clients receive this connection limit exception and cancel the retry operation, this will also make users know why the client failed to connect with the broker.

I will add an exception to prevent the client from retrying. However, clients with lower versions will try to reconnect and eventually time out.

@Anonymitaet
Copy link
Member

@315157973 thanks for your contribution. For this PR, do we need to update docs?

@315157973
Copy link
Contributor Author

@315157973 thanks for your contribution. For this PR, do we need to update docs?

The documentation here should be automatically generated, right? There are comments on the code.

Copy link
Member

@Anonymitaet Anonymitaet left a comment

Choose a reason for hiding this comment

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

@315157973 thanks for your contribution. For this PR, do we need to update docs?

The documentation here should be automatically generated, right? There are comments on the code.

Docs need to be added here as well?

conf/broker.conf Outdated Show resolved Hide resolved
conf/broker.conf Outdated Show resolved Hide resolved
315157973 and others added 2 commits June 1, 2021 19:36
Co-authored-by: Yu Liu <50226895+Anonymitaet@users.noreply.github.com>
Co-authored-by: Yu Liu <50226895+Anonymitaet@users.noreply.github.com>
@Anonymitaet
Copy link
Member

@315157973 thanks for your contribution. For this PR, do we need to update docs?

The documentation here should be automatically generated, right? There are comments on the code.

Docs need to be added here as well?

Hi @315157973 any feedback on this? thanks

@315157973
Copy link
Contributor Author

@315157973 thanks for your contribution. For this PR, do we need to update docs?

The documentation here should be automatically generated, right? There are comments on the code.

Docs need to be added here as well?

Hi @315157973 any feedback on this? thanks

I’m not so sure, it seems to be automatically generated, only 2.7 and previous documents are seen in the code

@Anonymitaet
Copy link
Member

Anonymitaet commented Jun 3, 2021

@315157973 this should be generated automatically, we have an issue requesting this feature before. However, it is not implemented yet.

I find that you've developed a tool to automatically generate documents for pulsar-client, that's awesome!
Would you like to develop a similar one to automatically generate documents for pulsar configuration page? That would be super helpful for both developers and tech writers! Many thanks!

@315157973
Copy link
Contributor Author

Hello, please take a look again @gaoran10 @cckellogg If there are no other questions, can you approve it?

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

Grade Jobs

@wolfstudy wolfstudy merged commit 45caffa into apache:master Jul 7, 2021
@codelipenghui codelipenghui added this to the 2.9.0 milestone Jul 7, 2021
@315157973 315157973 deleted the max-connections branch July 19, 2021 11:10
codelipenghui pushed a commit that referenced this pull request Oct 28, 2021
### Motivation

Pulsar supports multi-tenant, and there may be one single user occupying all connections.
Maybe novice user incorrectly used SDK, or we are being attacked.
In order to avoid a single user to affect entire cluster, I think it is important to limit the number of connections.
For simplicity, I did not use radix tree to save IPs.

(cherry picked from commit 45caffa)
@github-actions
Copy link

@315157973:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions
Copy link

@315157973:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@315157973
Copy link
Contributor Author

@Anonymitaet Hello, I remember that we made a tool for automatic document generation before, and the document of this new feature should be automatically generated. Do we still need to write manually now?

@Anonymitaet
Copy link
Member

@315157973 No.
Sorry above is a bug in doc Bot, please ignore it, we're fixing this issue.

@Anonymitaet Anonymitaet added doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. and removed doc-label-missing labels Nov 11, 2021
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation

Pulsar supports multi-tenant, and there may be one single user occupying all connections.
Maybe novice user incorrectly used SDK, or we are being attacked.
In order to avoid a single user to affect entire cluster, I think it is important to limit the number of connections.
For simplicity, I did not use radix tree to save IPs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-2.8 Archived: 2.8 is end of life doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. release/2.8.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants