I've been reworking part of one of my applications from AJAX to cURL and part of optimizing this new application flow was adding the CURLOPT_IPRESOLVE with protocol CURL_IPRESOLVE_V4. I ran some tests with and without this protocol and I noticed that the results got back to me approx. 5 times faster when using this protocol, making it by far the best optimization I added.
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
However, I'm puzzled at how this works. Can someone explain why setting the CURLOPT_IPRESOLVE option speeds up requests so drastically? From what I could find it has something to do with cURL's DNS resolvement.