PHP Dns_get_record in the native test very slow how to solve

Source: Internet
Author: User
Tags domain name lookup
Always want to find a free unlimited frequency domain name query interface, online find for a long time did not find, finally simply write a domain name lookup interface, the principle is directly with PHP to find the domain name whois information, but directly find whois too slow, you want to first find the domain name of the NS record, If there is an NS record, this domain name is already registered, so theoretically should be faster, this idea is right?
Now I use PHP dns_get_record query DNS information domain name, but this speed really dare not compliment ha, tried a lot of domain names, basically average query time in more than a minute! Several times have been hung off, completely unlike the online domain registrar as fast, no U.S. host, want to ask, if the U.S. host running Dns_get_record will be faster?

Reply content:

Always want to find a free unlimited frequency domain name query interface, online find for a long time did not find, finally simply write a domain name lookup interface, the principle is directly with PHP to find the domain name whois information, but directly find whois too slow, you want to first find the domain name of the NS record, If there is an NS record, this domain name is already registered, so theoretically should be faster, this idea is right?
Now I use PHP dns_get_record query DNS information domain name, but this speed really dare not compliment ha, tried a lot of domain names, basically average query time in more than a minute! Several times have been hung off, completely unlike the online domain registrar as fast, no U.S. host, want to ask, if the U.S. host running Dns_get_record will be faster?

Just tested the Alexa top 500 domain name, the maximum time consuming 12.2S, minimum less than 0.001S.
At the same time I emptied the DNS cache of this machine beforehand.

This can be done because each domain name contains at least one NS record.

Slow is the reason for your machine, I test up to 3S in this machine.

Get a post in a period of time there will be a cache, I think you can modify the DNS server to see if there is any improvement

$start=microtime(true);$domain='segmentfault.com';$rs=dns_get_record(strtolower($domain),DNS_NS);print_r($rs);$end=microtime(true);echo $end-$start;

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.