Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 芹菜和Redis的内存一直不足_Django_Redis_Celery_Celeryd_Celerybeat - Fatal编程技术网

Django 芹菜和Redis的内存一直不足

Django 芹菜和Redis的内存一直不足,django,redis,celery,celeryd,celerybeat,Django,Redis,Celery,Celeryd,Celerybeat,我在Heroku上部署了一个Django应用程序,其中一个工作进程运行芹菜(+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 celer

我在Heroku上部署了一个Django应用程序,其中一个工作进程运行芹菜(+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
以下是键“*”的输出:

  • “_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.装订.芹菜“
  • 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"}
    
    知道我可以做些什么来定期清除这些消息吗?

    这是一个解决方案吗

  • 除了_kombu.bindings.celeryev设置外,还将有带有TTL设置的celeryev.i-am-alive键(例如30秒)
  • celeryev进程将自身添加到绑定中,并定期(例如每5秒)更新celeryev.i-am-alive.key以重置TTL
  • 在发送事件工作进程之前,它不仅会检查_kombu.bindings.celeryev上的成员,还会检查单个celeryev.i-am-alive.keys上的成员,如果未找到(过期),则会将其从_kombu.bindings.celeryev中删除(可能会执行del celeryev.或expire celeryev.命令)
  • 我们不能只使用keys命令,因为它是O(N),其中N是DB中的键的总数。不过,在redis<2.1的情况下,TTLs可能很棘手

    可以使用expire celeryev.代替del celeryev.来让暂时离线的celeryev消费者恢复活力,但我不知道这是否值得


    链接已关闭,这就是为什么您不发布链接,而是发布解决方案。