laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Eloquent connection pooling #1438

Open jdescelliers opened 5 years ago

jdescelliers commented 5 years ago

Hi,

I couldn’t find the exact answer to my question.

Basically we have performance issues as a new connection is opened on the fly instead of using a connection pool.

My question is, is Eloquent supporting this out of the box? If not, why is connection pooling not really supported by PHP as any other language supports it directly.

Please provide a constructive and well explained answer.

Thanks!

mfn commented 5 years ago

I've had issues with this (PHP + Postgres) and the preferred and recommended solution is to use something like https://github.com/pgbouncer/pgbouncer which is very high performant and very good in re-using connections. I'm sure similar software exists for MySQL and its variants.

Whilst it not look like much, connection pooling is a quite complex topic and best left to dedicated software. I certainly wouldn't want to have this complexity be part of the Framework and to maintain it.