[ISSUE #3949] Fix configuration

This commit is contained in:
zhouxiang
2022-07-13 11:29:36 +08:00
parent 966672ab2d
commit 9fe1bbc4df
4 changed files with 17 additions and 35 deletions
@@ -80,11 +80,9 @@ public class ProxyConfig {
private int topicRouteServiceThreadPoolQueueCapacity = 5000;
private int topicConfigCacheExpiredInSeconds = 20;
private int topicConfigCacheExecutorThreadNum = 3;
private int topicConfigCacheExecutorQueueCapacity = 1000;
private int topicConfigCacheMaxNum = 20000;
private int topicConfigThreadPoolNums = 36;
private int topicConfigThreadPoolQueueCapacity = 50000;
private int metadataThreadPoolNums = 3;
private int metadataThreadPoolQueueCapacity = 1000;
private int transactionHeartbeatThreadPoolNums = 20;
private int transactionHeartbeatThreadPoolQueueCapacity = 200;
@@ -417,22 +415,6 @@ public class ProxyConfig {
this.topicConfigCacheExpiredInSeconds = topicConfigCacheExpiredInSeconds;
}
public int getTopicConfigCacheExecutorThreadNum() {
return topicConfigCacheExecutorThreadNum;
}
public void setTopicConfigCacheExecutorThreadNum(int topicConfigCacheExecutorThreadNum) {
this.topicConfigCacheExecutorThreadNum = topicConfigCacheExecutorThreadNum;
}
public int getTopicConfigCacheExecutorQueueCapacity() {
return topicConfigCacheExecutorQueueCapacity;
}
public void setTopicConfigCacheExecutorQueueCapacity(int topicConfigCacheExecutorQueueCapacity) {
this.topicConfigCacheExecutorQueueCapacity = topicConfigCacheExecutorQueueCapacity;
}
public int getTopicConfigCacheMaxNum() {
return topicConfigCacheMaxNum;
}
@@ -441,20 +423,20 @@ public class ProxyConfig {
this.topicConfigCacheMaxNum = topicConfigCacheMaxNum;
}
public int getTopicConfigThreadPoolNums() {
return topicConfigThreadPoolNums;
public int getMetadataThreadPoolNums() {
return metadataThreadPoolNums;
}
public void setTopicConfigThreadPoolNums(int topicConfigThreadPoolNums) {
this.topicConfigThreadPoolNums = topicConfigThreadPoolNums;
public void setMetadataThreadPoolNums(int metadataThreadPoolNums) {
this.metadataThreadPoolNums = metadataThreadPoolNums;
}
public int getTopicConfigThreadPoolQueueCapacity() {
return topicConfigThreadPoolQueueCapacity;
public int getMetadataThreadPoolQueueCapacity() {
return metadataThreadPoolQueueCapacity;
}
public void setTopicConfigThreadPoolQueueCapacity(int topicConfigThreadPoolQueueCapacity) {
this.topicConfigThreadPoolQueueCapacity = topicConfigThreadPoolQueueCapacity;
public void setMetadataThreadPoolQueueCapacity(int metadataThreadPoolQueueCapacity) {
this.metadataThreadPoolQueueCapacity = metadataThreadPoolQueueCapacity;
}
public int getTransactionHeartbeatThreadPoolNums() {
@@ -37,12 +37,12 @@ public abstract class AbstractMetadataService extends AbstractStartAndShutdown i
public AbstractMetadataService() {
ProxyConfig config = ConfigurationManager.getProxyConfig();
this.cacheRefreshExecutor = ThreadPoolMonitor.createAndMonitor(
config.getTopicConfigThreadPoolNums(),
config.getTopicConfigThreadPoolNums(),
config.getMetadataThreadPoolNums(),
config.getMetadataThreadPoolNums(),
1000 * 60,
TimeUnit.MILLISECONDS,
"MetadataCacheRefresh",
config.getTopicConfigThreadPoolQueueCapacity()
config.getMetadataThreadPoolQueueCapacity()
);
}
@@ -40,8 +40,8 @@ public class ClusterMetadataService extends AbstractMetadataService {
this.topicRouteService = topicRouteService;
ProxyConfig config = ConfigurationManager.getProxyConfig();
this.topicCache = CacheBuilder.newBuilder()
.maximumSize(config.getTopicRouteCacheMaxNum())
.refreshAfterWrite(config.getTopicRouteCacheExpiredInSeconds(), TimeUnit.SECONDS)
.maximumSize(config.getTopicConfigCacheMaxNum())
.refreshAfterWrite(config.getTopicConfigCacheExpiredInSeconds(), TimeUnit.SECONDS)
.build(new ClusterTopicConfigCacheLoader(mqClientAPIFactory));
}
@@ -34,8 +34,8 @@ public class LocalMetadataService extends AbstractMetadataService {
ProxyConfig config = ConfigurationManager.getProxyConfig();
this.topicCache = CacheBuilder.newBuilder()
.maximumSize(config.getTopicRouteCacheMaxNum())
.refreshAfterWrite(config.getTopicRouteCacheExpiredInSeconds(), TimeUnit.SECONDS)
.maximumSize(config.getTopicConfigCacheMaxNum())
.refreshAfterWrite(config.getTopicConfigCacheExpiredInSeconds(), TimeUnit.SECONDS)
.build(new LocalTopicConfigCacheLoader(brokerController));
}