PHP, MySQL and a lot of simple queries

I am implementing an application in which there will be many clients requesting a large number of small data packets from my web server. Now I'm not sure whether to use persistent database connections or not. The database is currently located on the same system as the web server, and can connect via a socket, but this may change in the near future.

As I know several PHP releases back, mysqli_pconnect was removed because it was suboptimal. Meanwhile, he seems to be back again.

In my scenario, I suppose I will not have another chance to process thousands of queries per minute, but with lots of persistent connections and a MySQL configuration that reserves only a small amount of resources per connection, right?

Thanks for your input!

+3
source share
3 answers

What happened when you tested it?

With a nest in the world, there is no practical way to convey all the information people need to give a definitive answer in response to SO. However, as a rule, when creating a mysql connection, there is very little overhead, especially if it is on the same system as the database client (in this case, the web server). There is even less overhead if you use a file system rather than a network socket.

, , , , - , .

.

+1

PHP ?

, Host "Apache" "MySQL"

, . , , . .

+1

, , PHP, MySQL Oracle ( ODBC, OCI8). , , . , .

, , , . , : MySQL .

, reset , ( , , , ).

+1

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


All Articles