SlideShare a Scribd company logo
Django Celery
How to handle asynchronous tasks in Django
What is Celery?
Don’t Block the User
Speed
Scale
Use Cases

• Logging
• Regular twitter updates
• Sending 10k (or more!) emails
Celery
Choosing a Message Queue

• MongoDB
              Celery Documentation
• CouchDB      and most installations
• Beanstalk   use RabbitMQ - and so
                    should you.
• Redis
• RabbitMQ
Queues vs. Hosts
Tools and Command


• sudo rabbitmqctl set_permissions user_name “.*” “.*” “.*”
• ./manage.py celeryd -c6
• ./manage.py camqadm
• sudo rabbitmqctl list_queues
Setting up a Daemon on
           Ubuntu
• Copy celeryd from https://github.com/ask/
 celery/tree/master/contrib/debian/init.d/ to /
 etc/init.d/

• Copy gist from https://gist.github.com/702593
 to /etc/default/celeryd

• Update runlevels: sudo update-rc.d celeryd
 defaults

• Start celeryd: sudo service celeryd start
Yipit Django Team


• http://tech.yipit.com/
• Adam Nelson - @varud
• Zach Smith - @zmsmith
• Nitya Oberoi - @nityaoberoi

More Related Content

PPTX
Celery workshop
Eswar Vandanapu
 
PDF
Queick: A Simple Job Queue System for Python
Ryota Suenaga
 
PPTX
Task queuing with redis and rq
ndeininger
 
PDF
Asynchronous job queues with python-rq
Ashish Acharya
 
PDF
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
KEY
Event machine
almeidaricardo
 
PDF
Golang @ Tokopedia
Qasim Zaidi
 
PPTX
OpenWhisk Go/Swift/Binaries Runtime
Michele Sciabarrà
 
Celery workshop
Eswar Vandanapu
 
Queick: A Simple Job Queue System for Python
Ryota Suenaga
 
Task queuing with redis and rq
ndeininger
 
Asynchronous job queues with python-rq
Ashish Acharya
 
Developer-friendly taskqueues: What you should ask yourself before choosing one
Sylvain Zimmer
 
Event machine
almeidaricardo
 
Golang @ Tokopedia
Qasim Zaidi
 
OpenWhisk Go/Swift/Binaries Runtime
Michele Sciabarrà
 

What's hot (20)

KEY
Make It Cooler: Using Decentralized Version Control
indiver
 
PPTX
OpenWhisk Go Runtime
Michele Sciabarrà
 
PDF
Steamlining your puppet development workflow
Tomas Doran
 
PPTX
Perfomance tuning on Go 2.0
Yogi Kulkarni
 
ODP
Rex - Lightning Talk yapc.eu 2013
Jan Gehring
 
PDF
What we do with Go
MarcelLanz
 
PDF
High Performance Systems in Go - GopherCon 2014
Derek Collison
 
PDF
eigr.io – a Serverless Runtime on the BEAM (ACM SIGPLAN, ICFP 2021 Erlang Wor...
MarcelLanz
 
PDF
Puppet Camp Chicago 2014: Running Multiple Puppet Masters (Beginner)
Puppet
 
PDF
"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
ConSol Consulting & Solutions Software GmbH
 
PDF
Continuous Integration on Steroids
Alexander Akbashev
 
KEY
Crash reports pycodeconf
lauraxthomson
 
PDF
[231] the simplicity of cluster apps with circuit
NAVER D2
 
PDF
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
tdc-globalcode
 
KEY
Concurrency in ruby
Marco Borromeo
 
PDF
Ceylon From Here to Infinity: The Big Picture and What's Coming
Virtual JBoss User Group
 
PPTX
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Tim Callaghan
 
PPTX
Next generation pipelines
Alex Landa
 
PDF
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
PPTX
ContainerCon sysdig Slides
Loris Degioanni
 
Make It Cooler: Using Decentralized Version Control
indiver
 
OpenWhisk Go Runtime
Michele Sciabarrà
 
Steamlining your puppet development workflow
Tomas Doran
 
Perfomance tuning on Go 2.0
Yogi Kulkarni
 
Rex - Lightning Talk yapc.eu 2013
Jan Gehring
 
What we do with Go
MarcelLanz
 
High Performance Systems in Go - GopherCon 2014
Derek Collison
 
eigr.io – a Serverless Runtime on the BEAM (ACM SIGPLAN, ICFP 2021 Erlang Wor...
MarcelLanz
 
Puppet Camp Chicago 2014: Running Multiple Puppet Masters (Beginner)
Puppet
 
"Using Automation Tools To Deploy And Operate Applications In Real World Scen...
ConSol Consulting & Solutions Software GmbH
 
Continuous Integration on Steroids
Alexander Akbashev
 
Crash reports pycodeconf
lauraxthomson
 
[231] the simplicity of cluster apps with circuit
NAVER D2
 
TDC2017 | São Paulo - Trilha Containers How we figured out we had a SRE team ...
tdc-globalcode
 
Concurrency in ruby
Marco Borromeo
 
Ceylon From Here to Infinity: The Big Picture and What's Coming
Virtual JBoss User Group
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Tim Callaghan
 
Next generation pipelines
Alex Landa
 
Golang Performance : microbenchmarks, profilers, and a war story
Aerospike
 
ContainerCon sysdig Slides
Loris Degioanni
 
Ad

Viewers also liked (17)

PDF
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Jimmy DeadcOde
 
PPTX
Celery in the Django
Walter Liu
 
ODP
Europython 2011 - Playing tasks with Django & Celery
Mauro Rocco
 
PDF
MinbilDinbil Django Speed Tricks
Lorenzo Setale
 
PDF
Django Celery - A distributed task queue
Alex Eftimie
 
ODP
Large Scale Processing with Django
Udi Bauman
 
PDF
Celery with python
Alexandre González Rodríguez
 
PDF
PyCon India 2012: Celery Talk
Piyush Kumar
 
PDF
Data processing with celery and rabbit mq
Jeff Peck
 
PDF
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
PDF
Practical Celery
Cameron Maske
 
KEY
Django Celery
Mat Clayton
 
PDF
Celery: The Distributed Task Queue
Richard Leland
 
PDF
Advanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Simon Willison
 
PDF
An Introduction to Celery
Idan Gazit
 
PDF
Web Development with Python and Django
Michael Pirnat
 
PDF
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
Website Monitoring with Distributed Messages/Tasks Processing (AMQP & RabbitM...
Jimmy DeadcOde
 
Celery in the Django
Walter Liu
 
Europython 2011 - Playing tasks with Django & Celery
Mauro Rocco
 
MinbilDinbil Django Speed Tricks
Lorenzo Setale
 
Django Celery - A distributed task queue
Alex Eftimie
 
Large Scale Processing with Django
Udi Bauman
 
Celery with python
Alexandre González Rodríguez
 
PyCon India 2012: Celery Talk
Piyush Kumar
 
Data processing with celery and rabbit mq
Jeff Peck
 
Life in a Queue - Using Message Queue with django
Tareque Hossain
 
Practical Celery
Cameron Maske
 
Django Celery
Mat Clayton
 
Celery: The Distributed Task Queue
Richard Leland
 
Advanced Aspects of the Django Ecosystem: Haystack, Celery & Fabric
Simon Willison
 
An Introduction to Celery
Idan Gazit
 
Web Development with Python and Django
Michael Pirnat
 
5 Steps to PostgreSQL Performance
Command Prompt., Inc
 
Ad

Similar to Celery (19)

PDF
Celery
Fatih Erikli
 
PPT
Introduction to Django-Celery and Supervisor
Suresh Kumar
 
PDF
Celery
Òscar Vilaplana
 
PDF
Celery by dummy
Dungjit Shiowattana
 
PDF
Scaling up task processing with Celery
Nicolas Grasset
 
PDF
Deixa para depois, Procrastinando com Celery em Python
Adriano Petrich
 
ODP
Introduction to Python Celery
Mahendra M
 
PPTX
Asynchronous Task Queues with Celery
Kishor Kumar
 
PDF
Celery introduction
Ionel Mărieș Cristian
 
PPTX
Django Deployment-in-AWS
Mindfire Solutions
 
PDF
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
PDF
Introduction to Celery
Chathuranga Bandara
 
PDF
Tasks: you gotta know how to run them
Filipe Ximenes
 
PDF
Advanced task management with Celery
Mahendra M
 
PDF
Queue Everything and Please Everyone
Vaidik Kapoor
 
PDF
The State of WebSockets in Django
Rami Sayar
 
PDF
Advanced workflows
Mitch Kuchenberg
 
PDF
Django productivity tips and tricks
Simone Federici
 
PPTX
Massaging the Pony: Message Queues and You
Shawn Rider
 
Celery
Fatih Erikli
 
Introduction to Django-Celery and Supervisor
Suresh Kumar
 
Celery by dummy
Dungjit Shiowattana
 
Scaling up task processing with Celery
Nicolas Grasset
 
Deixa para depois, Procrastinando com Celery em Python
Adriano Petrich
 
Introduction to Python Celery
Mahendra M
 
Asynchronous Task Queues with Celery
Kishor Kumar
 
Celery introduction
Ionel Mărieș Cristian
 
Django Deployment-in-AWS
Mindfire Solutions
 
Why and how Pricing Assistant migrated from Celery to RQ - Paris.py #2
Sylvain Zimmer
 
Introduction to Celery
Chathuranga Bandara
 
Tasks: you gotta know how to run them
Filipe Ximenes
 
Advanced task management with Celery
Mahendra M
 
Queue Everything and Please Everyone
Vaidik Kapoor
 
The State of WebSockets in Django
Rami Sayar
 
Advanced workflows
Mitch Kuchenberg
 
Django productivity tips and tricks
Simone Federici
 
Massaging the Pony: Message Queues and You
Shawn Rider
 

More from Yipit (9)

PDF
Outsourcing startup operations 3 10-13
Yipit
 
PPTX
SMX East: Doing Offers Right
Yipit
 
PPTX
Trillion Dollar Industry | Deals 3D
Yipit
 
PPTX
Outsourcing Class
Yipit
 
PPTX
Newspaper Daily Deal Performance - March 2010
Yipit
 
PPTX
Group Buying By The Numbers
Yipit
 
PPTX
Daily Deals: Where Ads Become Content
Yipit
 
PPTX
Daily Deal Stack
Yipit
 
PPTX
Yipit Webinar 8-19-10
Yipit
 
Outsourcing startup operations 3 10-13
Yipit
 
SMX East: Doing Offers Right
Yipit
 
Trillion Dollar Industry | Deals 3D
Yipit
 
Outsourcing Class
Yipit
 
Newspaper Daily Deal Performance - March 2010
Yipit
 
Group Buying By The Numbers
Yipit
 
Daily Deals: Where Ads Become Content
Yipit
 
Daily Deal Stack
Yipit
 
Yipit Webinar 8-19-10
Yipit
 

Recently uploaded (20)

PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 

Celery

  • 1. Django Celery How to handle asynchronous tasks in Django
  • 6. Use Cases • Logging • Regular twitter updates • Sending 10k (or more!) emails
  • 8. Choosing a Message Queue • MongoDB Celery Documentation • CouchDB and most installations • Beanstalk use RabbitMQ - and so should you. • Redis • RabbitMQ
  • 10. Tools and Command • sudo rabbitmqctl set_permissions user_name “.*” “.*” “.*” • ./manage.py celeryd -c6 • ./manage.py camqadm • sudo rabbitmqctl list_queues
  • 11. Setting up a Daemon on Ubuntu • Copy celeryd from https://github.com/ask/ celery/tree/master/contrib/debian/init.d/ to / etc/init.d/ • Copy gist from https://gist.github.com/702593 to /etc/default/celeryd • Update runlevels: sudo update-rc.d celeryd defaults • Start celeryd: sudo service celeryd start
  • 12. Yipit Django Team • http://tech.yipit.com/ • Adam Nelson - @varud • Zach Smith - @zmsmith • Nitya Oberoi - @nityaoberoi

Editor's Notes

  • #2: Presenters:\n\nAdam Nelson - Prior to Yipit, Adam was SVP of Technology at PerformLine, an online advertising compliance company. He was responsible for the development and architecture of the company’s flagship Campaign Verification platform. Previously, he was CTO of ForSaleByOwner.com, which was acquired by Tribune Interactive in 2006. He received a B.S. in Physics from the State University of New York at Albany and an A.M. in International Relations from the University of Chicago.\n\nZach Smith- Prior to Yipit, Zach was the Lead Product Architect at PerformLine. Zach graduated from Washington University in St. Louis with a degree in Economics and Marketing and studied Computer Science at Columbia University.\n
  • #3: Celery is a python library for queueing and running jobs asynchronously, usually using the Advanced Message Queuing Protocol. django-celery (djcelery) is a django library that sits on top of celery.\nCelery “tasks” can be queued whenever the application doesn’t need to know the outcome of a request in real time.\nExamples include click logging, sending email from a site, computing slow queries offline\n
  • #4: The most important reason to use Celery is to offload tasks that would otherwise block other processes - most importantly convenience to the end user. For example, when reviewing deals on Yipit, celery is responsible for indexing so that the user can continue using the website.\n
  • #5: Celery jobs don't finish any sooner than normal Python operations, but from the user’s point of view it can make things seem very fast. Processing is done offline from the user process. \n
  • #6: Because celery job are split into individual tasks, it is easy to run jobs in separate processes for horizontal scalability\n
  • #7: Actions where the user doesn’t need to know the outcome\n Repetitive jobs \n Jobs that can be run in parallel \n
  • #8: Most Python methods will use standard synchronous processing and connect to the database directly. Slow or big jobs can be pushed to RabbitMQ to be done later by Celery workers offline.\n Brokers and workers can be on the same machine, there is little advantage to splitting them up since the broker service (RabbitMQ) uses very few resources.\n Multiple worker servers are only necessary if your tasks are taking too long and you’ve fully loaded the first worker server.\n Multiple broker servers are only necessary if unplanned downtime is unacceptable.\n
  • #9: I’m not the biggest fan of RabbitMQ because of its poor documentation but it works very well and the main Celery developer (Solem) uses it and it is the most mature configuration. The performance and reliability has been fantastic so far. RabbitMQ is the easiest and likely the best option unless you have deep experience with one of the alternative broker backends.\n\nAs with everything else, use homebrew to install RabbitMQ on your Mac.\n
  • #10: The RabbitMQ documentation isn’t very clear on how virtual hosts and queues work.\n Virtual Hosts are only useful for security isolation (i.e. different credentials for different hosts). There is no performance or administrative benefit to using multiple virtual hosts.\n Queues are very useful if you want one worker dedicated to one queue of jobs instead of another. This way, if one queue has jobs that should have priority, a dedicated Celery worker can be assigned to that queue alone.\n
  • #11: rabbitmqctl set_permissions - Grants all permissions to user_name\nceleryd - deamon for running jobs, concurrency\ncamqadm - Relatively new interactive shell for querying rabbit broker\nrabbitmqctl list_queues - Shows number of items in each queue\n
  • #12: Having a celeryd daemon running is much better than relying on a ./manage.py implementation from the command line. This way the service starts when the machine starts up and shuts down gracefully when the machine is rebooted. Remember to restart the celery service if any of the Python files are updated - otherwise you’re running the old code.\n
  • #13: Thanks Everybody!\n