Celery vs dramatiq benchmark comparison


#1

From this link: https://github.com/Bogdanp/dramatiq/blob/master/benchmarks/bench.py
When green threads are enabled:
Total number of child processes processing the queue in case of celery is 2000.
subprocess_args.extend(["-P", "eventlet", "-c", "2000"])

Total number of worker threads for dramatiq is also 8 * 250 = 2000.
subprocess_args = ["dramatiq-gevent", "bench", "-p", "8", "-t", "250"]

When green threads are not enabled:
Total number of child processes processing the queue in case of celery is 8.
subprocess_args.extend(["-c", "8"])

But total number of worker threads for dramatiq is 8 * 8 = 64
subprocess_args = ["dramatiq", "bench", "-p", "8"]

from dramatiq --help:

–threads THREADS, -t THREADS
the number of worker threads per process (default: 8)

So there are 8 worker processes and by default each process has 8 worker threads.

Shouldn’t celery have been run with -c 64 to match the count just as in the case where green threads were enabled?

When I actually ran the benchmarks I got the results also accordingly. In case of green threads enabled nearly same run time for both. In case of green threads disabled celery taking ~10 times more.

Am I missing something? Please clarify.
cc @bogdan


#2

There’s a reason I haven’t posted these anywhere. :smiley:

I did it that way to benchmark the per-process performance (i.e. dramatiq can do more w/ fewer processes because of its multiple-threads-per-worker-process design).

We could maybe add another flag (or flags) to test the same number of threads regardless of process count and possibly even a config where we limit dramatiq’s --threads to 1 and run the same number of processes for both.