| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 | ========================= Celery Stresstest Suite=========================.. contents::    :local:Introduction============These tests will attempt to break the worker in different ways.The worker must currently be started separately, and it's encouragedto run the stresstest with different configuration values.Ideas include:1)  Frequent maxtasksperchild, single process::    $ celery -A stress worker -c 1 --maxtasksperchild=12) Frequent scale down & maxtasksperchild, single process::    $ AUTOSCALE_KEEPALIVE=0.01 celery -A stress worker --autoscale=1,0 \                                                       --maxtasksperchild=13) Frequent maxtasksperchild, multiple processes::    $ celery -A stress worker -c 8 --maxtasksperchild=1``4) Default, single process::    $ celery -A stress worker -c 15) Default, multiple processes::    $ celery -A stress worker -c 86) Processes termianted by time limits::    $ celery -A stress worker --time-limit=17) Frequent maxtasksperchild, single process with late ack.::    $ celery -A stress worker -c1 --maxtasksperchild=1 -Z acks_late8) Worker using eventlet pool.    Start the worker::        $ celery -A stress worker -c1000 -P eventlet    Then must use the `-g green` test group::        $ python -m stress -g green9) Worker using gevent pool.It's also a good idea to include the ``--purge`` argument to clear out tasks fromprevious runs.Note that the stress client will probably hang if the test fails, so thistest suite is currently not suited for automatic runs.Configuration Templates-----------------------You can select a configuration template using the `-Z` command-line argumentto any :program:`celery -A stress` command or the :program:`python -m stress`command when running the test suite itself.The templates available are:* default    Using amqp as a broker and rpc as a result backend,    and also using json for task and result messages.* redis    Using redis as a broker and result backend* acks_late    Enables late ack globally.* pickle    Using pickle as the serializer for tasks and results    (also allowing the worker to receive and process pickled messages)You can see the resulting configuration from any template by runningthe command::    $ celery -A stress report -Z redisExample running the stress test using the ``redis`` configuration template::    $ python -m stress -Z redisExample running the worker using the ``redis`` configuration template::    $ celery -A stress worker -Z redisYou can also mix several templates by listing them separated by commas::    $ celery -A stress worker -Z redis,acks_lateIn this example (``redis,acks_late``) the ``redis`` template will be usedas a configuration, and then additional keys from the ``acks_late`` templatewill be added on top as changes::    $ celery -A stress report -Z redis,acks_late,pickleRunning the client------------------After the worker is running you can start the client to run the complete testsuite::    $ python -m stressYou can also specify which tests to run:    $ python -m stress revoketermfast revoketermslowOr you can start from an offset, e.g. to skip the two first tests use``--offset=2``::    $ python -m stress --offset=2See ``python -m stress --help`` for a list of all available options.Options=======Using a different result backend--------------------------------You can set the environment variable ``CSTRESS_BACKEND`` to changethe result backend used::    $ CSTRESS_BACKEND='amqp://' celery -A stress worker # …    $ CSTRESS_BACKEND='amqp://' python -m stressUsing a custom queue--------------------A queue named ``c.stress`` is created and used by default,but you can change the name of this queue using the ``CSTRESS_QUEUE``environment variable.
 |