Gearman, Supervisor and PHP - Job Management with Sanity!

  • 8,791 views
Uploaded on

my talk in the phpXperts seminar 2011, Dhaka.

my talk in the phpXperts seminar 2011, Dhaka.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • Dear Feroz Khan,

    I am located in Bangladesh. What type of training are you looking for? Online or offline? If you could please drop an email to mailbox [at] masnun.me, we could take the discussion ahead in a private space :)

    Thanks for your comment :)
    Are you sure you want to
    Your message goes here
  • Ashraf, We are looking at Gearman Training for couple of our associates who are situated in North America. When i was searching the web, saw in your web page that you have expertise in offering training for Gearman. If yes, we would like to hear from you on the procedures for scheduling an training session for Gearman and regarding the other details associated with it.



    Thanks
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
8,791
On Slideshare
0
From Embeds
0
Number of Embeds
4

Actions

Shares
Downloads
40
Comments
2
Likes
5

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Supervisor, Gearman and PHP - Jobmanagement 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 deploymenttypes
  • 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 CodeInstall Gearman: sudo apt-get install gearmanInstall Libgearman: sudo apt-get install libgearman-devInstall the PHP Extension: sudo pecl install channel://pecl.php.net/gearman-0.8.0
  • 9. Gearman: Daemonizing! Starting Gearman QR CodeRunning GearmanDaemon: sudo gearman –d –u rootDebugging Gearman (Verbose mode) : sudo gearman –d -vvv –u root
  • 10. QR CodeGearman: Workers PHP Worker
  • 11. QR CodeGearman: Workers Breaking it down!
  • 12. QR CodeGearman: Workers Breaking it down!
  • 13. QR CodeGearman: 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 & ProvenIt monitors your processes and restarts asinstructed!
  • 17. Supervisor: Installation! Let’s go! QR Codesudo apt-get install python-setuptools sudo easy_install supervisor
  • 18. Supervisor: Getting Started! Config, debug and run! QR Codesudo 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 @ Leeviohttp://masnun.commasnun@leevio.com