00_celery introduction (process time-consuming task)

Use celery process time-consuming task

Such as: send SMS (sending SMS is a very time-consuming thing)

Introduction:

A mechanism task queue is a cross-thread, cross-machine work.

  Task queue contains the unit of work called tasks. A dedicated worker process constant surveillance task queue, and derive new tasks and processes.

  (Sender task) Celery communicate via messages, usually called Broker (intermediaries) to coordinate client and worker (task handler). Clients sent messages to the queue, Broker in the queue information distributed to worker to handle .

  Celery system may comprise a lot of worker and broker, may enhance availability and performance of scale.

  • worker: worker is an independent process, task execution unit, which constantly monitors whether there is need to handle the task queue;
  • broker: broker middleware messaging, task scheduling queue to receive messages sent by the producer, the task into the queue, broker in charge of coordination and communication of the client and the worker. The client add a message to the queue, broker sends the message distributed to worker.
  • Task results backend: backend store task execution results, like messaging middleware, by the need to provide support for other storage systems

scenes to be used

celery is using a Python developer of distributed task scheduling module, so for extensive use of Python system built, can be said to be seamless, easy to use. celery focus on real-time processing tasks, while also supporting the timing of scheduled tasks. Therefore suitable for real-time asynchronous tasks such as scheduling regular tasks scene.

Guess you like

Origin www.cnblogs.com/nichengshishaonian/p/11590394.html