Get queued
DON’T MAKE ME
WAIT
Let’s get queued up
Chad Windnagle - @drmmr763
INTRODUCTION
• Recovering Joomla Addict (Clean
2yrs)
• Joomla GSoC Admin (2012-2015)
• Joomla Resource Team Editor
• Joomla!Day, JWC, & JAB Speaker
• JWC 2014 Keynote Speaker
Chad Windnagle - @drmmr763
JOOMLA WAS MY
PLAYGROUND
Chad Windnagle - @drmmr763
JOOMLA INSPIRED
ME
AUDIENCE
INTRODUCTION
Chad Windnagle - @drmmr763
WHAT ARE QUEUES
ANYWAY?
Chad Windnagle - @drmmr763
SYNCHRONOUS FLOW
User Sends
Request
Server Sends
Response
Response
Rendered
Chad Windnagle - @drmmr763
A-SYNCHRONOUS
FLOW
User Sends
Request
Server Sends
Response
Response
Rendered
Background Task
Initialized
Background Task
Executed
Notify User
Task Complete
Chad Windnagle - @drmmr763
WHAT SHOULD WE
QUEUE?•Notifications (Email /
SMS)
•Statistical Calculations
•Data Matching
Algorithms
•Regularly Scheduled
Tasks
•Image / Video
Processing
•Data Indexing
•Traditional Page
Requests
•User File Uploads
•Login / Logout
Functions
•File Downloads
•Add to Cart Functions
•REST API Endpoints
Use Queues: Don’t Use Queues:
COMPONENTS OF A
QUEUE SYSTEM
Chad Windnagle - @drmmr763
THE MESSAGE
A message is string-based content which informs
the application which task to perform, and
encapsulates any data needed to perform that task.
Chad Windnagle - @drmmr763
{
"messageType" : "sendEmail",
"email" : {
"to" : "speakers@jdayflorida.com",
"from" : "chad@chadwindnagle.com",
"subject": "Hello speakers!",
"body" : "Can't wait to see you all."
}
}
MESSAGE
EXAMPLE
Chad Windnagle - @drmmr763
THE QUEUE /
TUBE
The message queue, or tube, contains a collection
of messages that need to be processed by the
queue system.
Chad Windnagle - @drmmr763
Newest Oldest
Typical Processing Order
SERVICE
WORKER
The service worker is code that is responsible for
executing the tasks on the queue.
Chad Windnagle - @drmmr763
Newest Oldest
Typical Processing Order
EXECUTION
CYCLE
Chad Windnagle - @drmmr763
User Requests
Queueable Task
Message with Data
Generated
Message Added
To Queue
Server Boots
Service Worker
Service Worker
Performs Task
Message Removed
From Queue
QUEUE SYSTEM
VENDORS
VARIOUS
VENDORS
Beanstalkd
Laravel
Redis
Gearman
RabbitMQ
AmazonSQS
IronMQ
Symfony
Chad Windnagle - @drmmr763
Beanstalkd
BEANSTALKD
BENEFITS
Chad Windnagle - @drmmr763
RAM Based Data Storage - High Performance!
HTTP Protocol - Allows Multi-Server Set Up
PHP Composer Library Available - Fast
Development
Community Resources (Blogs, Documentation,
Etc.)
Chad Windnagle - @drmmr763
STACK OVERVIEW
PHP Application (Joomla!)
PHP Library (Pheanstalk)
Beanstalkd Service
Queue Jobs
Queue / Execute Job
Chad Windnagle - @drmmr763
apt-get install beanstalkd
INSTALLING
BEANSTALKD
Chad Windnagle - @drmmr763
php composer.phar require
pda/pheanstalk
INSTALL PHEANSTALK
RUNNING
BEANSTALKD
Chad Windnagle - @drmmr763
./beanstalkd -l 127.0.0.1 -p 11300
Options:
-l Specify the address to listen on
-p specify the port to listen on
CURRENT STATUS?
Chad Windnagle - @drmmr763
Beanstalkd is running:
- It can add jobs to a queue
- Returns job details to service worker
- Jobs can be removed from the queue
ADD MESSAGE TO
QUEUE
Chad Windnagle - @drmmr763
<?php
use PheanstalkPheanstalk;
// connect to Beanstalkd Service
$pheanstalk = new Pheanstalk(‘127.0.0.1');
// add the job to the queue
$pheanstalk->put(‘a special message’);
GET MESSAGE FROM
QUEUE
Chad Windnagle - @drmmr763
<?php
use PheanstalkPheanstalk;
// connect to Beanstalkd Service
$pheanstalk = new Pheanstalk(‘127.0.0.1');
// get next available job from queue
$job = $pheanstalk
->watch(‘default’) // specific tube
->reserve(); // job in progress
EXECUTE A TASK
Chad Windnagle - @drmmr763
<?php
// get the message from the queued job
$jobData = $job->getData();
// prints “a special message”
print $jobData;
// remove job from queue
$job->delete();
MORE USEFUL
EXAMPLE
Chad Windnagle - @drmmr763
$message = [
‘messageType => ‘sendEmail’,
‘email’ => [
‘to’ => ‘speakers@jdayflorida.com’,
‘from’ => ‘chad@chadwindnagle.com’,
‘subject => ‘Hello speakers!’,
‘body’ => ‘Please come to my session!’
]
];
MORE USEFUL
EXAMPLE
Chad Windnagle - @drmmr763
<?php
// add the job to the queue
$pheanstalk->put(json_encode($message));
Application code would add tasks to the queue
MORE USEFUL
EXAMPLE
Chad Windnagle - @drmmr763
// get the message from the queued job
$jobData = json_decode($job->getData());
$messageType = $jobData[‘messageType’];
if ($messageType == ‘sendEmail’ {
// “to”, “from”, “subject”, & “body”
$this->sendEmail($jobData[‘email’]);
}
Service worker executes based on message type
TRIGGERING SERVICE
WORKER
Chad Windnagle - @drmmr763
php ./service-worker.php
Chad Windnagle - @drmmr763
github.com/drmmr763/jdayflorida
PHP Project
Composer Based
Uses Pheanstalk
Uses Beanstalkd
Command Line Utilities
PHP Class Message
Types
EXAMPLE GITHUB CODE
ANY QUESTIONS?
Chad Windnagle - @drmmr763
ICON CREDITS
Kirby Wu
Schmidt
Sergey
IconSpher
e
Carl
Holdnerss
ProSymbol
s
Above icons licensed via Creative Commons, sourced from TheNounProject.com
Gregor
Cresnar
Olivia
Stoian
Rudolf
Horaczek
ProSymbol
s
icon 54
ChangHoo
n
Baek
Daniel
Baker
Chad Windnagle - @drmmr763
THANK YOU!Code:
github.com/drmmr763/jdayflorida
Follow Me: @drmmr763
Slides available on slideshare

More Related Content

PDF
Going Beyond LAMP Again - Manchester WordPress User Group
PPTX
Managing Technical Debt - WordCamp Orlando 2017
PDF
2015 ZendCon - Do you queue
PDF
Faster PHP apps using Queues and Workers
PPTX
Message Queues & Offline Processing with PHP
PDF
Life in a Queue - Using Message Queue with django
PPT
Job Queue - web is more than request and response
PDF
Queue your work
Going Beyond LAMP Again - Manchester WordPress User Group
Managing Technical Debt - WordCamp Orlando 2017
2015 ZendCon - Do you queue
Faster PHP apps using Queues and Workers
Message Queues & Offline Processing with PHP
Life in a Queue - Using Message Queue with django
Job Queue - web is more than request and response
Queue your work

Similar to Get queued (20)

ODP
The Art of Message Queues - TEKX
PPTX
Do you queue (updated)
ODP
Art Of Message Queues
PPTX
Massaging the Pony: Message Queues and You
PPTX
Slides from LAX & DEN usergroup meetings
PPT
Job_Queues
PDF
Queue Everything and Please Everyone
PDF
PyCon India 2012: Celery Talk
PPTX
Do you queue
PPTX
Getting started with rabbitmq
PPTX
North east user group tour
ODP
Introduction to Python Celery
PDF
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
PDF
Distributed Queue System using Gearman
PPTX
Real usages of jms message queues
PPTX
Drupal as integration hub.odp
PDF
Delayed operations with queues for website performance
PPTX
Developing highly scalable applications with Symfony and RabbitMQ
PDF
Celery: The Distributed Task Queue
PPT
Gearman and asynchronous processing in PHP applications
The Art of Message Queues - TEKX
Do you queue (updated)
Art Of Message Queues
Massaging the Pony: Message Queues and You
Slides from LAX & DEN usergroup meetings
Job_Queues
Queue Everything and Please Everyone
PyCon India 2012: Celery Talk
Do you queue
Getting started with rabbitmq
North east user group tour
Introduction to Python Celery
Practical Message Queuing Using RabbitMQ (PHPem, 3rd July 2014)
Distributed Queue System using Gearman
Real usages of jms message queues
Drupal as integration hub.odp
Delayed operations with queues for website performance
Developing highly scalable applications with Symfony and RabbitMQ
Celery: The Distributed Task Queue
Gearman and asynchronous processing in PHP applications
Ad

More from Chad Windnagle (9)

PPTX
Good dev citizen
PDF
Joomla tempates talk
PPTX
May the core be with you - JandBeyond 2014
PPTX
Google Summer of Code Presentation - JWC12
PPTX
Template overrides austin
PPTX
Joomla Essential Extensions
PPTX
Getting Involved in the Joomla Community
PPTX
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
PPT
Developing joomla 1.6 templates
Good dev citizen
Joomla tempates talk
May the core be with you - JandBeyond 2014
Google Summer of Code Presentation - JWC12
Template overrides austin
Joomla Essential Extensions
Getting Involved in the Joomla Community
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Developing joomla 1.6 templates
Ad

Recently uploaded (20)

PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
Consumable AI The What, Why & How for Small Teams.pdf
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
Architecture types and enterprise applications.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
CloudStack 4.21: First Look Webinar slides
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PPTX
Microsoft Excel 365/2024 Beginner's training
PPTX
Configure Apache Mutual Authentication
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
PDF
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
sbt 2.0: go big (Scala Days 2025 edition)
Consumable AI The What, Why & How for Small Teams.pdf
Credit Without Borders: AI and Financial Inclusion in Bangladesh
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Chapter 5: Probability Theory and Statistics
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Convolutional neural network based encoder-decoder for efficient real-time ob...
Architecture types and enterprise applications.pdf
Developing a website for English-speaking practice to English as a foreign la...
CloudStack 4.21: First Look Webinar slides
Final SEM Unit 1 for mit wpu at pune .pptx
Microsoft Excel 365/2024 Beginner's training
Configure Apache Mutual Authentication
A review of recent deep learning applications in wood surface defect identifi...
Improvisation in detection of pomegranate leaf disease using transfer learni...
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Custom Battery Pack Design Considerations for Performance and Safety
How ambidextrous entrepreneurial leaders react to the artificial intelligence...
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx

Get queued

  • 2. DON’T MAKE ME WAIT Let’s get queued up Chad Windnagle - @drmmr763
  • 3. INTRODUCTION • Recovering Joomla Addict (Clean 2yrs) • Joomla GSoC Admin (2012-2015) • Joomla Resource Team Editor • Joomla!Day, JWC, & JAB Speaker • JWC 2014 Keynote Speaker Chad Windnagle - @drmmr763
  • 5. Chad Windnagle - @drmmr763 JOOMLA INSPIRED ME
  • 8. Chad Windnagle - @drmmr763 SYNCHRONOUS FLOW User Sends Request Server Sends Response Response Rendered
  • 9. Chad Windnagle - @drmmr763 A-SYNCHRONOUS FLOW User Sends Request Server Sends Response Response Rendered Background Task Initialized Background Task Executed Notify User Task Complete
  • 10. Chad Windnagle - @drmmr763 WHAT SHOULD WE QUEUE?•Notifications (Email / SMS) •Statistical Calculations •Data Matching Algorithms •Regularly Scheduled Tasks •Image / Video Processing •Data Indexing •Traditional Page Requests •User File Uploads •Login / Logout Functions •File Downloads •Add to Cart Functions •REST API Endpoints Use Queues: Don’t Use Queues:
  • 11. COMPONENTS OF A QUEUE SYSTEM Chad Windnagle - @drmmr763
  • 12. THE MESSAGE A message is string-based content which informs the application which task to perform, and encapsulates any data needed to perform that task. Chad Windnagle - @drmmr763
  • 13. { "messageType" : "sendEmail", "email" : { "to" : "speakers@jdayflorida.com", "from" : "chad@chadwindnagle.com", "subject": "Hello speakers!", "body" : "Can't wait to see you all." } } MESSAGE EXAMPLE Chad Windnagle - @drmmr763
  • 14. THE QUEUE / TUBE The message queue, or tube, contains a collection of messages that need to be processed by the queue system. Chad Windnagle - @drmmr763 Newest Oldest Typical Processing Order
  • 15. SERVICE WORKER The service worker is code that is responsible for executing the tasks on the queue. Chad Windnagle - @drmmr763 Newest Oldest Typical Processing Order
  • 16. EXECUTION CYCLE Chad Windnagle - @drmmr763 User Requests Queueable Task Message with Data Generated Message Added To Queue Server Boots Service Worker Service Worker Performs Task Message Removed From Queue
  • 19. BEANSTALKD BENEFITS Chad Windnagle - @drmmr763 RAM Based Data Storage - High Performance! HTTP Protocol - Allows Multi-Server Set Up PHP Composer Library Available - Fast Development Community Resources (Blogs, Documentation, Etc.)
  • 20. Chad Windnagle - @drmmr763 STACK OVERVIEW PHP Application (Joomla!) PHP Library (Pheanstalk) Beanstalkd Service Queue Jobs Queue / Execute Job
  • 21. Chad Windnagle - @drmmr763 apt-get install beanstalkd INSTALLING BEANSTALKD
  • 22. Chad Windnagle - @drmmr763 php composer.phar require pda/pheanstalk INSTALL PHEANSTALK
  • 23. RUNNING BEANSTALKD Chad Windnagle - @drmmr763 ./beanstalkd -l 127.0.0.1 -p 11300 Options: -l Specify the address to listen on -p specify the port to listen on
  • 24. CURRENT STATUS? Chad Windnagle - @drmmr763 Beanstalkd is running: - It can add jobs to a queue - Returns job details to service worker - Jobs can be removed from the queue
  • 25. ADD MESSAGE TO QUEUE Chad Windnagle - @drmmr763 <?php use PheanstalkPheanstalk; // connect to Beanstalkd Service $pheanstalk = new Pheanstalk(‘127.0.0.1'); // add the job to the queue $pheanstalk->put(‘a special message’);
  • 26. GET MESSAGE FROM QUEUE Chad Windnagle - @drmmr763 <?php use PheanstalkPheanstalk; // connect to Beanstalkd Service $pheanstalk = new Pheanstalk(‘127.0.0.1'); // get next available job from queue $job = $pheanstalk ->watch(‘default’) // specific tube ->reserve(); // job in progress
  • 27. EXECUTE A TASK Chad Windnagle - @drmmr763 <?php // get the message from the queued job $jobData = $job->getData(); // prints “a special message” print $jobData; // remove job from queue $job->delete();
  • 28. MORE USEFUL EXAMPLE Chad Windnagle - @drmmr763 $message = [ ‘messageType => ‘sendEmail’, ‘email’ => [ ‘to’ => ‘speakers@jdayflorida.com’, ‘from’ => ‘chad@chadwindnagle.com’, ‘subject => ‘Hello speakers!’, ‘body’ => ‘Please come to my session!’ ] ];
  • 29. MORE USEFUL EXAMPLE Chad Windnagle - @drmmr763 <?php // add the job to the queue $pheanstalk->put(json_encode($message)); Application code would add tasks to the queue
  • 30. MORE USEFUL EXAMPLE Chad Windnagle - @drmmr763 // get the message from the queued job $jobData = json_decode($job->getData()); $messageType = $jobData[‘messageType’]; if ($messageType == ‘sendEmail’ { // “to”, “from”, “subject”, & “body” $this->sendEmail($jobData[‘email’]); } Service worker executes based on message type
  • 31. TRIGGERING SERVICE WORKER Chad Windnagle - @drmmr763 php ./service-worker.php
  • 32. Chad Windnagle - @drmmr763 github.com/drmmr763/jdayflorida PHP Project Composer Based Uses Pheanstalk Uses Beanstalkd Command Line Utilities PHP Class Message Types EXAMPLE GITHUB CODE
  • 34. ICON CREDITS Kirby Wu Schmidt Sergey IconSpher e Carl Holdnerss ProSymbol s Above icons licensed via Creative Commons, sourced from TheNounProject.com Gregor Cresnar Olivia Stoian Rudolf Horaczek ProSymbol s icon 54 ChangHoo n Baek Daniel Baker
  • 35. Chad Windnagle - @drmmr763 THANK YOU!Code: github.com/drmmr763/jdayflorida Follow Me: @drmmr763 Slides available on slideshare

Editor's Notes

  • #2: Mention the sponsor - say something nice.
  • #6: Joomla inspired me excited to be back share what I’ve learned go see if the grass is greener on the other side smell the roses
  • #7: the curious coder the devops engineer (what version of linux is running in the background eh?) The newbie (totally new!) - I’ve got something for all of you (I Hope)
  • #8: Before we start talking about how to use a queue I want to explain what a queue is and why we might use one mention examples such as submitting a contact form, placing an order, processing a credit card, etc.. why would we want to change this flow? - Doesn’t allow for certain scalability needs - Can cause other processes to become slow or unstable - we can improve the user experience by not making them wait
  • #9: Mention telephone call example Mention example about submitting an email form.
  • #14: As I said before jobs are STRING based content. We can luckily use JSON to encode strings of complex data so the string won’t really limit us at all.
  • #16: your service worker as a ghost user.
  • #17: our application code will be responsible for generating the message and adding it to the queue.
  • #18: There are a number of different vendors on the market for queue systems
  • #21: Here’s an overview of the structure of our system once we have it all set up. We’re going to install two main pieces of software: Beanstalkd. The messaging queue service Pheanstalk - A PHP library which was created for interacting with Beanstalkd. This just makes it a little easier to write PHP code that our Joomla site might use to perform tasks. Beanstalkd is language agnostic, though. You could use any language to do this.
  • #26: Application code can add jobs to the queue.
  • #29: Application code can add jobs to the queue.
  • #30: Instead of a simple message we can actually put a complex JSON object into the message queue.
  • #32: An important question you might be asking is how does the service worker know when to go to work or get triggered by the server? Our
  • #33: An important question you might be asking is how does the service worker know when to go to work or get triggered by the server? Our
  • #34: An important question you might be asking is how does the service worker know when to go to work or get triggered by the server? Our