BACKGROUND:

I am passing variables through AJAX to php file. The php file connects to a server and retrieves the result which it passes back to javascript. This happens every time a user clicks on the request button (about every 5 secs). Thus for each user, the php file (and so the mysql connection) is called once every 5 secs.

ISSUE:

As is apparent above, the number of mysql connections are impractically high. 

QUESTION:

Is there a better architecture where instead of having so many mysql connections, I can rather have fewer connections. 

![enter image description here](https://i.stack.imgur.com/VToyP.jpg)

I have read a little bit about mysql\_pconnect. But what happens if I have to upgrade since I read somewhere that mysqli doesnt support it? How many queries can a single mysql\_pconnect handle? If anyone suggests mysql\_pconnect then how to implement it?