Django & Celery: A love story of async proportions with Hugo Bessa
Django: A Framework for perfectionists with deadlines
- Batteries included: Security, Authentication, Authorization, Administration, robust and mature ORM, etc.
- Opinionated: Django defines the right path for doing things with it. And this open doors for building extensions.
- Strong Community: Open source packages, events, meetups, active development of the main framework
Django's performance issue is a thing. We need to be careful with:
- Avoiding N+1s
- Caching
- Database indexes
- Data denormalization
- Running operations in the background
Why running operations in the background?
- Each Django process loads the framework core
- It's expensive to have too many processes
- Requests hold one Django process each while being processed
- Requests should be processed quickly so we don't hold a process for too long
- We need to give feedback to the user quickly, so they can move forward with other operations
What is Celery? Asynchronous task queue or job queue which is based on distributed message passing
Why Celery?
- Distributed: It separates async tasks execution from your application
- Fast: Celery has a very small boilerplate and executes tasks REALLY fast
- Integrated: You can write Celery tasks within your application, with access to models, services, functions, classes, etc
Celery 💘 Django
- Documentation: We have dedicated docs for integrating them both
- Django Settings: You can configure Celery from Django settings, not extra boilerplate
- Django within tasks: Access to Django ORM and other tools on Celery tasks
- Community: There are packages for enhancing the integration
This talk was presented at: https://2024.djangocon.us/talks/django-celery-a-love-story-of-async-proportions/
LINKS: Follow Hugo Bessa 👇 On X: https://x.com/hugoabessa Website: https://bessa.me
Follow DjangoCon US 👇 https://fosstodon.org/@djangocon https://x.com/djangocon
Follow DEFNA 👇 https://www.defna.org/
Video production by the presenter and DjangoCon US 2024 volunteers.
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.