4

I've installed supervisord using:

sudo apt-get install supervisor

on my Ubuntu 14.04 server as per the instructions in the Laravel documentation.

I've noticed that the supervisorctl process on my server is running constantly at extremely high usage (never below 80%, often at 99%).

The contents of my worker conf file are:

[program:interactions-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/interactions/current/artisan queue:listen sqs --sleep=3 --tries=3
autostart=true
autorestart=true
user=ubuntu
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/html/interactions/storage/worker.log

What could be causing the process to take up so many resources?

4
  • What do you see if you log timestamps at the entrance and exit of that PHP page? Do you see a bunch of requests? Are the requests taking a while to finish? Jan 18, 2016 at 12:48
  • there's a typo in the worker.conf you pasted here: -- and sleep should be together: --sleep
    – sourcejedi
    Jan 18, 2016 at 13:01
  • sourcejedi, that was a typo caused by my paste. Fixed. Paul, requests are not taking considerable time to execute - it's simply sending e-mails, and those are being delivered as expected within a few seconds of the task being fired.
    – Amo
    Jan 18, 2016 at 14:22
  • 1
    Attaching strace to supervised could give you a rough clue what supervised is doing all along. My first guess would also be that it is constantly respawning the supervised process. Jan 21, 2016 at 17:44

2 Answers 2

3
+25

The autorestart directive

specifies if supervisord should automatically restart a process if it exits when it is in the RUNNING state.

(Source: http://supervisord.org/configuration.html)

In other words, once the PHP page is processed...the interpreter exits...and the whole thing restarts again...and again...etc. Is that to be expected?

6
  • 1
    E.g. run supervisorctl a couple of times and see if the PID is changing all the time. Kind of a flaw not to rate-limit it, in case there's an error.
    – sourcejedi
    Jan 18, 2016 at 13:06
  • The process id is constantly the same
    – Amo
    Jan 18, 2016 at 14:24
  • This isn't an answer to the question posted, so feel it doesn't warrant the bounty. My rep is too low on unix.stackexchange to downvote.
    – Amo
    Jan 25, 2016 at 11:48
  • 1
    @Amo I think that Paul is suggesting that the high CPU usage is because supervisord is constantly respawning itself. If that is indeed what is happening, then huge CPU usage is to be expected. Paul, if I'm right, please edit and clarify.
    – terdon
    Jan 25, 2016 at 12:27
  • The the pid is the same, Supervisor can not be re-spawning itself as I assume that would generate a new process.
    – Amo
    Jan 25, 2016 at 16:17
0

What's the version of supervisord? Old supervisord seems to have high CPU occupation issues.

And regarding the laravel queue worker, use queue:work --daemon to reduce the CPU impact, according to https://laravel.com/docs/5.1/queues#daemon-queue-listener

The queue:work Artisan command includes a --daemon option for forcing the queue worker to continue processing jobs without ever re-booting the framework. This results in a significant reduction of CPU usage when compared to the queue:listen command:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .