-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
I will add an exception to prevent the client from retrying. However, clients with lower versions will try to reconnect and eventually time out. |
@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. |
There was a problem hiding this 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?
Co-authored-by: Yu Liu <50226895+Anonymitaet@users.noreply.github.com>
Co-authored-by: Yu Liu <50226895+Anonymitaet@users.noreply.github.com>
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BrokerServiceTest.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionsLimiter.java
Outdated
Show resolved
Hide resolved
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 |
@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! |
Hello, please take a look again @gaoran10 @cckellogg If there are no other questions, can you approve it? |
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ConnectionController.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grade Jobs
### 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)
@315157973:Thanks for your contribution. For this PR, do we need to update docs? |
@315157973:Thanks for your contribution. For this PR, do we need to update docs? |
@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? |
@315157973 No. |
### 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.
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