Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
jackie-coming committed Nov 27, 2024
1 parent 8cafda2 commit 72676c0
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ConfigService configService() {
}
if(bizConfig.isConfigServiceChangeCacheEnabled()){
return new ConfigServiceWithChangeCache(releaseService, releaseMessageService,
grayReleaseRulesHolder(), bizConfig, meterRegistry);
grayReleaseRulesHolder(), bizConfig, meterRegistry);
}
return new DefaultConfigService(releaseService, grayReleaseRulesHolder());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ public ConfigServiceWithChangeCache(final ReleaseService releaseService,

@PostConstruct
public void initialize() {
buildReleaseKeyCache();
super.initialize();
buildReleaseCache();
}

private void buildReleaseKeyCache() {
private void buildReleaseCache() {

CacheBuilder releasesCacheBuilder = CacheBuilder.newBuilder()
.expireAfterAccess(DEFAULT_EXPIRED_AFTER_ACCESS_IN_SencondS, TimeUnit.SECONDS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ VALUES
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关', 'default', '1970-01-01 00:00:00'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制', 'default', '1970-01-01 00:00:00'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制', 'default', '1970-01-01 00:00:00'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00');
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00'),
('config-service.change.cache.enabled', 'default', 'false', 'ConfigService是否开启客户端同步增量配置,开启后能提高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00');
CREATE ALIAS IF NOT EXISTS UNIX_TIMESTAMP FOR "com.ctrip.framework.apollo.common.jpa.H2Function.unixTimestamp";
17 changes: 17 additions & 0 deletions docs/en/deployment/distributed-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1627,3 +1627,20 @@ json
}
```
The above configuration specifies that the retention size for release history of appId=kl, clusterName=bj, namespaceName=namespace1, and branchName=bj is 10, and the retention size for release history of appId=kl, clusterName=bj, namespaceName=namespace2, and branchName=bj is 20. In general, branchName equals clusterName. It is only different during gray release, where the branchName needs to be confirmed by querying the ReleaseHistory table in the database.

### 3.2.14 config-service.change.cache.enabled - whether to enable incremental configuration synchronization client

> for server versions 2.4.0 and above && client versions 2.3.0 and above
This is a function switch, if configured to true,config Service will cache previously loaded
configuration information and send incremental updates to the client, reducing network pressure on
the server

The default is false. Please evaluate the total configuration size and adjust the config service
memory configuration before turning it on.

> Ensure that the `app.id``apollo.cluster` of the configuration in the application is in the correct case when caching is enabled, otherwise it will not fetch the correct configuration, You can also refer to the `config-service.cache.key.ignore-case` configuration for compatibility processing.
> `config-service.cache.enabled` configuration adjustment requires a restart of the config service to take effect

13 changes: 13 additions & 0 deletions docs/zh/deployment/distributed-deployment-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1565,3 +1565,16 @@ json
}
```
以上配置指定了 appId=kl、clusterName=bj、namespaceName=namespace1、branchName=bj 的发布历史保留数量为 10,appId=kl、clusterName=bj、namespaceName=namespace2、branchName=bj 的发布历史保留数量为 20,branchName 一般等于 clusterName,只有灰度发布时才会不同,灰度发布的 branchName 需要查询数据库 ReleaseHistory 表确认。

### 3.2.14 config-service.change.cache.enabled - 是否开启增量配置同步客户端

> 适用于服务端2.4.0及以上版本 && 客户端2.3.0及以上版本
这是一个功能开关,如果配置为true的话,config service会缓存加载过的配置信息,发送给客户端增量配置,减少客户端对服务端的网络压力。

默认为false,开启前请先评估总配置大小并调整config service内存配置。

> 开启缓存后必须确保应用中配置的`app.id``apollo.cluster`
> 大小写正确,否则将获取不到正确的配置,另可参考`config-service.cache.key.ignore-case`配置做兼容处理。
> `config-service.change.cache.enabled` 配置调整必须重启 config service 才能生效
4 changes: 2 additions & 2 deletions scripts/sql/profiles/h2-default/apolloconfigdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ VALUES
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');

('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
('config-service.change.cache.enabled', 'default', 'false', 'ConfigService是否开启增量配置同步客户端,开启后能提高性能,但是会增大内存消耗!');
--
-- ===============================================================================
-- == ==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,8 @@ VALUES
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
('config-service.change.cache.enabled', 'default', 'false', 'ConfigService是否开启客户端同步增量配置,开启后能提高性能,但是会增大内存消耗!');

--
-- ===============================================================================
Expand Down
3 changes: 2 additions & 1 deletion scripts/sql/profiles/mysql-default/apolloconfigdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,8 @@ VALUES
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
('config-service.change.cache.enabled', 'default', 'false', 'ConfigService是否开启增量配置同步客户端,开启后能提高性能,但是会增大内存消耗!');

--
-- ===============================================================================
Expand Down
4 changes: 2 additions & 2 deletions scripts/sql/src/apolloconfigdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ VALUES
('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'),
('item.key.length.limit', 'default', '128', 'item key 最大长度限制'),
('item.value.length.limit', 'default', '20000', 'item value最大长度限制'),
('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!');

('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'),
('config-service.change.cache.enabled', 'default', 'false', 'ConfigService是否开启增量配置同步客户端,开启后能提高性能,但是会增大内存消耗!');
-- ${gists.autoGeneratedDeclaration}

/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
Expand Down

0 comments on commit 72676c0

Please sign in to comment.