This document describes the current stable version of Celery (5.2). For development docs, go here.
celery.utils.debug
¶
Sampling Memory Usage¶
This module can be used to diagnose and sample the memory usage used by parts of your application.
For example, to sample the memory usage of calling tasks you can do this:
from celery.utils.debug import sample_mem, memdump
from tasks import add
try:
for i in range(100):
for j in range(100):
add.delay(i, j)
sample_mem()
finally:
memdump()
API Reference¶
Utilities for debugging memory usage, blocking calls, etc.
- celery.utils.debug.sample_mem()[source]¶
Sample RSS memory usage.
Statistics can then be output by calling
memdump()
.
- celery.utils.debug.memdump(samples=10, file=None)[source]¶
Dump memory statistics.
Will print a sample of all RSS memory samples added by calling
sample_mem()
, and in addition print used RSS memory aftergc.collect()
.