DNS resolution of PHPcurl (the curl in PHP is slow): 1. use the curl function in the project to call an interface and find that the response is slow. 2. change the host address to the IP address of the Interface Server, fast response? First, we made a DNS service on other servers, hoping to speed up the DNS resolution (intranet resolution), and found that the system curl is very fast, but the DNS resolution problem with php PHP curl (the curl in PHP is slow)
Problem:
1. use the curl function to call an interface in the project and find that the response is slow.
2. change the host address to the IP address of the Interface Server. the response is very fast.
?
First, we made a DNS service on other servers, hoping to speed up the DNS resolution (intranet resolution). We tried to find that the system curl was very fast, but it was still very slow to execute the function using php curl.
?
In the php script, the interface domain name is resolved. through the gethostbyname () function, we found that the corresponding ip address is still the original ip address, which was not resolved again. in the past, PHP cached DNS resolution, after the domain name is resolved again, php is not restarted, so the original DNS resolution content is still used.
?
Solution:
? ? Restart php to solve the problem.