[server] [rpc] - 修复rpc返回信息处理逻辑, 解决cpu过高的问题 - 1

This commit is contained in:
zeaslity
2023-02-17 11:17:30 +08:00
parent eb709a5566
commit 9197efc4ec
9 changed files with 50 additions and 17 deletions

14
.run/Server-dev.run.xml Normal file
View File

@@ -0,0 +1,14 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Server-dev" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" activateToolWindowBeforeRun="false">
<option name="HIDE_BANNER" value="true" />
<module name="server" />
<selectedOptions>
<option name="spring.boot.profiles" visible="false" />
</selectedOptions>
<option name="SPRING_BOOT_MAIN_CLASS" value="io.wdd.ServerApplication" />
<option name="VM_PARAMETERS" value="-Dfile.encoding=utf-8 -Dspring.profiles.active=dev -Dspring.cloud.nacos.config.group=dev -Dspring.cloud.nacos.config.extension-configs[0].dataId=common-dev.yaml -Dspring.cloud.nacos.config.extension-configs[0].group=dev" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

13
.run/Server-k3s.run.xml Normal file
View File

@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Server-k3s" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<module name="server" />
<selectedOptions>
<option name="spring.boot.profiles" visible="false" />
</selectedOptions>
<option name="SPRING_BOOT_MAIN_CLASS" value="io.wdd.ServerApplication" />
<option name="VM_PARAMETERS" value="-Dfile.encoding=utf-8 -Dspring.profiles.active=k3s -Dspring.cloud.nacos.config.group=k3s -Dspring.cloud.nacos.config.extension-configs[0].dataId=common-k3s.yaml -Dspring.cloud.nacos.config.extension-configs[0].group=k3s" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@@ -39,4 +39,6 @@
132.145.28.48 London-arm64-02 london-4 l4
# 所有的主机
Phoenix-amd64-02,Phoenix-arm64-01,Phoenix-arm64-02,London-amd64-01,London-amd64-02,London-arm64-01,London-arm64-02
Phoenix-amd64-02,Phoenix-arm64-01,Phoenix-arm64-02,London-amd64-01,London-amd64-02,London-arm64-01,London-arm64-02
Tokyo-amd64-13-6e8a19, Tokyo-amd64-07-f66a41, Phoenix-arm64-01-52c2f4, Phoenix-amd64-02-2a45bb, Phoenix-arm64-02-7b95ac, London-arm64-02-9ee6ba, London-amd64-01-0b219f, London-amd64-02-c155d1, London-arm64-01-72519e

View File

@@ -19,6 +19,9 @@ spring:
- group: local
data-id: common-local.yaml
server:
port: 8000
#debug: true
#logging:
# level:

View File

@@ -191,7 +191,7 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
);
*/
try {
// 超时等待5秒钟, 或者所有的Agent均已经完成上报
// 超时等待5秒钟, 或者所有的Agent均已经完成上报ddo
countDownLatch.await(
5,
TimeUnit.SECONDS
@@ -242,7 +242,6 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
}
@Override
public String shutdownAgentDanger(String agentTopicName) {
@@ -293,11 +292,9 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
)) {
// 不是当前应用需要的的OM将信息放置与Cache队列的末尾
try {
OCTOPUS_MESSAGE_FROM_AGENT.put(message);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
OCTOPUS_MESSAGE_FROM_AGENT.offer(message);
// 返回,继续死循环
continue;
}
@@ -346,11 +343,9 @@ public class OctopusAgentServiceImpl implements OctopusAgentService {
)) {
// 不是当前应用需要的的OM将信息放置与Cache队列的末尾
try {
OCTOPUS_MESSAGE_FROM_AGENT.put(message);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
OCTOPUS_MESSAGE_FROM_AGENT.offer(message);
// 返回,继续死循环
continue;
}

View File

@@ -73,6 +73,9 @@ public class AsyncWaitOMResult {
);
if (!REPLAY_CACHE_MAP.containsKey(matchKey)) {
// 没有这个Key,说明等待结果已经超时了,直接丢弃,然后继续循环
// todo 错误的数据需要放置于某处
continue;
}

View File

@@ -13,6 +13,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.concurrent.ArrayBlockingQueue;
@Configuration
@@ -29,9 +30,8 @@ public class OMessageHandlerServer {
* 各个业务模块需要自己手动去获取自己需要的内容
* TODO 数据一致性问题当AgentShutDown可能有一些信息会消失
*/
public static ArrayBlockingQueue<OctopusMessage> OCTOPUS_MESSAGE_FROM_AGENT = new ArrayBlockingQueue<>(
128,
true
public static ArrayDeque<OctopusMessage> OCTOPUS_MESSAGE_FROM_AGENT = new ArrayDeque<>(
128
);
@Resource
RedisTemplate redisTemplate;

View File

@@ -82,7 +82,7 @@ public class QuartzSchedulerServiceImpl implements QuartzSchedulerService {
futureExecutionResultKey
);
log.info("[ 定时脚本任务 ] - 新建任务成功, 船舰任务DTO为 => {}", scriptSchedulerDTO);
log.info("[ 定时脚本任务 ] - 新建任务成功, 任务DTO为 => {}", scriptSchedulerDTO);
log.info("[ 定时脚本任务 ] - 新建任务成功, 任务内容为 => {}", jobDetail);
// persistent the script scheduled mission

View File

@@ -18,3 +18,6 @@ spring:
extension-configs:
- group: local
data-id: common-local.yaml
server:
port: 9999