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
Ad

More Related Content

What's hot (20)

Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniter
Erik Giberti
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
Issac Goldstand
 
Faster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersFaster PHP apps using Queues and Workers
Faster PHP apps using Queues and Workers
Richard Baker
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
Mike Willbanks
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
Daniel Fahlke
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
Andrew Shitov
 
Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)
benbrowning
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
danwrong
 
The Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With RubyThe Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With Ruby
mattmatt
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Perrin Harkins
 
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Codemotion
 
An Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing DatameerAn Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing Datameer
Colin Brown
 
Using the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLIUsing the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLI
Marc Gratch
 
Ruby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby MeRuby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby Me
Panagiotis Papadopoulos
 
JRuby - Everything in a single process
JRuby - Everything in a single processJRuby - Everything in a single process
JRuby - Everything in a single process
ocher
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
oscon2007
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
oscon2007
 
Sprockets
SprocketsSprockets
Sprockets
Tim Novinger
 
Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniter
Erik Giberti
 
Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
Issac Goldstand
 
Faster PHP apps using Queues and Workers
Faster PHP apps using Queues and WorkersFaster PHP apps using Queues and Workers
Faster PHP apps using Queues and Workers
Richard Baker
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
Joe Ferguson
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
Mike Willbanks
 
Improve the deployment process step by step
Improve the deployment process step by stepImprove the deployment process step by step
Improve the deployment process step by step
Daniel Fahlke
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
Joe Ferguson
 
Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)Why I Love TorqueBox (And Why You Will Too)
Why I Love TorqueBox (And Why You Will Too)
benbrowning
 
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)The Mysteries Of JavaScript-Fu (RailsConf Ediition)
The Mysteries Of JavaScript-Fu (RailsConf Ediition)
danwrong
 
The Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With RubyThe Current State of Asynchronous Processing With Ruby
The Current State of Asynchronous Processing With Ruby
mattmatt
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Perrin Harkins
 
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Deploying node.js at scale - Maraschi, Collina - Codemotion Amsterdam 2016
Codemotion
 
An Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing DatameerAn Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing Datameer
Colin Brown
 
Using the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLIUsing the Command Line: Bash and WP-CLI
Using the Command Line: Bash and WP-CLI
Marc Gratch
 
Ruby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby MeRuby On Google App Engine 2nd Athens Ruby Me
Ruby On Google App Engine 2nd Athens Ruby Me
Panagiotis Papadopoulos
 
JRuby - Everything in a single process
JRuby - Everything in a single processJRuby - Everything in a single process
JRuby - Everything in a single process
ocher
 
Os Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman SwpOs Fitzpatrick Sussman Swp
Os Fitzpatrick Sussman Swp
oscon2007
 

Viewers also liked (14)

Multi-tasking in PHP
Multi-tasking in PHPMulti-tasking in PHP
Multi-tasking in PHP
Jonathon Hill
 
Php resque
Php resquePhp resque
Php resque
Chaitanya Kuber
 
Tối ưu hóa việc ghi dữ liệu với Gearman
Tối ưu hóa việc ghi dữ liệu với GearmanTối ưu hóa việc ghi dữ liệu với Gearman
Tối ưu hóa việc ghi dữ liệu với Gearman
Minh Nguyen Vo Cao
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
James Titcumb
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 
Enchanted Objects: The next wave of the web
Enchanted Objects: The next wave of the webEnchanted Objects: The next wave of the web
Enchanted Objects: The next wave of the web
David Rose
 
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
ScaleBase
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
Jeremy Kendall
 
Gearman & PHP
Gearman & PHPGearman & PHP
Gearman & PHP
Nemanja Krivokapic
 
Distributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offsDistributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offs
Ahmed Magdy Ezzeldin, MSc.
 
Gearman for MySQL
Gearman for MySQLGearman for MySQL
Gearman for MySQL
Giuseppe Maxia
 
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Minh Nguyen Vo Cao
 
Conflicto y Negociación
Conflicto y NegociaciónConflicto y Negociación
Conflicto y Negociación
José Ruiz-Montes, MBA
 
Multi-tasking in PHP
Multi-tasking in PHPMulti-tasking in PHP
Multi-tasking in PHP
Jonathon Hill
 
Tối ưu hóa việc ghi dữ liệu với Gearman
Tối ưu hóa việc ghi dữ liệu với GearmanTối ưu hóa việc ghi dữ liệu với Gearman
Tối ưu hóa việc ghi dữ liệu với Gearman
Minh Nguyen Vo Cao
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
James Titcumb
 
PHP Performance with APC + Memcached
PHP Performance with APC + MemcachedPHP Performance with APC + Memcached
PHP Performance with APC + Memcached
Ford AntiTrust
 
Enchanted Objects: The next wave of the web
Enchanted Objects: The next wave of the webEnchanted Objects: The next wave of the web
Enchanted Objects: The next wave of the web
David Rose
 
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
Distributed RDBMS: Data Distribution Policy: Part 1 - What is a Data Distribu...
ScaleBase
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
Jeremy Kendall
 
Distributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offsDistributed RDBMS: Challenges, Solutions & Trade-offs
Distributed RDBMS: Challenges, Solutions & Trade-offs
Ahmed Magdy Ezzeldin, MSc.
 
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Creating a WebSocket-Chat-Application with Jetty Embedded - Techcamp 2014
Minh Nguyen Vo Cao
 
Ad

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

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

Recently uploaded (20)

TrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI PaymentsTrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI Payments
Trs Labs
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
The Microsoft Excel Parts Presentation.pdf
The Microsoft Excel Parts Presentation.pdfThe Microsoft Excel Parts Presentation.pdf
The Microsoft Excel Parts Presentation.pdf
YvonneRoseEranista
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Vibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdfVibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Financial Services Technology Summit 2025
Financial Services Technology Summit 2025Financial Services Technology Summit 2025
Financial Services Technology Summit 2025
Ray Bugg
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 
TrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI PaymentsTrsLabs - Leverage the Power of UPI Payments
TrsLabs - Leverage the Power of UPI Payments
Trs Labs
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptxWebinar - Top 5 Backup Mistakes MSPs and Businesses Make   .pptx
Webinar - Top 5 Backup Mistakes MSPs and Businesses Make .pptx
MSP360
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
The Microsoft Excel Parts Presentation.pdf
The Microsoft Excel Parts Presentation.pdfThe Microsoft Excel Parts Presentation.pdf
The Microsoft Excel Parts Presentation.pdf
YvonneRoseEranista
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Connect and Protect: Networks and Network Security
Connect and Protect: Networks and Network SecurityConnect and Protect: Networks and Network Security
Connect and Protect: Networks and Network Security
VICTOR MAESTRE RAMIREZ
 
How analogue intelligence complements AI
How analogue intelligence complements AIHow analogue intelligence complements AI
How analogue intelligence complements AI
Paul Rowe
 
AI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of DocumentsAI Agents at Work: UiPath, Maestro & the Future of Documents
AI Agents at Work: UiPath, Maestro & the Future of Documents
UiPathCommunity
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Vibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdfVibe Coding_ Develop a web application using AI (1).pdf
Vibe Coding_ Develop a web application using AI (1).pdf
Baiju Muthukadan
 
Financial Services Technology Summit 2025
Financial Services Technology Summit 2025Financial Services Technology Summit 2025
Financial Services Technology Summit 2025
Ray Bugg
 
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and MLGyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
GyrusAI - Broadcasting & Streaming Applications Driven by AI and ML
Gyrus AI
 
Unlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web AppsUnlocking Generative AI in your Web Apps
Unlocking Generative AI in your Web Apps
Maximiliano Firtman
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptxReimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
Reimagine How You and Your Team Work with Microsoft 365 Copilot.pptx
John Moore
 

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