0

I have noticed that when checking some domains using the DNSJava library it take a very long time to get dns records.

This is the code I am using

   private void dnsCheck(DomainName domainName) {
        try {
            final long startTime = System.currentTimeMillis();
            Record[] recordsA = new Lookup(domainName.getDomainName(), Type.A).run();
            Record[] recordsAAAA = new Lookup(domainName.getDomainName(), Type.AAAA).run();
            Record[] recordsCNAME = new Lookup(domainName.getDomainName(), Type.CNAME).run();
            Record[] recordsMX = new Lookup(domainName.getDomainName(), Type.MX).run();
            Record[] recordsNS = new Lookup(domainName.getDomainName(), Type.NS).run();
            Record[] recordsPTR = new Lookup(domainName.getDomainName(), Type.PTR).run();
            Record[] recordsSRV = new Lookup(domainName.getDomainName(), Type.SRV).run();
            Record[] recordsSOA = new Lookup(domainName.getDomainName(), Type.SOA).run();
            Record[] recordsTXT = new Lookup(domainName.getDomainName(), Type.TXT).run();
            Record[] recordsCAA = new Lookup(domainName.getDomainName(), Type.CAA).run();
            Record[] recordsDS = new Lookup(domainName.getDomainName(), Type.DS).run();
            Record[] recordsDNSKEY = new Lookup(domainName.getDomainName(), Type.DNSKEY).run();
            final long endTime = System.currentTimeMillis();

            System.out.println("Total execution time for domain: " + domainName.getDomainName() + " " + (endTime - startTime));
      ....
      ....
       } catch (Exception e) {
            e.printStackTrace();
        }
    }

The domain names below take a very long time to return results

webdddd.com 66042 milliseconds
gotest.com 16114 milliseconds
testblog.com 27575 milliseconds
testapp.com 66283 milliseconds

But the following come back fast

prodddd.com 115 milliseconds
ddddmedia.com 179 milliseconds
greendddd.com 598 milliseconds
ddddbox.com 619 milliseconds

Am I not using DNSJava correctly? Is there anything I can do to get the results faster?

Arya
  • 8,473
  • 27
  • 105
  • 175

0 Answers0