Celery 和 Redis 总是内存不足
我有一个部署到 Heroku 的 Django 应用程序,有一个运行 celery 的工作进程(+ 用于监控的 celerycam)。我使用 RedisToGo 的 Redis 数据库作为代理。我注意到 Redis 总是内存不足。
这就是我的 procfile 的样子:
web: python app/manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3
worker: python lipo/manage.py celerycam & python app/manage.py celeryd -E -B --loglevel=INFO
这是 KEYS '*' 的输出:
- "_kombu.binding.celeryd.pidbox"
- "celeryev.643a99be-74e8-44e1-8c67-fdd9891a5326"
- “celeryev.f7a1d511-448b-42ad-9e51-52baee60e977”
- “_kombu.binding.celeryev”
- “celeryev.d4bd2c8d-57ea-4058-8597-e48f874698ca”
- `_kombu.binding.celery”
celeryev.643a99be-74e8-44e1-8c67-fdd9891a5326
充满了这些消息:
{"sw_sys": "Linux", "clock": 1, "timestamp": 1325914922.206671, "hostname": "064d9ffe-94a3-4a4e-b0c2-be9a85880c74", "type": "worker-online", "sw_ident": "celeryd", "sw_ver": "2.4.5"}
知道我可以做什么来定期清除这些消息吗?
I have a Django app deployed to Heroku, with a worker process running celery (+ celerycam for monitoring). I am using RedisToGo's Redis database as a broker. I noticed that Redis keeps running out of memory.
This is what my procfile looks like:
web: python app/manage.py run_gunicorn -b "0.0.0.0:$PORT" -w 3
worker: python lipo/manage.py celerycam & python app/manage.py celeryd -E -B --loglevel=INFO
Here's the output of KEYS '*':
- "_kombu.binding.celeryd.pidbox"
- "celeryev.643a99be-74e8-44e1-8c67-fdd9891a5326"
- "celeryev.f7a1d511-448b-42ad-9e51-52baee60e977"
- "_kombu.binding.celeryev"
- "celeryev.d4bd2c8d-57ea-4058-8597-e48f874698ca"
- `_kombu.binding.celery"
celeryev.643a99be-74e8-44e1-8c67-fdd9891a5326
is getting filled up with these messages:
{"sw_sys": "Linux", "clock": 1, "timestamp": 1325914922.206671, "hostname": "064d9ffe-94a3-4a4e-b0c2-be9a85880c74", "type": "worker-online", "sw_ident": "celeryd", "sw_ver": "2.4.5"}
Any idea what I can do to purge these messages periodically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个解决方案吗?
我们不能只使用keys命令,因为它是O(N),其中N是数据库中键的总数。 Redis 上的 TTL 可能很棘手2.1 不过。
芹菜过期。而不是德尔塞列耶夫。可以用来让临时离线的 celeryev 消费者复活,但我不知道这是否值得。
作者
Is that a solution?
we can't just use keys command because it is O(N) where N is the total number of keys in DB. TTLs can be tricky on redis < 2.1 though.
expire celeryev. instead of del celeryev. can be used in order to allow temporary offline celeryev consumer to revive, but I don't know if it worths it.
author