Is it possible to resolve 1000+ domains via akka async-dns?
In our actor we have the following line:
IO(Dns) ? DnsProtocol.Resolve(domain, ipRequestType(ipv4=true, ipv6=true)(1 second)
Even if it’s wrapped with try/catch logic and added recovery section we have next issue:
19:08:48.140 [grpcTestServer-akka.actor.default-dispatcher-105] ERROR akka.io.dns.internal.AsyncDnsResolver - Resolve failed. Trying next name server
akka.pattern.AskTimeoutException: Ask timed out on [Actor[akka://grpcTestServer/system/IO-DNS/async-dns/$c/$a#1143717252]] after [500 ms]. Message of type [akka.io.dns.internal.DnsClient$Question6] was sent by [Actor[akka://grpcTestServer/system/IO-DNS/async-dns/$c#281115170]]. A typical reason for `AskTimeoutException` is that the recipient actor didn't send a reply.
at akka.pat^C at akka.pattern.PromiseActorRef$.$anonfun$defaultOnTimeout$1(AskSupport.scala:648)
at akka.pattern.PromiseActorRef$.$anonfun$apply$1(AskSupport.scala:669)
at akka.actor.Scheduler$$anon$4.run(Scheduler.scala:202)
at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:875)
at scala.concurrent.BatchingExecutor.execute(BatchingExecutor.scala:113)
To be short, we don’t care if some of lookup’s fail. We return mock response in recovery section.
But, AskTimeoutException slow down app extremely and after a while we get OOM issue.
akka configuration:
akka.io.dns.resolver = async-dns
akka.io.dns.async-dns.provider-object = "akka.io.dns.internal.AsyncDnsProvider"
akka.io.dns.async-dns.resolve-timeout = 0.5s
akka.io.dns.async-dns.positive-ttl = forever
akka.io.dns.async-dns.negative-ttl = 5m
We have above issue even if resolve-timeout set to 150 sec.
But, via whireshark I could see successful lookups (requests/responses).
It doesn’t matter what heap size is. If it’s bigger, then app will fail or hang forever, later.
App ran in docker with the following JAVA_OPTS:
-XX:+AggressiveOpts
-Xms3g
-Xmx3g
Docker memory limited to 4g and 1CPU.
Bigger number of CPU’s will not help.