After migrating to a new server, our scripts slowed down dramatically.
Some troubleshooting showed that the slowdown occurred during Curl connections as the server was trying to load the SSL cert. Results were the same regardless of which 3rd party site or API was being accessed.
This is on an Amazon EC2 Linux instance. The certificates were provided with the server. These same scripts worked fine on another server (which is no longer active)
However, now it would pause for 2-100 seconds before showing this in the verbose output:
CAfile: /etc/pki/tls/certs/ca-bundle.crt CApath: none ALPN/NPN, server did not agree to a protocol
The speeds would get progressively slower as more curl requests were sent.
I then added curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); and the problem went away! Speeds back to normal.
So, it seems something about how it reads the SSL cert is slowing it down as it tries to negotiate a protocol.
What would cause this?