SlideShare a Scribd company logo
1 of 35
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.1seungdon 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 queueMike 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 MurthyEvention
 
Tungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten ClustersTungsten University: Configure & Provision Tungsten Clusters
Tungsten University: Configure & Provision Tungsten ClustersContinuent
 
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: ScaleNeo4j
 
Splunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into SplunkSplunk conf2014 - Onboarding Data Into Splunk
Splunk conf2014 - Onboarding Data Into SplunkSplunk
 
Designing High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDesigning High Performance RTC Signaling Servers
Designing High Performance RTC Signaling ServersDaniel-Constantin Mierla
 
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 IntroductionZhaoyang 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 SparkChristopher 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: NetworkYonatan Levin
 
DOWNSAMPLING DATA
DOWNSAMPLING DATADOWNSAMPLING DATA
DOWNSAMPLING DATAInfluxData
 
Being HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeBeing HAPI! Reverse Proxying on Purpose
Being HAPI! Reverse Proxying on PurposeAman 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 DruidDataWorks 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

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 2014Chad Windnagle
 
Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12Google Summer of Code Presentation - JWC12
Google Summer of Code Presentation - JWC12Chad Windnagle
 
Template overrides austin
Template overrides   austinTemplate overrides   austin
Template overrides austinChad Windnagle
 
Joomla Essential Extensions
Joomla Essential ExtensionsJoomla Essential Extensions
Joomla Essential ExtensionsChad Windnagle
 
Getting Involved in the Joomla Community
Getting Involved in the Joomla CommunityGetting Involved in the Joomla Community
Getting Involved in the Joomla CommunityChad 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 2010Chad Windnagle
 
Developing joomla 1.6 templates
Developing joomla 1.6 templatesDeveloping joomla 1.6 templates
Developing joomla 1.6 templatesChad 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

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

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