Permanent database connection in fastcgi

I am moving the application from php to fastcgi (c). My host works with apache.

Since the fastcgi application will run in a loop, I can open the mysql connection and leave it open for all incoming requests. Is this recommended?

I think I read about an equal number of opinions saying that a connection is much more expensive than a request, and it should be constant, and on the other hand, people who claim that an open connection is resource-intensive should be closed every time.

Which one is correct in my context?

+3
source share
3 answers

, ... ? connect() pconnect() . , , , .

, , , , .

+1

, 10-20 ur , . - -

0

. MySql, , ; , . , -, . . script , malbehaving script . , . , , , , , .

0

Source: https://habr.com/ru/post/1699404/


All Articles