⚙ Operations Hub

thomasvbe
Contributeur

Custom code mysql too many connections

Résolue

Hi, I've got a custom code workflow where I try to get data from an external MySQL database. I get a "too many connections" error because it's possible that more than 200 contacts go through that workflow at the same time. It needs to fetch data right before an e-mail has to leave. Do you guys have any solution to pass each contact one at a time through a workflow or a custom code step? Or how I can anticipate that there are too many connections? Thanks!

1 Solution acceptée
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

Custom code mysql too many connections

Résolue

Hey @thomasvbe,

 

There isn't an ideal solution here as there is no way of throttling how many contacts (or any record for that matter) can enroll into a workflow at any given time. With that said some ideas that spring to mind include: 

 

  • Increasing the max_connections system variable but be mindful that this could impact overall performance depending on volume. More information on how to do that can be found here.
  • Another option might be to ensure that you're closing/terminating the connection within the custom coded action as early as is reasonably possible.

The way our tool is structured is that each contact enrolled that the custom coded workflow action runs against will count towards the total number of client connections you can have at any given time to your database.

 

I appreciate this isn't a perfect solution but just wanted to provide some insight on my end. 

 

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn

Voir la solution dans l'envoi d'origine

2 Réponses
jackcoldrick
Solution
HubSpot Employee
HubSpot Employee

Custom code mysql too many connections

Résolue

Hey @thomasvbe,

 

There isn't an ideal solution here as there is no way of throttling how many contacts (or any record for that matter) can enroll into a workflow at any given time. With that said some ideas that spring to mind include: 

 

  • Increasing the max_connections system variable but be mindful that this could impact overall performance depending on volume. More information on how to do that can be found here.
  • Another option might be to ensure that you're closing/terminating the connection within the custom coded action as early as is reasonably possible.

The way our tool is structured is that each contact enrolled that the custom coded workflow action runs against will count towards the total number of client connections you can have at any given time to your database.

 

I appreciate this isn't a perfect solution but just wanted to provide some insight on my end. 

 

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
thomasvbe
Contributeur

Custom code mysql too many connections

Résolue

Hi Jack

 

We did actually increase the max connections, although this isn't a future-proof solution.

 

Thanks!

Thomas

0 Votes