P
P
PO6OT2015-07-18 15:33:13
PHP
PO6OT, 2015-07-18 15:33:13

Because of the self-made analogue of PCNTL, the server is constantly dying. How to control the load?

sys_getloadavg() doesn't help.
Every 3rd request to hosthack.tk gives out 82f68ab71ef04eff86d508759bc4a4b7.png
I wanted to run this script https://gist.githubusercontent.com/Macuyiko/771824... (by attaching a web face to it) on the hosting, but hostinger.ru does not support PCNTL ( habrahabr.ru/post/40432 ), which is used in this script in order to repeatedly execute one code at the same time. Then I decided to make an analogue of PCNTL - put the necessary piece of code in a separate file and call it repeatedly using ping (this is not a system function, you will not find it on the Internet). But the server began to crash frequently ( https://habrastorage.org/files/82f/68a/b71/82f68ab...), after which my hosting banned hostinger.ru. After some time, I redid the script, and, thinking that the server would no longer die, I asked to return the hosting. I got it back and I launched a new version. The server began to die again, no matter what restrictions I set: die if sys_getloadavg () gives large values, sleep 2 sec. after every 5 iterations executing ping, I even set a limit of no more than 2 requests per hour from one IP and no more than 5 requests per hour in total. But the server keeps crashing.
I started reading habrahabr.ru/post/22799 and habrahabr.ru/post/179399/. The last post doesn't make me happy. PHP is designed to die... And what should I do about it?
Here are the sources of the site hosthack.tk (v4 is the current version):
hosthack.tk/sourcecode.zip
Prompt literature on code optimization and load control.
So that when the limit is exceeded, sleep and wait until the processes caused by ping are completed.
Or maybe I'm reinventing the wheel and a pure php daemon with load control is already there?
[Added]: Even just calling newkey.php repeatedly will crash the server.
[Added]: Already banned :(

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question