nickstenning / honcho

Honcho: a python clone of Foreman. For managing Procfile-based applications.
http://pypi.python.org/pypi/honcho
MIT License
1.59k stars 145 forks source link

Multiplied Processes #194

Closed mjdavies closed 7 years ago

mjdavies commented 7 years ago

Hello there.

I'm not really certain this is an issue, but was hoping if someone could explain what I'm seeing.

I'm using honcho to start nginx, and start my django application with gunicorn, all inside one docker container.

The nginx is configured to run with 1 worker.

Here's my procfile

nginx: /usr/sbin/nginx
webapp: gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug

It all works fine when I run 'honcho start' as the command in the docker-compose file, no problems.

What I don't really understand is the output of ps aux inside the container.


root         1  0.8  0.8  42556 16960 ?        Ss   12:25   0:00 /usr/bin/python /usr/local/bin/honcho start
root         7  0.0  0.6 116288 14164 ?        Sl   12:25   0:00 /usr/bin/python /usr/local/bin/honcho start
root         8  0.0  0.6 116288 14168 ?        Sl   12:25   0:00 /usr/bin/python /usr/local/bin/honcho start
root         9  0.3  0.0   4512   828 ?        Ss   12:25   0:00 /bin/sh -c /usr/sbin/nginx
root        10  0.3  0.0   4512   748 ?        Ss   12:25   0:00 /bin/sh -c gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug
root        12  0.0  0.4 125108  9224 ?        S    12:25   0:00 nginx: master process /usr/sbin/nginx
root        14  0.4  0.8  47524 17808 ?        S    12:25   0:00 /usr/bin/python /usr/local/bin/gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug
nobody      15  0.0  0.1 125536  3136 ?        S    12:25   0:00 nginx: worker process
root        20  2.3  4.0 761584 83560 ?        Sl   12:25   0:00 /usr/bin/python /usr/local/bin/gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug
root        21  2.2  4.0 761600 83548 ?        Sl   12:25   0:00 /usr/bin/python /usr/local/bin/gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug
root        24  2.3  4.0 761600 83688 ?        Sl   12:25   0:00 /usr/bin/python /usr/local/bin/gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug
root        41  0.6  0.1  18252  3280 pts/0    Ss   12:26   0:00 /bin/bash
root        55  0.0  0.1  34428  2724 pts/0    R+   12:26   0:00 ps aux````

Can anyone tell me why I'm seeing 3 honcho processes running, and 4 gunicorn processes after the initial /bin/sh -c gunicorn research.wsgi --workers=3 -b 0.0.0.0:8000 --log-level debug

Like I say, it is working, but I wouldn't have expected to see 4 gunicorns and 3 honchos.

Sounds like a pretty good film :-)

Any tips, hints, or explanations would be more than welcome.

Thanks
nickstenning commented 7 years ago

Hey @mjdavies! I think this is all as expected. When you run honcho with two process types, it will end up running three processes: one is responsible for managing the two which correspond to your processes (nginx and webapp) and printing their output to the console.

I think it's much the same story with gunicorn, too. There's one "arbiter" process running, and three corresponding to the three workers (--workers=3).

Hope that answers your questions!

mjdavies commented 7 years ago

Thanks for getting back Nick.

Yes, that answers my question nicely, thanks again.

Matt