3

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?

Thank you

1 Answer 1

4

It's probably too late for you, but I recently got into the same issue. My php script is running on the centos7.

After looking into the strace and keep googling I found out the issue causing this behaviour.

https://bugzilla.redhat.com/show_bug.cgi?id=1659108

Solution:

I updated nss-pem package (1.0.3-5.el7 -> 1.0.3-7.el7) it helped with curl.

If you are unable to update packages and don't want to disable ssl certs check you can use file_get_contents instead of libcurl.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .