diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index e8f2e06d58..8dfce58905 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -15,6 +15,7 @@ * BanyanDB: Support `@ShardingKey` for Measure tags and set to TopNAggregation group tag by default. * BanyanDB: Support cold stage data query for metrics/traces/logs. * Increase the idle check interval of the message queue to 200ms to reduce CPU usage under low load conditions. +* Limit max attempts of DNS resolution of Istio ServiceEntry to 3, and do not wait for first resolution result in case the DNS is not resolvable at all. #### UI diff --git a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/istio/IstioServiceEntryRegistry.java b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/istio/IstioServiceEntryRegistry.java index 1bc118205d..6b19b05a46 100644 --- a/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/istio/IstioServiceEntryRegistry.java +++ b/oap-server/server-receiver-plugin/envoy-metrics-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/envoy/als/istio/IstioServiceEntryRegistry.java @@ -23,6 +23,8 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; import com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroup; +import com.linecorp.armeria.client.retry.Backoff; + import io.fabric8.istio.api.networking.v1beta1.ServiceEntry; import io.fabric8.istio.api.networking.v1beta1.WorkloadEntrySpec; import io.fabric8.kubernetes.api.model.ObjectMeta; @@ -100,16 +102,20 @@ public class IstioServiceEntryRegistry { return spec .getHosts() .parallelStream() - .map(host -> hostnameResolvers.computeIfAbsent(host, it -> { - final var endpointGroup = DnsAddressEndpointGroup.of(it); - endpointGroup.whenReady().join(); // Wait for the first resolution - return endpointGroup; - })) - .anyMatch(dnsAddressEndpointGroup -> - dnsAddressEndpointGroup - .endpoints() - .parallelStream() - .anyMatch(endpoint -> Objects.equals(endpoint.ipAddr(), ip))); + .map(host -> hostnameResolvers.computeIfAbsent(host, it -> + DnsAddressEndpointGroup.builder(it) + .backoff(Backoff.exponential(1000, 32000).withJitter(0.2).withMaxAttempts(3)) + .build() + )) + .anyMatch(dnsAddressEndpointGroup -> { + if (dnsAddressEndpointGroup.whenReady().isDone()) { + return dnsAddressEndpointGroup + .endpoints() + .parallelStream() + .anyMatch(endpoint -> Objects.equals(endpoint.ipAddr(), ip)); + } + return false; + }); default: log.debug("Unsupported service entry resolution: {}", spec.getResolution()); return false;