Score:0

Delay between multiple Supervisor processes executions

mx flag

I have multiple PHP workers and I need to set delay between startup each of them. How to handle it?

Start 1 process / Wait 20 secs / Start 2nd process / Wait 20 secs ... Keep 50 proccesses alive at same time.

[program:get_comments]
directory=/var/www/
command=/usr/bin/php post_request.php
user=root
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d
numprocs=50
stdout_logfile=/var/www/worker.log
stderr_logfile=/var/www/worker.error
Score:0
je flag

I had a similar issue where, starting 64 python rq-worker processes using supervisorctl was raising CPU and RAM alert at every restart. What I did was the following:

command=/bin/bash -c "sleep %(process_num)02d && virtualenv/bin/python3 manage.py rqworker --name %(program_name)s_my-rq-worker_%(process_num)02d default low"

Basically, before running the python command, I sleep for N second, where N is the process number, which basically means I supervisor will start one rq-worker process every second.

In your case, the following should works:

command=/bin/bash -c "sleep $((%(process_num)01d + 20)) && /usr/bin/php post_request.php" 

Please note that the first process will start after 20 sec as well.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.