mardi 22 septembre 2015

Laravel createConnection Timing Out

Recently I started using New Relic to profile my application and I came across something peculiar. Every once and a while my application would hang for 15-20 seconds and then fail. Digging in I found that the createConnection method to the percona mysql was timing out in my Laravel5 application.

Here is the offending method in the Laravel5 source: http://ift.tt/1WgdiVf

Here is a picture of the transaction trace that is failing: Transaction Trace with createConnection hang

There are two instances running the same application in my stack. Each one does about 100-400 calls per minute to the database depending on if the load balancer is pointing to that particulatr instance.

I'm wondering if there is a way to stop this from happening. Some ideas that I had:

  • Turn on persistent connections for the PDO connection.
  • Change a MySQL setting, not sure which. (Let me know if you want to see the current options).
  • Set PHP to timeout after 5 seconds to stop the current connection.

Ideas and thoughts are much appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire