Home >Backend Development >PHP Tutorial >Phenomenon: CURL under the same IP under ThinkPHP causes phprpc response time to increase significantly. What is the reason?
curl under different IPs: rpc service response time 0.005 seconds
<code>PHPRPC Client 3.0 for PHP" - 127.0.0.1:9000 200 0.005 </code>
curl under the same IP: rpc service response time 0.610 seconds
<code>PHPRPC Client 3.0 for PHP" - 127.0.0.1:9000 200 0.610 </code>
curl under different IPs: rpc service response time 0.005 seconds
<code>PHPRPC Client 3.0 for PHP" - 127.0.0.1:9000 200 0.005 </code>
curl under the same IP: rpc service response time 0.610 seconds
<code>PHPRPC Client 3.0 for PHP" - 127.0.0.1:9000 200 0.610 </code>
I copied the answer to a question I answered before. Let’s check the specific time consumption first and then optimize it accordingly, right?
https://segmentfault.com/q/1010000004701668/a-1020000004703480
Use the CRUL command to simply analyze the time taken by request details
curl -o /dev/null -s -w %{http_code}:%{time_namelookup}:%{time_redirect}:%{time_pretransfer}:%{time_connect}:%{time_starttransfer}:%{time_total}:% {speed_download} www.baidu.com
This example is to analyze various parameters of a Baidu request: http status code, DNS resolution time, redirection time, time from start to preparation for transmission, TCP connection time, start transmission time, Total time, download speed!
For details, please see the CURL documentation: https://curl.haxx.se/docs/manpage.html