PHP/curl: namelookup_time/dns slowing requests

后端 未结 2 831
慢半拍i
慢半拍i 2021-01-21 08:47

EDIT: Found part of the cause - see bottom.

I\'m doing a standard curl call from php. However, there seems to be a hangup during name resolution. On my OSX box, the nam

相关标签:
2条回答
  • 2021-01-21 09:13

    The PHP app code is using curl_multi_select, which has a default timeout of 1 second. Changing this delay to 0.00005 seconds makes the call return much faster. So that's what's causing the delay. However, I don't yet know why this is different on Linux vs OSX or the particular flavor of php/libcurl that I have built (5.3.8).

    I'm going to open a different SO question to try to resolve the curl_multi_select issue.

    0 讨论(0)
  • 2021-01-21 09:35

    You can fixed your domain in /etc/hosts, then php curl don't need to lookup DNS to find ip address. That worked for me.

    0 讨论(0)
提交回复
热议问题