singleo0 commented on code in PR #4747:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/4747#discussion_r2012090272
##########
handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/ServiceCombLoadBalancerStats.java:
##########
@@ -157,17 +162,29 @@ public ServiceCombServerStats load(ServiceCombServer
server) {
timer = new Timer("LoadBalancerStatsTimer", true);
timer.schedule(new TimerTask() {
- private final MicroserviceInstancePing ping =
SPIServiceUtils.getPriorityHighestService(MicroserviceInstancePing.class);
+ private final MicroserviceInstancePing ping = SPIServiceUtils
+ .getPriorityHighestService(MicroserviceInstancePing.class);
@Override
public void run() {
try {
Map<ServiceCombServer, ServiceCombServerStats> allServers = pingView;
allServers.forEach((server, stats) -> {
- if ((System.currentTimeMillis() - stats.getLastVisitTime() >
timerIntervalInMillis) && !ping
- .ping(server.getInstance())) {
- LOGGER.info("ping mark server {} failure.",
server.getInstance().getInstanceId());
- stats.markFailure();
+ //get all microservice instances
+ MicroserviceVersions microserviceVersions =
DiscoveryManager.INSTANCE.getOrCreateMicroserviceVersions(
+ RegistrationManager.INSTANCE.getAppId(),
server.getMicroserviceName());
Review Comment:
This ping maybe not lose too much, but when there is a network error and
many instances of the provider down, this single-thread task may create some
bad socket and wait for lots of timeout, i think it does not make sense
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]