You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/03/26 14:13:45 UTC
[GitHub] [pulsar] AnonHxy opened a new pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
AnonHxy opened a new pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890
### Motivation
update broker-level subscribe-rate limter
### Modifications
- Invoked` org.apache.pulsar.broker.service.BrokerService#registerConfigurationListener` to register listeners
about `subscribeThrottlingRatePerConsumer` and `subscribeRatePeriodPerConsumerInSecond`
- Also add `org.apache.pulsar.broker.service.AbstractTopic#updateSubscribeRate` to update subscribe rate
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- Added UT class `org.apache.pulsar.broker.service.SubscribeRateTest`
### Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
- [x] `no-need-doc`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] RobertIndie commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
RobertIndie commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r836262375
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -185,7 +185,6 @@
public boolean msgChunkPublished;
private Optional<DispatchRateLimiter> dispatchRateLimiter = Optional.empty();
- private Optional<SubscribeRateLimiter> subscribeRateLimiter = Optional.empty();
Review comment:
But the `subscribeRateLimiter` seems only work on persistent topics. Could we only make it update on persistent topics?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1082539875
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [fix][broker] Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1086549992
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on a change in pull request #14890: [bugfix][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r839130757
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SubscribeRateTest.java
##########
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.service;
+
+import org.apache.pulsar.broker.service.persistent.SubscribeRateLimiter;
+import org.awaitility.Awaitility;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Test(groups = "broker")
+public class SubscribeRateTest extends BrokerTestBase{
+
+ @Override
+ protected void setup() throws Exception {
+ //No-op
+ }
+
+ @Override
+ protected void cleanup() throws Exception {
+ //No-op
+ }
+
+ @Test
+ public void testBrokerLevelSubscribeRateDynamicUpdate() throws Exception {
+ conf.setTopicLevelPoliciesEnabled(true);
+ conf.setSystemTopicEnabled(true);
+ conf.setMaxPendingPublishRequestsPerConnection(0);
+ super.baseSetup();
+ final String topic = "persistent://prop/ns-abc/testBrokerLevelSubscribeRateDynamicUpdate";
+ org.apache.pulsar.client.api.Producer<byte[]> producer = pulsarClient.newProducer()
+ .topic(topic)
+ .producerName("producer-name")
+ .create();
+
+ Topic topicRef = pulsar.getBrokerService().getTopicReference(topic).get();
+ Assert.assertNotNull(topicRef);
+ Assert.assertFalse(topicRef.getSubscribeRateLimiter().isPresent());
Review comment:
OK, PTAL@Jason918
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [fix][broker] Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1086498380
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [fix][broker] Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1086594712
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Jason918 commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
Jason918 commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r838503641
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SubscribeRateTest.java
##########
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.service;
+
+import org.apache.pulsar.broker.service.persistent.SubscribeRateLimiter;
+import org.awaitility.Awaitility;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Test(groups = "broker")
+public class SubscribeRateTest extends BrokerTestBase{
+
+ @Override
+ protected void setup() throws Exception {
+ //No-op
+ }
+
+ @Override
+ protected void cleanup() throws Exception {
+ //No-op
+ }
+
+ @Test
+ public void testBrokerLevelSubscribeRateDynamicUpdate() throws Exception {
+ conf.setTopicLevelPoliciesEnabled(true);
+ conf.setSystemTopicEnabled(true);
+ conf.setMaxPendingPublishRequestsPerConnection(0);
+ super.baseSetup();
+ final String topic = "persistent://prop/ns-abc/testBrokerLevelSubscribeRateDynamicUpdate";
+ org.apache.pulsar.client.api.Producer<byte[]> producer = pulsarClient.newProducer()
+ .topic(topic)
+ .producerName("producer-name")
+ .create();
+
+ Topic topicRef = pulsar.getBrokerService().getTopicReference(topic).get();
+ Assert.assertNotNull(topicRef);
+ Assert.assertFalse(topicRef.getSubscribeRateLimiter().isPresent());
Review comment:
we should verify the init value first.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [bugfix][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1084331622
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [fix][broker] Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1085817110
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1081771028
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1081514354
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1079834339
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r837144287
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -185,7 +185,6 @@
public boolean msgChunkPublished;
private Optional<DispatchRateLimiter> dispatchRateLimiter = Optional.empty();
- private Optional<SubscribeRateLimiter> subscribeRateLimiter = Optional.empty();
Review comment:
OK, PTAL :) @RobertIndie
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] RobertIndie commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
RobertIndie commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r836035624
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -185,7 +185,6 @@
public boolean msgChunkPublished;
private Optional<DispatchRateLimiter> dispatchRateLimiter = Optional.empty();
- private Optional<SubscribeRateLimiter> subscribeRateLimiter = Optional.empty();
Review comment:
Why move `subscribeRateLimiter` to the AbstractTopic?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1081663361
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] Jason918 commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
Jason918 commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r838503177
##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/SubscribeRateTest.java
##########
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pulsar.broker.service;
+
+import org.apache.pulsar.broker.service.persistent.SubscribeRateLimiter;
+import org.awaitility.Awaitility;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Test(groups = "broker")
+public class SubscribeRateTest extends BrokerTestBase{
Review comment:
```suggestion
public class SubscribeRateTest extends BrokerTestBase {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1079822390
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on a change in pull request #14890: [feat][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on a change in pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#discussion_r836059721
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -185,7 +185,6 @@
public boolean msgChunkPublished;
private Optional<DispatchRateLimiter> dispatchRateLimiter = Optional.empty();
- private Optional<SubscribeRateLimiter> subscribeRateLimiter = Optional.empty();
Review comment:
This can uniform the limiters to `AbstractTopic` and we can update it like [updateSubscribeRate](https://github.com/apache/pulsar/pull/14890/files?diff=split&w=0#diff-0210356c8a88e4efa89eb769a027fa6c166db479dbad8bbbbc704c6ed6e317f5R2337)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] AnonHxy commented on pull request #14890: [bugfix][broker]Dynamic update broker-level subscribe-rate limter
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on pull request #14890:
URL: https://github.com/apache/pulsar/pull/14890#issuecomment-1085342614
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org