SlideShare a Scribd company logo
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

Similar to Get queued

Phd tutorial hawq_v0.1
Phd tutorial hawq_v0.1Phd tutorial hawq_v0.1
Phd tutorial hawq_v0.1
seungdon Choi
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
James Titcumb
 
2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queue
Mike Willbanks
 
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas MurthyOrchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Evention
 
Tungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten ClustersTungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten Clusters
Continuent
 
GraphConnect 2014 SF: From Zero to Graph in 120: Scale
GraphConnect 2014 SF: From Zero to Graph in 120: ScaleGraphConnect 2014 SF: From Zero to Graph in 120: Scale
GraphConnect 2014 SF: From Zero to Graph in 120: Scale
Neo4j
 
Splunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into SplunkSplunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into Splunk
Splunk
 
IPv6 @ Cloudflare
IPv6 @ CloudflareIPv6 @ Cloudflare
IPv6 @ Cloudflare
Internet Society
 
Designing High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDesigning High Performance RTC Signaling Servers
Designing High Performance RTC Signaling Servers
Daniel-Constantin Mierla
 
Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013
Martin Kenneth Michalsky
 
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
APNIC
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE Introduction
Zhaoyang Wang
 
Real-Time Query for Data Guard
Real-Time Query for Data Guard Real-Time Query for Data Guard
Real-Time Query for Data Guard
Uwe Hesse
 
Data Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and SparkData Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and Spark
Christopher Batey
 
Improving HDFS Availability with IPC Quality of Service
Improving HDFS Availability with IPC Quality of ServiceImproving HDFS Availability with IPC Quality of Service
Improving HDFS Availability with IPC Quality of ServiceDataWorks Summit
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
Aman Kohli
 
Android Performance #4: Network
Android Performance #4: NetworkAndroid Performance #4: Network
Android Performance #4: Network
Yonatan Levin
 
DOWNSAMPLING DATA
DOWNSAMPLING DATADOWNSAMPLING DATA
DOWNSAMPLING DATA
InfluxData
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on Purpose
Aman Kohli
 
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and DruidOpen Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
DataWorks Summit
 

Similar to Get queued (20)

Phd tutorial hawq_v0.1
Phd tutorial hawq_v0.1Phd tutorial hawq_v0.1
Phd tutorial hawq_v0.1
 
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
Kicking off with Zend Expressive and Doctrine ORM (ZendCon 2016)
 
2015 ZendCon - Do you queue
2015 ZendCon - Do you queue2015 ZendCon - Do you queue
2015 ZendCon - Do you queue
 
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas MurthyOrchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
Orchestrating Big Data pipelines @ Fandom - Krystian Mistrzak Thejas Murthy
 
Tungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten ClustersTungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten Clusters
 
GraphConnect 2014 SF: From Zero to Graph in 120: Scale
GraphConnect 2014 SF: From Zero to Graph in 120: ScaleGraphConnect 2014 SF: From Zero to Graph in 120: Scale
GraphConnect 2014 SF: From Zero to Graph in 120: Scale
 
Splunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into SplunkSplunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into Splunk
 
IPv6 @ Cloudflare
IPv6 @ CloudflareIPv6 @ Cloudflare
IPv6 @ Cloudflare
 
Designing High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDesigning High Performance RTC Signaling Servers
Designing High Performance RTC Signaling Servers
 
Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013Stackato Presentation Techzone 2013
Stackato Presentation Techzone 2013
 
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
 
MYSQLCLONE Introduction
MYSQLCLONE IntroductionMYSQLCLONE Introduction
MYSQLCLONE Introduction
 
Real-Time Query for Data Guard
Real-Time Query for Data Guard Real-Time Query for Data Guard
Real-Time Query for Data Guard
 
Data Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and SparkData Science Lab Meetup: Cassandra and Spark
Data Science Lab Meetup: Cassandra and Spark
 
Improving HDFS Availability with IPC Quality of Service
Improving HDFS Availability with IPC Quality of ServiceImproving HDFS Availability with IPC Quality of Service
Improving HDFS Availability with IPC Quality of Service
 
The Real World - Plugging the Enterprise Into It (nodejs)
The Real World - Plugging  the Enterprise Into It (nodejs)The Real World - Plugging  the Enterprise Into It (nodejs)
The Real World - Plugging the Enterprise Into It (nodejs)
 
Android Performance #4: Network
Android Performance #4: NetworkAndroid Performance #4: Network
Android Performance #4: Network
 
DOWNSAMPLING DATA
DOWNSAMPLING DATADOWNSAMPLING DATA
DOWNSAMPLING DATA
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on Purpose
 
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and DruidOpen Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
Open Source Lambda Architecture with Hadoop, Kafka, Samza and Druid
 

More from Chad Windnagle

Good dev citizen
Good dev citizenGood dev citizen
Good dev citizen
Chad Windnagle
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014
Chad Windnagle
 
Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12
Chad Windnagle
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austinChad Windnagle
 
Joomla Essential Extensions
Joomla Essential ExtensionsJoomla Essential Extensions
Joomla Essential Extensions
Chad Windnagle
 
Getting Involved in the Joomla Community
Getting Involved in the Joomla CommunityGetting Involved in the Joomla Community
Getting Involved in the Joomla Community
Chad Windnagle
 
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Developing joomla 1.6 templates - Joomla!Day NYC December 2010Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Chad Windnagle
 
Developing joomla 1.6 templates
Developing joomla 1.6 templatesDeveloping joomla 1.6 templates
Developing joomla 1.6 templates
Chad Windnagle
 

More from Chad Windnagle (9)

Good dev citizen
Good dev citizenGood dev citizen
Good dev citizen
 
Joomla tempates talk
Joomla tempates talkJoomla tempates talk
Joomla tempates talk
 
May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014May the core be with you - JandBeyond 2014
May the core be with you - JandBeyond 2014
 
Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austin
 
Joomla Essential Extensions
Joomla Essential ExtensionsJoomla Essential Extensions
Joomla Essential Extensions
 
Getting Involved in the Joomla Community
Getting Involved in the Joomla CommunityGetting Involved in the Joomla Community
Getting Involved in the Joomla Community
 
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Developing joomla 1.6 templates - Joomla!Day NYC December 2010Developing joomla 1.6 templates - Joomla!Day NYC December 2010
Developing joomla 1.6 templates - Joomla!Day NYC December 2010
 
Developing joomla 1.6 templates
Developing joomla 1.6 templatesDeveloping joomla 1.6 templates
Developing joomla 1.6 templates
 

Recently uploaded

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 

Recently uploaded (20)

To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 

Get queued

  • 1.
  • 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

  1. Mention the sponsor - say something nice.
  2. 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
  3. 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)
  4. 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
  5. Mention telephone call example Mention example about submitting an email form.
  6. 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.
  7. your service worker as a ghost user.
  8. our application code will be responsible for generating the message and adding it to the queue.
  9. There are a number of different vendors on the market for queue systems
  10. 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.
  11. Application code can add jobs to the queue.
  12. Application code can add jobs to the queue.
  13. Instead of a simple message we can actually put a complex JSON object into the message queue.
  14. 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
  15. 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
  16. 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