A
A
Andrey Prokopyuk2012-05-05 18:01:57
PHP
Andrey Prokopyuk, 2012-05-05 18:01:57

PHP-FPM on production server under Debian 6?

There is a Debian 6 server that shouldn't go down for long. It has nginx and php-cgi running via start-stop-daemon, thus creating FastCGI.
But when there was a lot of traffic (about 2-3,000 simultaneous connections), the 502 error problem appeared, which occurs even despite a small load on the processor and memory.
The material studied suggested that PHP-FPM copes with the task much better, but how to install it so as not to disrupt the existing ecosystem?
It is known that it is on dotdeb.org, but I am afraid to use it because of problems with package incompatibility - when I try to put something for PHP, it issues a request to remove important things.
Is there any other way to install php5-fpm on Debian 6?
UPD, 2012-05-06.Much has been done to solve this problem. Now php5-fpm is installed, the percentage of 502 errors is close to zero, in the comments you can see how to solve the problem.
Additionally, we can say that you can install php5-fpm and a new version of nginx from the unstable and testing repositories:

#UNSTABLE
deb http://ftp.ru.debian.org/debian/ unstable main non-free contrib
deb-src http://ftp.ru.debian.org/debian/ unstable main non-free contrib

#TESTING
deb http://ftp.ru.debian.org/debian/ testing main non-free contrib
deb-src http://ftp.ru.debian.org/debian/ testing main non-free contrib

To eliminate the 502 error, you need to choose the optimal php5-fpm parameters and optimize the application. For example, in my and another case, the exclusion of sessions or the redefinition of the standard mechanism with the exclusion of writing them to files helped.
Also PHP 5.4 is noticeably faster and php5-fpm manages with fewer processes.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
ajaxtelamonid, 2012-05-05
@Andre_487

You are doing the right thing by not trusting dotdeb.org. I personally will not put anything else from them, there was a negative experience, and twice. You can install php- fpm
in this way: www.zagirov.name/debian-testing-install-php5-fpm
in fact this package is the same for any php 5.3. It is enough just to kill the dependency on the version inside the package and you can install it. I did it myself, everything works.

A
Andrey Prokopyuk, 2012-05-05
@Andre_487

And already a minus in karma. Is it such a bad question? It really can help me and other people with a similar problem.

A
Alexey Sundukov, 2012-05-06
@alekciy

>But when there is a lot of traffic (about 2-3,000 concurrent connections),
>the php-fpm error 502

problem is not a silver bullet to solve this problem. It is obvious that the essence of the problems is that the backend does not have time to digest such a burst of load. As I understand it, there are free resources, so you need to twist the server settings.
Increase the backlog backlog, requests that it cannot accept will be queued. But you should not get carried away with this, the user will not wait until his request from the backlog is taken and processed by the backend. So look towards the acceleration of the application. How long does it take to generate a page? Are there pages that are the same for everyone? Take them out to memcached and take them with nginx itself, don't pull the backend too much. Are XCache-style accelerators enabled? Are all scripts in the cache? How are things going with the connection to the database, how long do they take? Is caching used at this level? For example, in my case, in the case of fetching a response from a DBMS, the page on average on one project is generated ~ 15-20 ms, if the data is taken from the cache in which Redis works, then the value drops to ~ 2-10 ms, i.e. up to 10 times.
In general, I draw your attention to the fact that installing php-fpm miraculously may not change the situation, although it may smooth it out.

N
NiGHt_LEshiY, 2012-05-05
@NiGHt_LEshiY

If you are in control, you can build and install php-fpm yourself. Preferably in an adequate way, not make install . (that is, build a deb package and let the package manager install it yourself)

A
admin4eg, 2012-05-06
@admin4eg

what's wrong with dotdeb? It works well for me both in ubuntu and in various debians.
moreover, on a real combat project with 5000-6000 users per day, online, though not like the TS, but even so.
I bought a server on eBay for 100 bucks 3 years ago.
also collapsed from the load, set up caching on nginx (this is after all sorts of memcasheds, eAccelerators, and other things caching muscle requests)

R
rakot, 2012-05-06
@rakot

Maybe this is not your case, but after 700 competitive requests, I also had a gag on the server.
It was about creating session files on disk, after transferring sessions to radishes, I got rid of it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question