Saturday, 12 June 2021

How to release memory resources after django-background-task completes its execution?

I'm executing some of the long-running tasks with Django-background-tasks. Background task takes some data from DB and process it internally which requires memory of 1 GB for each task.

The task is running in the async way.

When any task runs and completes its execution, Django-background-tasks does not release the memory after completing execution. Which causing memory issues to the Dameon pod. Any solution around deallocation of memory resources in Django-background-task? E.g.

Note: resources available are fixed. so need a workaround on resource deallocation of tasks. Currently, memory gets deallocated when the pod restarts.

@background()
def my_task():
    """
    a long-running task that takes time of 20-30 mins, which includes some DB interactions.
    """
    pass


from How to release memory resources after django-background-task completes its execution?

No comments:

Post a Comment