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

KEY
Scale like a pro with Gearman
PPT
Gearman and asynchronous processing in PHP applications
PDF
Gearman: A Job Server made for Scale
PDF
Khanh-Nguyen - Gearman - distributed process solution
PDF
Distributed Queue System using Gearman
KEY
Gearman
PDF
Queue your work
PPT
Gearman - Job Queue
Scale like a pro with Gearman
Gearman and asynchronous processing in PHP applications
Gearman: A Job Server made for Scale
Khanh-Nguyen - Gearman - distributed process solution
Distributed Queue System using Gearman
Gearman
Queue your work
Gearman - Job Queue

What's hot (20)

KEY
Gearman and CodeIgniter
PPTX
Distributed Applications with Perl & Gearman
PDF
Faster PHP apps using Queues and Workers
PDF
Improve the deployment process step by step
KEY
Why I Love TorqueBox (And Why You Will Too)
PDF
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
PDF
The Power Of Refactoring (PHPNW)
PDF
The Power of Refactoring
PDF
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
PDF
Magnolia Conference Basel 2016 SysEleven
PDF
Rubyhosting
PDF
Background processes and tasks in an async world
ODP
JRuby - Everything in a single process
PPTX
Using the Command Line: Bash and WP-CLI
ODP
Grape golilath
PPT
Ruby vs Node ShiningRay Shanghai
PDF
Ruby meetup 7_years_in_testing
ODP
20110701 zsc2011-advanced proxying-formatted
ODP
Choosing a Web Architecture for Perl
PDF
Essential debugging php debugging techniques, tips & tricks
Gearman and CodeIgniter
Distributed Applications with Perl & Gearman
Faster PHP apps using Queues and Workers
Improve the deployment process step by step
Why I Love TorqueBox (And Why You Will Too)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Power Of Refactoring (PHPNW)
The Power of Refactoring
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Magnolia Conference Basel 2016 SysEleven
Rubyhosting
Background processes and tasks in an async world
JRuby - Everything in a single process
Using the Command Line: Bash and WP-CLI
Grape golilath
Ruby vs Node ShiningRay Shanghai
Ruby meetup 7_years_in_testing
20110701 zsc2011-advanced proxying-formatted
Choosing a Web Architecture for Perl
Essential debugging php debugging techniques, tips & tricks
Ad

Viewers also liked (19)

KEY
In the Back of Your Mind
KEY
Asynchronous Awesome
PDF
Open Source 2.0
PPT
Tối ưu hóa việc ghi dữ liệu với Gearman
PPT
Job_Queues
PDF
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
PPTX
PHP Performance with APC + Memcached
PDF
1秒間に250通のメールをさばくAWSの使い方
PDF
AWSが誕生するまでの秘話
PPT
Gearman and asynchronous processing in PHP applications
PDF
Supervisord, The Process Manager
PPTX
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
PDF
Distributed RDBMS: Challenges, Solutions & Trade-offs
PDF
Gearman for MySQL
PPTX
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
PPTX
Scaling php
PDF
Brugnoli System Ux
PDF
2015 ZendCon - Do you queue
ODP
MNPHP Scalable Architecture 101 - Feb 3 2011
In the Back of Your Mind
Asynchronous Awesome
Open Source 2.0
Tối ưu hóa việc ghi dữ liệu với Gearman
Job_Queues
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
PHP Performance with APC + Memcached
1秒間に250通のメールをさばくAWSの使い方
AWSが誕生するまでの秘話
Gearman and asynchronous processing in PHP applications
Supervisord, The Process Manager
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Challenges, Solutions & Trade-offs
Gearman for MySQL
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Scaling php
Brugnoli System Ux
2015 ZendCon - Do you queue
MNPHP Scalable Architecture 101 - Feb 3 2011
Ad

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

PDF
DevOps For Small Teams
PDF
Madison PHP 2015 - DevOps For Small Teams
PDF
Midwest PHP 2017 DevOps For Small team
PDF
ZendCon 2015 - DevOps for Small Teams
PPTX
Deployment with capistrano
PDF
Why we choose Symfony2
PDF
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
PDF
Laravel Forge: Hello World to Hello Production
PDF
Laravel Forge: Hello World to Hello Production
PPTX
轉轉轉好運旺來一起來之雲端轉檔大作戰!
PPTX
DevOps, A brief introduction to Vagrant & Ansible
PDF
Forensic Tools for In-Depth Performance Investigations
PDF
Forensic tools for in-depth performance investigations
ODP
Deployment talk dpc 13
KEY
DevOps for Developers
PDF
Running operations in 2 hours at DevTernity 2015
PPTX
WordPress automation and CI
PDF
Debugging and Profiling PHP Applications
PDF
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
PDF
ZendCon 2015 - Laravel Forge: Hello World to Hello Production
DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
Midwest PHP 2017 DevOps For Small team
ZendCon 2015 - DevOps for Small Teams
Deployment with capistrano
Why we choose Symfony2
php[world] 2015 Laravel 5.1: From Homestead to the Cloud
Laravel Forge: Hello World to Hello Production
Laravel Forge: Hello World to Hello Production
轉轉轉好運旺來一起來之雲端轉檔大作戰!
DevOps, A brief introduction to Vagrant & Ansible
Forensic Tools for In-Depth Performance Investigations
Forensic tools for in-depth performance investigations
Deployment talk dpc 13
DevOps for Developers
Running operations in 2 hours at DevTernity 2015
WordPress automation and CI
Debugging and Profiling PHP Applications
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
ZendCon 2015 - Laravel Forge: Hello World to Hello Production

Recently uploaded (20)

PPTX
Microsoft Excel 365/2024 Beginner's training
PPT
What is a Computer? Input Devices /output devices
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
UiPath Agentic Automation session 1: RPA to Agents
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Five Habits of High-Impact Board Members
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PPTX
2018-HIPAA-Renewal-Training for executives
PPTX
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PPTX
Modernising the Digital Integration Hub
PDF
Flame analysis and combustion estimation using large language and vision assi...
Microsoft Excel 365/2024 Beginner's training
What is a Computer? Input Devices /output devices
Benefits of Physical activity for teenagers.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
UiPath Agentic Automation session 1: RPA to Agents
Enhancing emotion recognition model for a student engagement use case through...
Five Habits of High-Impact Board Members
Taming the Chaos: How to Turn Unstructured Data into Decisions
sbt 2.0: go big (Scala Days 2025 edition)
2018-HIPAA-Renewal-Training for executives
AI IN MARKETING- PRESENTED BY ANWAR KABIR 1st June 2025.pptx
A comparative study of natural language inference in Swahili using monolingua...
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Produktkatalog für HOBO Datenlogger, Wetterstationen, Sensoren, Software und ...
A review of recent deep learning applications in wood surface defect identifi...
Hindi spoken digit analysis for native and non-native speakers
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
A proposed approach for plagiarism detection in Myanmar Unicode text
Modernising the Digital Integration Hub
Flame analysis and combustion estimation using large language and vision assi...

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 masnun@leevio.com