1

I'm using a setup including PHP (5.5), NGINX (1.1.19) and PHP-FPM, with MySQL (5.5.34) as Database, and many, many stored procedures.

I dont want to get too far into the reason for why I'm using stored procedures, but as far as I know it's a good practice to use persistent connections with them, since they load with every connection, slowing things down (is that still true?).

Now, as far as my knowledge goes, to have persistent connections I need some child processes, but is that even necessary / possible with PHP-FPM? I've read mixed things about this, and I'm not entirely sure.

The main question, basically, would be: When using the mentioned Setup (PHP-FPM, NGINX, MySQL) waht's the best way to use / handle persistent connections to MySQL? Is it possible? If not, what's a possible workaround?

Thanks in advance!

user169099
  • 137
  • 2
  • 7

1 Answers1

0

PHP-FPM runs as a daemon and thus keeps certain state persistent until the worker is released. This means you can leverage persistent connections, such as what is documented in the connections and connection management section.

Regarding stored procedures being loaded on every connection, the answer is not unless you are creating and dropping them constantly. Stored procedures are typically persisted on the database server similar to triggers and other database objects in your schema and thus only incur an overhead when actually executed.

Stuart Carnie
  • 5,458
  • 1
  • 29
  • 27