intro.rst 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. =============================
  2. Introduction to Task Queues
  3. =============================
  4. .. contents::
  5. :local:
  6. :depth: 1
  7. What are Task Queues?
  8. =====================
  9. Celery Features
  10. ===============
  11. - Messaging Transports (Brokers)
  12. Celery requires a message broker to send and receive messages,
  13. but this term has been stretched to include everything from
  14. financial-grade messaging systems to you fridge (no offense)
  15. RabbitMQ, Redis, MongoDB, Amazon SQS, CouchDB, Beanstalk, Apache ZooKeeper,
  16. or Databases (SQLAlchemy/Django ORM).
  17. - HA
  18. Both clients and workers will automatically retry in the event
  19. of connection loss or failure, and some brokers support
  20. HA in way of Master/Master or Master/Slave replication.
  21. - Multiple Serializers
  22. Messages can be serialized using pickle, json, yaml, msgpack or
  23. even custom serializers. In addition Celery ships with a special
  24. serializer that signs messages using cryptographic hashes.
  25. - Compression
  26. Messages can be compressed using zlib, bzip2 or custom
  27. compression schemes defined by the user.
  28. Worker
  29. ------
  30. - Monitoring
  31. Workers emit a stream of monitoring events, that is used
  32. by monitoring tools like `celery events`, `celerymon` and
  33. the Django Admin monitor. Users can write custom event consumers
  34. to analyze what the workers are doing in real-time.
  35. - Time Limits
  36. Tasks can be enforced a strict time to run, and this can be set as a default
  37. for all tasks, for a specific worker, or individually for each task.
  38. .. sidebar:: Soft, or hard?
  39. The time limit is set in two values, `soft` and `hard`.
  40. The soft time limit allows the task to catch an exception
  41. to clean up before it is killed: the hard timeout is not catchable
  42. and force terminates the task.
  43. - Autoreloading
  44. While developing the worker can be set to automatically reload
  45. when the source code for a task changes.
  46. - Autoscaling
  47. The worker pool can be dynamically resized based on worker load,
  48. and autoscaling rules can be customized by the user.
  49. - Memory Leak Cleanup
  50. Sometimes tasks contain memory leaks that are out of the
  51. developers control, or the task allocated other resources
  52. that cannot be cleaned up. In this case the worker supports
  53. a :option:`--maxtasksperchild` argument that defines how
  54. many task a given pool process can execute before it's
  55. replaced by a fresh process.
  56. - User components
  57. Each worker component can be customized, and additional components
  58. can be defined by the user simply by defining a new boot steps
  59. that will be loaded as part of the workers dependency graph.