README.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. =========================
  2. Celery Stresstest Suite
  3. =========================
  4. .. contents::
  5. :local:
  6. Introduction
  7. ============
  8. These tests will attempt to break the worker in different ways.
  9. The worker must currently be started separately, and it's encouraged
  10. to run the stresstest with different configuration values.
  11. Ideas include:
  12. 1) Frequent maxtasksperchild, single process
  13. ::
  14. $ celery -A stress worker -c 1 --maxtasksperchild=1
  15. 2) Frequent scale down & maxtasksperchild, single process
  16. ::
  17. $ AUTOSCALE_KEEPALIVE=0.01 celery -A stress worker --autoscale=1,0 \
  18. --maxtasksperchild=1
  19. 3) Frequent maxtasksperchild, multiple processes
  20. ::
  21. $ celery -A stress worker -c 8 --maxtasksperchild=1``
  22. 4) Default, single process
  23. ::
  24. $ celery -A stress worker -c 1
  25. 5) Default, multiple processes
  26. ::
  27. $ celery -A stress worker -c 8
  28. 6) Processes termianted by time limits
  29. ::
  30. $ celery -A stress worker --time-limit=1
  31. 7) Frequent maxtasksperchild, single process with late ack.
  32. ::
  33. $ celery -A stress worker -c1 --maxtasksperchild=1 -Z acks_late
  34. 8) Worker using eventlet pool.
  35. Start the worker::
  36. $ celery -A stress worker -c1000 -P eventlet
  37. Then must use the `-g green` test group::
  38. $ python -m stress -g green
  39. 9) Worker using gevent pool.
  40. It's also a good idea to include the ``--purge`` argument to clear out tasks from
  41. previous runs.
  42. Note that the stress client will probably hang if the test fails, so this
  43. test suite is currently not suited for automatic runs.
  44. Configuration Templates
  45. -----------------------
  46. You can select a configuration template using the `-Z` command-line argument
  47. to any :program:`celery -A stress` command or the :program:`python -m stress`
  48. command when running the test suite itself.
  49. The templates available are:
  50. * default
  51. Using amqp as a broker and rpc as a result backend,
  52. and also using json for task and result messages.
  53. * redis
  54. Using redis as a broker and result backend
  55. * acks_late
  56. Enables late ack globally.
  57. * pickle
  58. Using pickle as the serializer for tasks and results
  59. (also allowing the worker to receive and process pickled messages)
  60. You can see the resulting configuration from any template by running
  61. the command::
  62. $ celery -A stress report -Z redis
  63. Example running the stress test using the ``redis`` configuration template::
  64. $ python -m stress -Z redis
  65. Example running the worker using the ``redis`` configuration template::
  66. $ celery -A stress worker -Z redis
  67. You can also mix several templates by listing them separated by commas::
  68. $ celery -A stress worker -Z redis,acks_late
  69. In this example (``redis,acks_late``) the ``redis`` template will be used
  70. as a configuration, and then additional keys from the ``acks_late`` template
  71. will be added on top as changes::
  72. $ celery -A stress report -Z redis,acks_late,pickle
  73. Running the client
  74. ------------------
  75. After the worker is running you can start the client to run the complete test
  76. suite::
  77. $ python -m stress
  78. You can also specify which tests to run:
  79. $ python -m stress revoketermfast revoketermslow
  80. Or you can start from an offset, e.g. to skip the two first tests use
  81. ``--offset=2``::
  82. $ python -m stress --offset=2
  83. See ``python -m stress --help`` for a list of all available options.
  84. Options
  85. =======
  86. Using a different broker
  87. ------------------------
  88. You can set the environment ``CSTRESS_BROKER`` to change the broker used::
  89. $ CSTRESS_BROKER='amqp://' celery -A stress worker # …
  90. $ CSTRESS_BROKER='amqp://' python -m stress
  91. Using a different result backend
  92. --------------------------------
  93. You can set the environment variable ``CSTRESS_BACKEND`` to change
  94. the result backend used::
  95. $ CSTRESS_BACKEND='amqp://' celery -A stress worker # …
  96. $ CSTRESS_BACKEND='amqp://' python -m stress
  97. Using a custom queue
  98. --------------------
  99. A queue named ``c.stress`` is created and used by default,
  100. but you can change the name of this queue using the ``CSTRESS_QUEUE``
  101. environment variable.