SlideShare a Scribd company logo
Supervisor, Gearman and PHP - Job
management with sanity!

    ABU ASHRAF MASNUN
What is it all about?

 PHP
 Gearman
Supervisor
 Job Management
Let’s get REAL!
             Deploy Ninja – A case study

              PROPOSED FEATURES
   Deployment Solution (SVN to s/FTP)
   Trigger URL – Web Hooks
   Deploy Now – Deploy the latest right now
   Full Deploy – Upload the entire repo again
How to train our Ninja?
                What did we have to do?

                REQUIREMENTS
 Tasks Involved:
     Fetch the repo
      Upload to the server
 Instant processing
 Process separation for the three deployment
types
And cometh the tragedy!
              The day my life sucked !^@# 

          ARCHITECTURAL CHALLENGES
   Instant processing requires “Daemons”
   PHP was not built for long running processes!
   Premature termination & Zombie processes.
   Monitoring the processes.
   Restarting the processes when terminated.
Gearman, the super hero!
            He came and saved my a$$ 

            GEARMAN FEATURES
 Distributed workload management
 Client – Worker Architecture
 Multiple workers
 Multi-lingual workers
Gearman: How it works?
   Understanding Gearman
Gearman: Installation
                             Are you ready?   QR Code



Install Gearman:
          sudo apt-get install gearman
Install Libgearman:
    sudo apt-get install libgearman-dev
Install the PHP Extension:
                sudo pecl install
       channel://pecl.php.net/gearman-0.8.0
Gearman: Daemonizing!
                      Starting Gearman     QR Code




Running Gearman
Daemon:      sudo gearman –d –u root


Debugging Gearman (Verbose mode) :
            sudo gearman –d -vvv –u root
QR Code
Gearman: Workers
     PHP Worker
QR Code
Gearman: Workers
   Breaking it down!
QR Code
Gearman: Workers
   Breaking it down!
QR Code
Gearman: Clients
   Requesting a job!
Gearman: Alternatives!
       Who else is there?


 RabbitMQ
 ZeroMQ
 Apache MQ
 Dropr
 Microsoft MQ
Whew! Almost done!
                   Life is getting better

               CHALLENGES STATUS
   Instant processing requires “Daemons”
   PHP was not built for long running processes!
   Premature termination & Zombie processes.
   Monitoring the processes.
   Restarting the processes when terminated.
Meet Supervisor!
               Here comes the tough guy!

             SUPERVISOR FEATURES
 Simple & Centralized
 Efficient & Extensible
 Compatible & Proven

It monitors your processes and restarts as
instructed!
Supervisor: Installation!
                  Let’s go!         QR Code




sudo apt-get install python-setuptools

     sudo easy_install supervisor
Supervisor: Getting Started!
     Config, debug and run!    QR Code




sudo echo_supervisord_conf >
    /etc/supervisord.conf

    sudo supervisord -n

      sudo supervisord
Hurray! We’re done!
                     Life is so good :D

               CHALLENGES STATUS
   Instant processing requires “Daemons”
   PHP was not built for long running processes!
   Premature termination & Zombie processes.
   Monitoring the processes.
   Restarting the processes when terminated.
What’s your Story?
                 You can do it too!

                USE CASES
 Image Processing?
 Cache Regeneration?
 Mass emails?
That was Simple! Eh?
    Got anything to ask?
The Leevian!
           Who am I?



     ABU ASHRAF MASNUN

  Software Engineer @ Leevio
http://masnun.com
masnun@leevio.com

More Related Content

What's hot (20)

KEY
Gearman and CodeIgniter
Erik Giberti
 
PPTX
Distributed Applications with Perl & Gearman
Issac Goldstand
 
PDF
Faster PHP apps using Queues and Workers
Richard Baker
 
PDF
Improve the deployment process step by step
Daniel Fahlke
 
KEY
Why I Love TorqueBox (And Why You Will Too)
benbrowning
 
PDF
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
danwrong
 
PDF
The Power Of Refactoring (PHPNW)
Stefan Koopmanschap
 
PDF
The Power of Refactoring
Stefan Koopmanschap
 
PDF
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Codemotion
 
PDF
Magnolia Conference Basel 2016 SysEleven
Simon Pearce
 
PDF
Rubyhosting
Artit Rubybox
 
PDF
Background processes and tasks in an async world
particlebanana
 
ODP
JRuby - Everything in a single process
ocher
 
PPTX
Using the Command Line: Bash and WP-CLI
Marc Gratch
 
ODP
Grape golilath
Kannan Reghu
 
PPT
Ruby vs Node ShiningRay Shanghai
Jackson Tian
 
PDF
Ruby meetup 7_years_in_testing
Digital Natives
 
ODP
20110701 zsc2011-advanced proxying-formatted
Zarafa
 
ODP
Choosing a Web Architecture for Perl
Perrin Harkins
 
PDF
Essential debugging php debugging techniques, tips & tricks
Kaloyan Raev
 
Gearman and CodeIgniter
Erik Giberti
 
Distributed Applications with Perl & Gearman
Issac Goldstand
 
Faster PHP apps using Queues and Workers
Richard Baker
 
Improve the deployment process step by step
Daniel Fahlke
 
Why I Love TorqueBox (And Why You Will Too)
benbrowning
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
danwrong
 
The Power Of Refactoring (PHPNW)
Stefan Koopmanschap
 
The Power of Refactoring
Stefan Koopmanschap
 
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Codemotion
 
Magnolia Conference Basel 2016 SysEleven
Simon Pearce
 
Rubyhosting
Artit Rubybox
 
Background processes and tasks in an async world
particlebanana
 
JRuby - Everything in a single process
ocher
 
Using the Command Line: Bash and WP-CLI
Marc Gratch
 
Grape golilath
Kannan Reghu
 
Ruby vs Node ShiningRay Shanghai
Jackson Tian
 
Ruby meetup 7_years_in_testing
Digital Natives
 
20110701 zsc2011-advanced proxying-formatted
Zarafa
 
Choosing a Web Architecture for Perl
Perrin Harkins
 
Essential debugging php debugging techniques, tips & tricks
Kaloyan Raev
 

Viewers also liked (19)

KEY
In the Back of Your Mind
James Gray
 
KEY
Asynchronous Awesome
Flip Sasser
 
PDF
Open Source 2.0
samof76
 
PPT
Tối ưu hóa việc ghi dữ liệu với Gearman
Minh Nguyen Vo Cao
 
PPT
Job_Queues
Abhinav Lal
 
PDF
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
James Titcumb
 
PPTX
PHP Performance with APC + Memcached
Ford AntiTrust
 
PDF
1秒間に250通のメールをさばくAWSの使い方
Tokyo Otaku Mode Inc.
 
PDF
AWSが誕生するまでの秘話
Yasuhiro Horiuchi
 
PPT
Gearman and asynchronous processing in PHP applications
Teamskunkworks
 
PDF
Supervisord, The Process Manager
samof76
 
PPTX
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
ScaleBase
 
PDF
Distributed RDBMS: Challenges, Solutions & Trade-offs
Ahmed Magdy Ezzeldin, MSc.
 
PDF
Gearman for MySQL
Giuseppe Maxia
 
PPTX
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Minh Nguyen Vo Cao
 
PPTX
Scaling php
David Trần
 
PDF
Brugnoli System Ux
frog
 
PDF
2015 ZendCon - Do you queue
Mike Willbanks
 
ODP
MNPHP Scalable Architecture 101 - Feb 3 2011
Mike Willbanks
 
In the Back of Your Mind
James Gray
 
Asynchronous Awesome
Flip Sasser
 
Open Source 2.0
samof76
 
Tối ưu hóa việc ghi dữ liệu với Gearman
Minh Nguyen Vo Cao
 
Job_Queues
Abhinav Lal
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
James Titcumb
 
PHP Performance with APC + Memcached
Ford AntiTrust
 
1秒間に250通のメールをさばくAWSの使い方
Tokyo Otaku Mode Inc.
 
AWSが誕生するまでの秘話
Yasuhiro Horiuchi
 
Gearman and asynchronous processing in PHP applications
Teamskunkworks
 
Supervisord, The Process Manager
samof76
 
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
ScaleBase
 
Distributed RDBMS: Challenges, Solutions & Trade-offs
Ahmed Magdy Ezzeldin, MSc.
 
Gearman for MySQL
Giuseppe Maxia
 
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Minh Nguyen Vo Cao
 
Scaling php
David Trần
 
Brugnoli System Ux
frog
 
2015 ZendCon - Do you queue
Mike Willbanks
 
MNPHP Scalable Architecture 101 - Feb 3 2011
Mike Willbanks
 
Ad

Similar to Gearman, Supervisor and PHP - Job Management with Sanity! (20)

PDF
DevOps For Small Teams
Joe Ferguson
 
PDF
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
PDF
Midwest PHP 2017 DevOps For Small team
Joe Ferguson
 
PDF
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
PPTX
Deployment with capistrano
sagar junnarkar
 
PDF
Why we choose Symfony2
Merixstudio
 
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
Joe Ferguson
 
PDF
Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
PDF
Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
PPTX
轉轉轉好運旺來一起來之雲端轉檔大作戰!
進錕 林進錕
 
PPTX
DevOps, A brief introduction to Vagrant & Ansible
Arnaud LEMAIRE
 
PDF
Forensic Tools for In-Depth Performance Investigations
Nicholas Jansma
 
PDF
Forensic tools for in-depth performance investigations
SOASTA
 
ODP
Deployment talk dpc 13
Robbert van den Bogerd
 
KEY
DevOps for Developers
Mayflower GmbH
 
PDF
Running operations in 2 hours at DevTernity 2015
Erno Aapa
 
PPTX
WordPress automation and CI
Ran Bar-Zik
 
PDF
Debugging and Profiling PHP Applications
Logan Lindquist
 
PDF
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
Zoltan Balazs
 
PDF
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
DevOps For Small Teams
Joe Ferguson
 
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
Midwest PHP 2017 DevOps For Small team
Joe Ferguson
 
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
Deployment with capistrano
sagar junnarkar
 
Why we choose Symfony2
Merixstudio
 
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
Joe Ferguson
 
Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
轉轉轉好運旺來一起來之雲端轉檔大作戰!
進錕 林進錕
 
DevOps, A brief introduction to Vagrant & Ansible
Arnaud LEMAIRE
 
Forensic Tools for In-Depth Performance Investigations
Nicholas Jansma
 
Forensic tools for in-depth performance investigations
SOASTA
 
Deployment talk dpc 13
Robbert van den Bogerd
 
DevOps for Developers
Mayflower GmbH
 
Running operations in 2 hours at DevTernity 2015
Erno Aapa
 
WordPress automation and CI
Ran Bar-Zik
 
Debugging and Profiling PHP Applications
Logan Lindquist
 
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
Zoltan Balazs
 
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
Joe Ferguson
 
Ad

Recently uploaded (20)

PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
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
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
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
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
RAT Builders - How to Catch Them All [DeepSec 2024]
malmoeb
 
The Future of Artificial Intelligence (AI)
Mukul
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 

Gearman, Supervisor and PHP - Job Management with Sanity!

  • 1. Supervisor, Gearman and PHP - Job management with sanity! ABU ASHRAF MASNUN
  • 2. What is it all about?  PHP  Gearman Supervisor  Job Management
  • 3. Let’s get REAL! Deploy Ninja – A case study PROPOSED FEATURES  Deployment Solution (SVN to s/FTP)  Trigger URL – Web Hooks  Deploy Now – Deploy the latest right now  Full Deploy – Upload the entire repo again
  • 4. How to train our Ninja? What did we have to do? REQUIREMENTS  Tasks Involved:  Fetch the repo  Upload to the server  Instant processing  Process separation for the three deployment types
  • 5. And cometh the tragedy! The day my life sucked !^@#  ARCHITECTURAL CHALLENGES  Instant processing requires “Daemons”  PHP was not built for long running processes!  Premature termination & Zombie processes.  Monitoring the processes.  Restarting the processes when terminated.
  • 6. Gearman, the super hero! He came and saved my a$$  GEARMAN FEATURES  Distributed workload management  Client – Worker Architecture  Multiple workers  Multi-lingual workers
  • 7. Gearman: How it works? Understanding Gearman
  • 8. Gearman: Installation Are you ready? QR Code Install Gearman: sudo apt-get install gearman Install Libgearman: sudo apt-get install libgearman-dev Install the PHP Extension: sudo pecl install channel://pecl.php.net/gearman-0.8.0
  • 9. Gearman: Daemonizing! Starting Gearman QR Code Running Gearman Daemon: sudo gearman –d –u root Debugging Gearman (Verbose mode) : sudo gearman –d -vvv –u root
  • 11. QR Code Gearman: Workers Breaking it down!
  • 12. QR Code Gearman: Workers Breaking it down!
  • 13. QR Code Gearman: Clients Requesting a job!
  • 14. Gearman: Alternatives! Who else is there?  RabbitMQ  ZeroMQ  Apache MQ  Dropr  Microsoft MQ
  • 15. Whew! Almost done! Life is getting better CHALLENGES STATUS  Instant processing requires “Daemons”  PHP was not built for long running processes!  Premature termination & Zombie processes.  Monitoring the processes.  Restarting the processes when terminated.
  • 16. Meet Supervisor! Here comes the tough guy! SUPERVISOR FEATURES  Simple & Centralized  Efficient & Extensible  Compatible & Proven It monitors your processes and restarts as instructed!
  • 17. Supervisor: Installation! Let’s go! QR Code sudo apt-get install python-setuptools sudo easy_install supervisor
  • 18. Supervisor: Getting Started! Config, debug and run! QR Code sudo echo_supervisord_conf > /etc/supervisord.conf sudo supervisord -n sudo supervisord
  • 19. Hurray! We’re done! Life is so good :D CHALLENGES STATUS  Instant processing requires “Daemons”  PHP was not built for long running processes!  Premature termination & Zombie processes.  Monitoring the processes.  Restarting the processes when terminated.
  • 20. What’s your Story? You can do it too! USE CASES  Image Processing?  Cache Regeneration?  Mass emails?
  • 21. That was Simple! Eh? Got anything to ask?
  • 22. The Leevian! Who am I? ABU ASHRAF MASNUN Software Engineer @ Leevio http://masnun.com [email protected]