A
A
Alexey2015-11-17 15:47:51
PHP
Alexey, 2015-11-17 15:47:51

Running over 20 PHP instances via CRON. How to prevent Apache from crashing?

Now there are more than 20 users in the DEBIAN system, each of them runs the same script every 3 minutes, which completely deprives Apache of the desire to live, and it will safely fall, to which NGINX sadly reports a 500 error.
Of course, the mind suggests the likelihood of a more elegant solution that will definitely be implemented, but now we urgently need to organize the smooth operation of the current scheme.
Apache log errors:
[Tue Apr 21 15:50:00 2009] [emerg] (28)No space left on device: Couldn't create accept lock (/var/lock/apache2/accept.lock.19320) (5 ) Exited
to semaphores:
#ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0x00000000 393216 www-data 600 1
0x00000000 425985 www-data 600 1
0x00000000 458754 www-data 600 1
0x00000000 491523 www-data 600 1
0x00000000 524292 www-data 600 1
0x00000000 557061 www-data 600 1
0x00000000 589830 www-data 600 1
0x00000000 622599 www-data 600 1
0x00000000 655368 www-data 600 1
0x00000000 688137 www-data 600 1
0x00000000 720906 www-data 600 1
0x00000000 753675 www-data 600 1
0x00000000 786444 WWW-DATA 600 1
0x00000000 819213 WWW-DATA 600 1
0x00000000 851982 www-data 600 1
0x00000000 884751 www-data 600 1
0x00000000 917520 www-data 600 1
0x00000000 950289 www-data 600 1
Removing and rebooting helps, but only temporarily.
I would appreciate any help before my ass gets torn to pieces.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Robot, 2015-11-17
@iam_not_a_robot

In such scenarios, there is no way, it is necessary to reduce the number of running scripts, you can limit the time, but they will end.
Solution: All scripts of all users are driven into one script and run without limits, for example from the console. Enjoy 98% CPU load. If you can’t do that, then let them throw their tasks into a single database and the admin will process this database with his script, do you have parsers? ;)

R
Roman Hinex, 2015-11-17
@HiNeX

Why Apache? Pull on CLI. Another question is, what does such a script do that cannot be given to Node.js for example?

A
Alexey, 2015-11-17
@coderofbig

Each script also connects to the database, maybe Apache breaks something there? Can increase a variable in configs... I
run scripts: /usr/bin/php /path/script.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question