Django

Django & Celery

Celery setup, tasks, periodic tasks, task routing, retry strategies, monitoring, beat scheduler

22 câu hỏi phỏng vấn·
Senior
1

What is the main role of Celery in a Django application?

Câu trả lời

Celery is a distributed asynchronous task queue that allows executing long-running or resource-intensive operations in the background, without blocking HTTP requests. This improves user experience by making the application more responsive, particularly for sending emails, image processing, or intensive computations.

2

Which Celery component is responsible for storing pending task messages?

Câu trả lời

The message broker (like Redis or RabbitMQ) is the central component that stores task messages pending execution. It acts as an intermediary between the task producer (Django) and the Celery workers that consume and execute these tasks.

3

How to define a basic Celery task in a Django application?

Câu trả lời

A Celery task is defined by using the @shared_task or @app.task decorator on a Python function. The @shared_task decorator is preferred as it allows reusing the task across different applications without depending on a specific Celery instance.

4

What is the difference between task.delay() and task.apply_async()?

5

Which file is typically created at the root of the Django project to configure Celery?

+19 câu hỏi phỏng vấn

Nắm vững Django cho lần phỏng vấn tiếp theo

Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.

Bắt đầu miễn phí