diff --git a/src/runtime/rpc/dns_resolver.cpp b/src/runtime/rpc/dns_resolver.cpp index 06bf4aca17..032436a2f9 100644 --- a/src/runtime/rpc/dns_resolver.cpp +++ b/src/runtime/rpc/dns_resolver.cpp @@ -29,7 +29,9 @@ #include "runtime/rpc/group_address.h" #include "runtime/rpc/group_host_port.h" #include "utils/autoref_ptr.h" +#include "utils/flags.h" #include "utils/fmt_logging.h" +#include "utils/ports.h" METRIC_DEFINE_gauge_int64(server, dns_resolver_cache_size, @@ -48,6 +50,12 @@ METRIC_DEFINE_percentile_int64(server, "The duration of resolving a host port by DNS lookup"); namespace dsn { +DSN_DEFINE_int32(network, + max_count_for_dns_cache, + 100, + "The size of dns_cache on dns_resolver. The part exceeding the " + "cache size needs to be resolved from the system level each time"); + dns_resolver::dns_resolver() : METRIC_VAR_INIT_server(dns_resolver_cache_size), METRIC_VAR_INIT_server(dns_resolver_resolve_duration_ns), @@ -95,10 +103,12 @@ error_s dns_resolver::resolve_addresses(const host_port &hp, std::vector