SlideShare a Scribd company logo
Gearman and asynchronous processing in PHP applications Pham Cong Dinh (a.k.a pcdinh) @pcdinh on Twitter BarCampSaiGon 2010 Skunkworks @teamskunkworks  on Twitter
The aim of my talk Discuss about  a solution that helps  scale   your  high traffic   PHP  web applications
Introduction PHP developer since 2002. 8 years in PHP development and counting Presenter at Hanoi PHP Day in 2008, 2009 Founder and maintainer of PHPVietnam mailing list (Google Group) since 2004 Very interested in Linux, server farm, big data, database, distributed processing, scalability, high performance web systems Involved in clip.vn development at Vega Corporation 1 year ago Software developer at Skunkworks
Agenda Challenges in developing large scale PHP applications for high traffic web sites Resolve the challenge: How to distribute workload Gearman: an open source high performance job server  Develop PHP clients and workers Challenges in managing workers – a case study of Gearman Agent Manager
What is large scale? How high is high traffic? Challenges in developing large scale  PHP applications for high traffic web sites (1)
Large Scale? Challenges in developing large scale  PHP applications for high traffic web sites (2) Traffic Data graph Storage Code base Development team
Typical challenges: limitation of resources CPU Disk speed Memory Bandwidth: router, NIC Architecture: application and system Challenges in developing large scale  PHP applications for high traffic web sites (3)
Major challenges No preparation for growth No idea on how to scale your application at a certain extent No in-depth understanding of your system No proper system capacity monitoring Lack of proper skills Challenges in developing large scale  PHP applications for high traffic web sites (4)
Our challenge today Resolve the challenge: How to distribute workload (1) TOO MUCH  WORKLOAD FOR A SINGLE SERVER
Many solutions Load balancing:  Hardware: F5, Cisco Content Services Switch Software: Bind, LVS, HAProxy, Varnish ... Precalculate data Multi-tier application architecture Resolve the challenge: How to distribute workload (2)
Our solution today Queue up the workload Categorize workload pattern  Optimize processing model, security Job server Resolve the challenge: How to distribute workload (3)
Is queuing the final answer? Keep up with peak workload? Handle backlog gracefully Resolve the challenge: How to distribute workload (4)
Concepts Synchronous and asynchronous Job, job queue and job server Who Used at LiveJournal, Yahoo!, Digg, BackType and many more Used at Vega (clip.vn, vega.com.vn) for sending mails. At Skunkworks? Gearman: an open source high performance job server (1)
Architecture   Client Worker Job server Gearman: an open source high performance job server (2) Fail-over cluster
Features Fast Programming language neutral A bridge between a message queue server and a pub/sub engine Enables applications to outsource tasks to other servers in a synchronous or asynchronous manner Fault-tolerant Poison message and retries Persistent queues for background jobs Timeout Gearman: an open source high performance job server (3)
How it works Worker worker connects to all gearmand servers. worker registers what functions it supports. worker asks for jobs. if no jobs, sends command 'pre_sleep' to all gearmand's and sleeps. Client connect to gearmand. submit a job for a particular job name Gearmand acks the job, finds all sleeping workers related to the job. sends them all a 'noop' command to wake them up. Gearman: an open source high performance job server (4)
Use cases Long running processes: thumbnail generation, image resizing, order processing in e-commerce … High CPU or memory requirements: high volume data processing, MapReduce, log aggregation, video encoding Distributed and parallel processing Timing processing: incremental updates, data replication Limited rate FIFO processing Separation of concerns or security issues. Priority-aware system monitoring tasks: WonderProxy Gearman: an open source high performance job server (5)
PHP interface library to Gearman server PECL gearman:  http://pecl.php.net/package/gearman  or  https://github.com/php/pecl-gearman   Pear's Net_Gearman:  http://pear.php.net/package/Net_Gearman   Develop PHP clients and workers (1)
PHP Client = Job Sender Develop PHP clients and workers (2)
PHP Worker = Job Executor Develop PHP clients and workers (3)
Ease of use How to manage multiple worker processes for a single job: launch, reload, stop, add process ... Monitoring Centralized management over set of servers Web API (Restful) Challenges in managing workers – a case study of Gearman Agent Manager
Questions?  @skunkworksvn, @pcdinh #barcampsaigon #teamskunkworks

More Related Content

What's hot (9)

PPTX
Web Application Development using PHP and MySQL
Ganesh Kamath
 
PPTX
Designing Modern Web Applications
Lucas Carlson
 
PPTX
How to Develop for Data Transformation with FME Server
Safe Software
 
PPTX
The WordPress Way: Accessibility and Backwards Compatibility
Joseph Dolson
 
PPTX
Cakephp vs. laravel
GirnarSoft
 
PDF
Asp.Net 3 5 Part 1
asim78
 
PPTX
Net developer days presentation
Alexandre Malavasi
 
DOCX
Data stage interview questions and answers|DataStage FAQS
BigClasses.com
 
Web Application Development using PHP and MySQL
Ganesh Kamath
 
Designing Modern Web Applications
Lucas Carlson
 
How to Develop for Data Transformation with FME Server
Safe Software
 
The WordPress Way: Accessibility and Backwards Compatibility
Joseph Dolson
 
Cakephp vs. laravel
GirnarSoft
 
Asp.Net 3 5 Part 1
asim78
 
Net developer days presentation
Alexandre Malavasi
 
Data stage interview questions and answers|DataStage FAQS
BigClasses.com
 

Viewers also liked (14)

PDF
Detrás del Backend [phpDay 2015]
Felix Carmona
 
PDF
PHP Barcelona Monthly Talk Feb 2015
Sergi González Pérez
 
PDF
What RabbitMQ can do for you (phpnw14 Uncon)
James Titcumb
 
PPTX
Dealing with fear in legacy projects #PHPDS15
Aitor Suso Gáceta
 
PDF
Joomla!day2013 Albacete Spain, Responsive, Adaptive y la tundra
Jordi Catà
 
PDF
Dependency Inversion and Dependency Injection in PHP
mtoppa
 
PDF
PHPBarcelona Conference - Optimización aplicaciones PHP - Client side
maguilar
 
PDF
Ecosistema de desarrollo en PHP con Docker y Ansible
Vicent Soria Durá
 
PDF
Steganography: Hiding your secrets with PHP
Raul Fraile
 
PDF
From Legacy to DDD in PHP | Tech Talks | Privalia
Jordi Vila Gallardo
 
PDF
RabbitMQ y Symfony
Miquel Company Rodriguez
 
PPTX
Implementing DDD Concepts in PHP
Steve Rhoades
 
PDF
7 Dimensions of Agile Analytics by Ken Collier
Thoughtworks
 
PDF
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Detrás del Backend [phpDay 2015]
Felix Carmona
 
PHP Barcelona Monthly Talk Feb 2015
Sergi González Pérez
 
What RabbitMQ can do for you (phpnw14 Uncon)
James Titcumb
 
Dealing with fear in legacy projects #PHPDS15
Aitor Suso Gáceta
 
Joomla!day2013 Albacete Spain, Responsive, Adaptive y la tundra
Jordi Catà
 
Dependency Inversion and Dependency Injection in PHP
mtoppa
 
PHPBarcelona Conference - Optimización aplicaciones PHP - Client side
maguilar
 
Ecosistema de desarrollo en PHP con Docker y Ansible
Vicent Soria Durá
 
Steganography: Hiding your secrets with PHP
Raul Fraile
 
From Legacy to DDD in PHP | Tech Talks | Privalia
Jordi Vila Gallardo
 
RabbitMQ y Symfony
Miquel Company Rodriguez
 
Implementing DDD Concepts in PHP
Steve Rhoades
 
7 Dimensions of Agile Analytics by Ken Collier
Thoughtworks
 
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Ad

Similar to Gearman and asynchronous processing in PHP applications (20)

ODP
Scaling PHP Applications with Zend Platform
Shahar Evron
 
PDF
2013 - Dustin whittle - Escalando PHP en la vida real
PHP Conference Argentina
 
PPTX
Optimizing performance
Zend by Rogue Wave Software
 
PDF
Documentation of Online jobs for BCA last sem on PHP.
Harsh Tamakuwala
 
DOCX
Ramkumar_python_perl_unix shell script developer
Ramkumar Shankar
 
PPTX
lamp.pptx
SainikRamagiri
 
PPTX
lamp-technology-8860-9KNDvBR.pptx
Manikanta191485
 
PDF
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
vanphp
 
PDF
Near real-time anomaly detection at Lyft
markgrover
 
PPTX
SRMS 5th Sem Minor project.pptx
Chudail1
 
PDF
PHP Basics
Roohul Amin
 
PPT
Top 30 Scalability Mistakes
John Coggeshall
 
DOCX
TheodoreWDennis-Resume
Theodore Dennis
 
PDF
Server Monitoring (Scaling while bootstrapped)
Ajibola Aiyedogbon
 
DOCX
MY NEWEST RESUME
Han Yan
 
PPTX
Northeast PHP - High Performance PHP
Jonathan Klein
 
PDF
"High-load is at the intersection of DevOps and PHP development",
Fwdays
 
PPT
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Bhupesh Bansal
 
PPT
Hadoop and Voldemort @ LinkedIn
Hadoop User Group
 
PPTX
Liferay as solution for legacy applications
Manish Kumar Jaiswal
 
Scaling PHP Applications with Zend Platform
Shahar Evron
 
2013 - Dustin whittle - Escalando PHP en la vida real
PHP Conference Argentina
 
Optimizing performance
Zend by Rogue Wave Software
 
Documentation of Online jobs for BCA last sem on PHP.
Harsh Tamakuwala
 
Ramkumar_python_perl_unix shell script developer
Ramkumar Shankar
 
lamp.pptx
SainikRamagiri
 
lamp-technology-8860-9KNDvBR.pptx
Manikanta191485
 
PHP At 5000 Requests Per Second: Hootsuite’s Scaling Story
vanphp
 
Near real-time anomaly detection at Lyft
markgrover
 
SRMS 5th Sem Minor project.pptx
Chudail1
 
PHP Basics
Roohul Amin
 
Top 30 Scalability Mistakes
John Coggeshall
 
TheodoreWDennis-Resume
Theodore Dennis
 
Server Monitoring (Scaling while bootstrapped)
Ajibola Aiyedogbon
 
MY NEWEST RESUME
Han Yan
 
Northeast PHP - High Performance PHP
Jonathan Klein
 
"High-load is at the intersection of DevOps and PHP development",
Fwdays
 
Voldemort & Hadoop @ Linkedin, Hadoop User Group Jan 2010
Bhupesh Bansal
 
Hadoop and Voldemort @ LinkedIn
Hadoop User Group
 
Liferay as solution for legacy applications
Manish Kumar Jaiswal
 
Ad

Recently uploaded (20)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Digital Circuits, important subject in CS
contactparinay1
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 

Gearman and asynchronous processing in PHP applications

  • 1. Gearman and asynchronous processing in PHP applications Pham Cong Dinh (a.k.a pcdinh) @pcdinh on Twitter BarCampSaiGon 2010 Skunkworks @teamskunkworks on Twitter
  • 2. The aim of my talk Discuss about a solution that helps scale your high traffic PHP web applications
  • 3. Introduction PHP developer since 2002. 8 years in PHP development and counting Presenter at Hanoi PHP Day in 2008, 2009 Founder and maintainer of PHPVietnam mailing list (Google Group) since 2004 Very interested in Linux, server farm, big data, database, distributed processing, scalability, high performance web systems Involved in clip.vn development at Vega Corporation 1 year ago Software developer at Skunkworks
  • 4. Agenda Challenges in developing large scale PHP applications for high traffic web sites Resolve the challenge: How to distribute workload Gearman: an open source high performance job server Develop PHP clients and workers Challenges in managing workers – a case study of Gearman Agent Manager
  • 5. What is large scale? How high is high traffic? Challenges in developing large scale PHP applications for high traffic web sites (1)
  • 6. Large Scale? Challenges in developing large scale PHP applications for high traffic web sites (2) Traffic Data graph Storage Code base Development team
  • 7. Typical challenges: limitation of resources CPU Disk speed Memory Bandwidth: router, NIC Architecture: application and system Challenges in developing large scale PHP applications for high traffic web sites (3)
  • 8. Major challenges No preparation for growth No idea on how to scale your application at a certain extent No in-depth understanding of your system No proper system capacity monitoring Lack of proper skills Challenges in developing large scale PHP applications for high traffic web sites (4)
  • 9. Our challenge today Resolve the challenge: How to distribute workload (1) TOO MUCH WORKLOAD FOR A SINGLE SERVER
  • 10. Many solutions Load balancing: Hardware: F5, Cisco Content Services Switch Software: Bind, LVS, HAProxy, Varnish ... Precalculate data Multi-tier application architecture Resolve the challenge: How to distribute workload (2)
  • 11. Our solution today Queue up the workload Categorize workload pattern Optimize processing model, security Job server Resolve the challenge: How to distribute workload (3)
  • 12. Is queuing the final answer? Keep up with peak workload? Handle backlog gracefully Resolve the challenge: How to distribute workload (4)
  • 13. Concepts Synchronous and asynchronous Job, job queue and job server Who Used at LiveJournal, Yahoo!, Digg, BackType and many more Used at Vega (clip.vn, vega.com.vn) for sending mails. At Skunkworks? Gearman: an open source high performance job server (1)
  • 14. Architecture Client Worker Job server Gearman: an open source high performance job server (2) Fail-over cluster
  • 15. Features Fast Programming language neutral A bridge between a message queue server and a pub/sub engine Enables applications to outsource tasks to other servers in a synchronous or asynchronous manner Fault-tolerant Poison message and retries Persistent queues for background jobs Timeout Gearman: an open source high performance job server (3)
  • 16. How it works Worker worker connects to all gearmand servers. worker registers what functions it supports. worker asks for jobs. if no jobs, sends command 'pre_sleep' to all gearmand's and sleeps. Client connect to gearmand. submit a job for a particular job name Gearmand acks the job, finds all sleeping workers related to the job. sends them all a 'noop' command to wake them up. Gearman: an open source high performance job server (4)
  • 17. Use cases Long running processes: thumbnail generation, image resizing, order processing in e-commerce … High CPU or memory requirements: high volume data processing, MapReduce, log aggregation, video encoding Distributed and parallel processing Timing processing: incremental updates, data replication Limited rate FIFO processing Separation of concerns or security issues. Priority-aware system monitoring tasks: WonderProxy Gearman: an open source high performance job server (5)
  • 18. PHP interface library to Gearman server PECL gearman: http://pecl.php.net/package/gearman or https://github.com/php/pecl-gearman Pear's Net_Gearman: http://pear.php.net/package/Net_Gearman Develop PHP clients and workers (1)
  • 19. PHP Client = Job Sender Develop PHP clients and workers (2)
  • 20. PHP Worker = Job Executor Develop PHP clients and workers (3)
  • 21. Ease of use How to manage multiple worker processes for a single job: launch, reload, stop, add process ... Monitoring Centralized management over set of servers Web API (Restful) Challenges in managing workers – a case study of Gearman Agent Manager
  • 22. Questions? @skunkworksvn, @pcdinh #barcampsaigon #teamskunkworks