Welcome! Log In Create A New Profile

Advanced

Limit upstream requests

Posted by Neovote_G 
Limit upstream requests
January 09, 2012 10:34AM
Hello,

I am currently running some load tests on a VPS.
I'm using Nginx (1.0.10) + PHP-FPM (PHP 5.3) + MySQL Community Server (5.5).
The VPS has four 8GB VCores, 24 GB RAM.

Though my tests, I've managed to safely run 500 PHP instances. Each PHP instance has a connection to MySQL, which tends to have problems with too much simultaneous threads, hence the 500 PHP children limit, to avoid numerous MySQL connection errors.
The problem is, when more than 500 clients are simultaneously connected to the server, since I exceed PHP-FPM max client number, I obviously get 502 BAD GATEWAY errors, because PHP FPM doesn't answer Nginx anymore.

I've tried to compile Nginx with EY-Balancer, which sadly, isn't updated for newer versions of Nginx (and I know too few C/C++ to make it compatible). It compiled fine, but when I tried restarting Nginx, the "max_connections" directive was unknown, as I half expected.
I don't know how I could limit my upstream requests to PHP-FPM at 500, the EY-Balancer upstream queue solution was quite elegant, but doesn't seem to work.

Did I do something wrong? Did anyone manage running EY-Balancer with Nginx 1.0.10 ?
Or, alternatively, does anyone know how I could limit/queue (Queuing would be way nicer to clients than just throwing them a 503 error) these upstream requests ?

Many, many thanks in advance for any answers you could provide.



Edit :
The description of the errors I get, that confirms my suspicions, is as follows in Nginx's error log

connect() to unix:/tmp/php-fpm.sock failed (11: resource temporarily unavailable) while connecting to upstream



Edited 1 time(s). Last edit at 01/09/2012 10:41AM by Neovote_G.
Re: Limit upstream requests
January 10, 2012 03:57AM
Okay,

In fact the EY balancer readme mislead me. I managed to make it configure it correctly, and it works.
Here is how I did, in case it helps someone :

-download and extract the nginx archive
-download and extract the ey balancer archive
-run the patch command as specified in EY balancer readme
-did NOT run their makefile, but my own configure command, only edited with the --add-module=(path_to_ey_balancer) inserted, than used make and make install from nginx install dir, and now it works !
(which I found easier than to edit their makefile, etc.)


Thanks to the NGINX and EY balancer for their products :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready