celery,supervisor并发

69 views
Skip to first unread message

Hao Weibo

unread,
Feb 10, 2018, 3:01:15 AM2/10/18
to BPyUG~北京Python用户组
最近用到celery,celery中有一条命令
celery worker -c 1,-c指定指定并发自进程的数量,默认是cpu个数

我使用了supervisor去守护进程,双核服务器,其中关于celery的配置如下

[program:celery]
process_name = hello-%(process_num)s
command=celery -A hello.tasks worker -c 1 -l info -n worker-%(process_num)s
directory=/home/hello
user=schope
stderr_logfile = /var/log/supervisor/celery-stderr.log
stdout_logfile = /var/log/supervisor/celery-stdout.log

numprocs=8

startsecs=10
stopwaitsecs = 600
killasgroup=true

其中numprocs表示其中8个进程,command中celery -c 是1

如果-c代表并发进程,numprocs也代表进程,command里的-c和numprocs是否重复或者冲突(运行时不会出错,只是感觉别扭)
如果吧command中的-c 改成2(因为现在是双核了),会不会有撒子问题呢

Zoom.Quiet

unread,
Feb 10, 2018, 7:57:00 AM2/10/18
to BPyUG~北京Py用户组
进程/线程先根据文档明确了,
另外, 并行进程应该比 CPU 核数少一...
> --
> --
> '''邮件来自 `BPyUG`--北京Python用户组 列表
> 详情: http://groups.google.com/group/bpug
> 发言: bp...@googlegroups.com
> 退订: bpug-uns...@googlegroups.com
> 维基: http://wiki.woodpecker.org.cn/moin/BPUG
> 中国事务: http://groups.google.com/group/CPUG
> 珠江事务: http://groups.google.com/group/zpug
> 北京事务: http://groups.google.com/group/bpug
> 上海事务: http://groups.google.com/group/spug
> 安徽事务: http://groups.google.com/group/ahpug
> 东南事务: http://groups.google.com/group/cpug-eastchina
> 技术列表: http://groups.google.com/group/python-cn
> '''
> ---
> 您收到此邮件是因为您订阅了Google网上论坛上的“BPyUG~北京Python用户组”群组。
> 要退订此群组并停止接收此群组的电子邮件,请发送电子邮件到bpug+uns...@googlegroups.com
> 要查看更多选项,请访问https://groups.google.com/d/optout



--
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization learning!
Reply all
Reply to author
Forward
0 new messages