提交 9d11b56c 编写于 作者: 傅冲 提交者: Li Zhanhui

Issue #311 improve broker register topicrouter info performance

上级 6eccf758
...@@ -741,7 +741,7 @@ public class BrokerController { ...@@ -741,7 +741,7 @@ public class BrokerController {
log.error("registerBrokerAll Exception", e); log.error("registerBrokerAll Exception", e);
} }
} }
}, 1000 * 10, 1000 * 30, TimeUnit.MILLISECONDS); }, 1000 * 10, Math.max(10000, Math.min(brokerConfig.getRegisterNameServerPeriod(), 60000)), TimeUnit.MILLISECONDS);
if (this.brokerStatsManager != null) { if (this.brokerStatsManager != null) {
this.brokerStatsManager.start(); this.brokerStatsManager.start();
......
...@@ -245,7 +245,10 @@ public class AdminBrokerProcessor implements NettyRequestProcessor { ...@@ -245,7 +245,10 @@ public class AdminBrokerProcessor implements NettyRequestProcessor {
topicConfig.setTopicSysFlag(requestHeader.getTopicSysFlag() == null ? 0 : requestHeader.getTopicSysFlag()); topicConfig.setTopicSysFlag(requestHeader.getTopicSysFlag() == null ? 0 : requestHeader.getTopicSysFlag());
this.brokerController.getTopicConfigManager().updateTopicConfig(topicConfig); this.brokerController.getTopicConfigManager().updateTopicConfig(topicConfig);
this.brokerController.registerBrokerAll(false, true, true);
if (brokerController.getBrokerConfig().getRegisterNameServerPeriod() == 0) {
this.brokerController.registerBrokerAll(false, true, true);
}
return null; return null;
} }
......
...@@ -136,6 +136,16 @@ public class BrokerConfig { ...@@ -136,6 +136,16 @@ public class BrokerConfig {
private boolean forceRegister = true; private boolean forceRegister = true;
/**
*
* This configurable item defines interval of topics registration of broker to name server. Allowing values are
* between 10, 000 and 60, 000 milliseconds.
*
* If set to 0, newly created topics will be immediately reported to name servers and interval of periodical
* registration defaults to 10, 000 in milliseconds.
*/
private int registerNameServerPeriod = 1000 * 30;
public boolean isTraceOn() { public boolean isTraceOn() {
return traceOn; return traceOn;
} }
...@@ -617,4 +627,12 @@ public class BrokerConfig { ...@@ -617,4 +627,12 @@ public class BrokerConfig {
public void setForceRegister(boolean forceRegister) { public void setForceRegister(boolean forceRegister) {
this.forceRegister = forceRegister; this.forceRegister = forceRegister;
} }
public int getRegisterNameServerPeriod() {
return registerNameServerPeriod;
}
public void setRegisterNameServerPeriod(int registerNameServerPeriod) {
this.registerNameServerPeriod = registerNameServerPeriod;
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册