Hi, My php script waits for remote gate response, normally for ~20 seconds. It causes apache httpd threads to live in memory with opened MySQL connection and finally to exceed MaxClients value. How it can be managed to free idle resources until remote gate reponse.
One solution is: 1) run remote gate request and then redirect user to page that refreshes to certain url testing for data coming, 2) write rule for that url in nginx configuration file: if specific file exist then run apache to give data else show refreshing page. 3) remote gate request saves data in file
Therefore we unlinked apache from the script that makes request to remote gate and we can make it tiny as possible. While remote request, server used only by that script and light requests from nginx.
So it may be good solution, but I would like to know downsides of this approach. And may be there are better ways.