python中的Celery有什么用?
What is the use of Celery in python?
我很困惑 celery.Example 我想加载一个数据文件,没有 celery.With celery 加载需要 10 秒,用户将如何受益?加载数据需要同样的时间吗?
通常情况下,用户必须等待加载数据文件才能在服务器上完成。但是借助celery,操作会在服务端进行,用户不会参与。即使应用程序崩溃,该任务也会排队。
Celery will keep track of the work you send to it in a database
back-end such as Redis or RabbitMQ. This keeps the state out of your
app server's process which means even if your app server crashes your
job queue will still remain. Celery also allows you to track tasks
that fail.
Celery 和 Huey 等类似系统旨在帮助我们分配(卸载)通常无法在单台机器上并发 执行的进程数量,否则它会如果这样做会导致性能显着下降。这里的关键词是 DISTRIBUTED。
您提到了文件的下载。如果它是您需要下载的单个文件,仅此而已,那么您不需要 Celery。更复杂的情况如何——您需要下载 100000 个文件?更复杂的情况如何 - 这 100000 个文件需要解析并且解析过程 CPU 密集?
此外,Celery 将帮助您完成失败任务的重试、日志记录、监控等
我很困惑 celery.Example 我想加载一个数据文件,没有 celery.With celery 加载需要 10 秒,用户将如何受益?加载数据需要同样的时间吗?
通常情况下,用户必须等待加载数据文件才能在服务器上完成。但是借助celery,操作会在服务端进行,用户不会参与。即使应用程序崩溃,该任务也会排队。
Celery will keep track of the work you send to it in a database back-end such as Redis or RabbitMQ. This keeps the state out of your app server's process which means even if your app server crashes your job queue will still remain. Celery also allows you to track tasks that fail.
Celery 和 Huey 等类似系统旨在帮助我们分配(卸载)通常无法在单台机器上并发 执行的进程数量,否则它会如果这样做会导致性能显着下降。这里的关键词是 DISTRIBUTED。
您提到了文件的下载。如果它是您需要下载的单个文件,仅此而已,那么您不需要 Celery。更复杂的情况如何——您需要下载 100000 个文件?更复杂的情况如何 - 这 100000 个文件需要解析并且解析过程 CPU 密集?
此外,Celery 将帮助您完成失败任务的重试、日志记录、监控等