TL;博士:
我正在使用(例如,而不是)celeryd
通过beanstalkd
代理将简短而简单的任务排队。尽管延迟值应该是即时的,但任务需要大约一个小时才能执行(而它们应该只需要几秒钟)。task.delay
myNotifyTask.delay()
myNotifyTask()
根据我的观察,似乎任务确实是在 中收到的beanstalkd
,但是在一个ready
状态中停留了很长时间。尽管设置CELERYD_CONCURRENCY = 8
. 查看beanstalkd
的日志时,我收到关于 的错误read(): Connection reset by peer
,但任务最终会执行。
任何想法为什么会发生这种情况?
详情如下。
使用 beanstalk 版本 1.4.6,celery 3.0.20。
beanstalk 日志条目如下所示:
/usr/bin/beanstalkd: prot.c:709 in check_err: read(): Connection reset by peer
尝试使用celery
来诊断问题时:
> celery -b "beanstalk://beanstalk_server:11300" status
Error: No nodes replied within time constraint.
当连接到beanstalkd
viatelnet
时,我看到current-jobs-ready: 343
了,这表明作业卡在ready
状态(不是delayed
)。这是完整的输出:
> telnet localhost 11300
stats
OK 850
---
current-jobs-urgent: 343
current-jobs-ready: 343
current-jobs-reserved: 0
current-jobs-delayed: 0
current-jobs-buried: 0
cmd-put: 2484
cmd-peek: 0
cmd-peek-ready: 7
cmd-peek-delayed: 1
cmd-peek-buried: 1
cmd-reserve: 0
cmd-reserve-with-timeout: 52941
cmd-delete: 2141
cmd-release: 0
cmd-use: 2485
cmd-watch: 42
cmd-ignore: 40
cmd-bury: 0
cmd-kick: 0
cmd-touch: 0
cmd-stats: 497655
cmd-stats-job: 2141
cmd-stats-tube: 3
cmd-list-tubes: 2
cmd-list-tube-used: 1
cmd-list-tubes-watched: 52954
cmd-pause-tube: 0
job-timeouts: 0
total-jobs: 2484
max-job-size: 65535
current-tubes: 3
current-connections: 6
current-producers: 2
current-workers: 2
current-waiting: 1
total-connections: 502958
pid: 989
version: 1.4.6
rusage-utime: 45.778861
rusage-stime: 56.595537
uptime: 2489047
binlog-oldest-index: 0
binlog-current-index: 0
binlog-max-size: 10485760
不久之后:
stats-tube celery
OK 257
---
name: celery
current-jobs-urgent: 348
current-jobs-ready: 348
current-jobs-reserved: 0
current-jobs-delayed: 0
current-jobs-buried: 0
total-jobs: 2739
current-using: 3
current-watching: 1
current-waiting: 0
cmd-pause-tube: 0
pause: 0
pause-time-left: 0