Why PHP Curl execution time is increased while using php 7.3 and Nginx compare to Apache and php 5.6

40 Views Asked by At

I am using Apache and PHP 5.6 to execute a curl for an API hosted on another domain with a URL in the format of https://xyz. The total curl execution time for this setup is around 30 milliseconds. However, when I use this curl with a setup having Nginx and PHP 7.3, the execution time increases to 100-150 milliseconds. I used curl get info to obtain the following stats:

With Apache and PHP 5.6:

  • name lookup time- ~4 milliseconds
  • connect time - ~6 milliseconds
  • Pretransfer time- ~14 milliseconds
  • Starttransfer time- ~16 milliseconds
  • total time - ~28 milliseconds

With Nginx and PHP 7.3:

  • name lookup time- ~3 milliseconds
  • connect time - ~4 milliseconds
  • Pretransfer time- ~80 milliseconds
  • Starttransfer time- ~80 milliseconds
  • total time - ~100 milliseconds

Can someone suggest why this might be happening and what solutions exist to resolve this issue?

0

There are 0 best solutions below