SlideShare a Scribd company logo
The Magical
World of Gearman
           Brian Moon
          dealnews.com
   http://brian.moonspot.net/
          @brianlmoon
Basic Features




Use Cases




            How It Works
“The way I like to think of Gearman is as a massively
distributed, massively fault tolerant fork mechanism.”
                     - Joe Stump
The Basics

• Clients need jobs done
• Workers can do jobs
• Gearmand coordinates the work
Gearmand




           http://www.flickr.com/photos/andrefromont/4896802557
Gearmand
Daemon that manages the work.

Does not do any work.

Accepts a job id and a binary payload from
clients.

Workers keep connections open at all
times.

                           http://www.flickr.com/photos/andrefromont/4896802557
Client




         http://www.flickr.com/photos/pitadel/4951801589
Client
Clients connect to Gearmand and ask for
work to be done.

The client can fire and forget or wait on a
response.

Multiple jobs can be done asynchronously
by workers for one client.


                              http://www.flickr.com/photos/pitadel/4951801589
Workers




          http://www.flickr.com/photos/nathaninsandiego/5972599772
Workers


Daemonized code

A single worker can do just one job or can
do many jobs.

Does not have to be written using the
same language as the worker.



                          http://www.flickr.com/photos/nathaninsandiego/5972599772
Key Features

• Background jobs
• De-duplication of jobs
• Multiple jobs per client
• High, normal and low priority
• Work will be resubmitted if not completed
Background Jobs

• Clients can fire and forget work to be done
• Well suited for data marshalling
• Minimal ability to track the status
De-duplication

• Clients provide a unique job id
• If more than one client provides the same
  job id, work is done once
• Not a cache, once the job is done, the id is
  gone. The work will be done again.
Priority

• High, Normal and Low priority options.
• New items are inserted at the end of the
  queue based on priority
• Priority is per job type, not global
Worker Selection

• Uses the “game show method”
• Workers that do multiple jobs will more
  likely get jobs “higher” in their list
• Can appear to be clearing out one queue
  over another, but not really a design choice
Operational Visibility

• Gearmand can report status about jobs and
  workers
• It is only a view of current status, not
  historical
• Use outside tools to graph what work was
  done when
Marshalling Data
Memcached
                              Main
                               Main
                                Main
                             Database
                             Database
                              Database
 Web
  Web
   Web
    Web
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers
Memcached
                                     Main
                                      Main
                                       Main
                                    Database
                                    Database
                                     Database
 Web
  Web
   Web
    Web
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers




                 This is so 2005!
Main
                   Main
                  Optimized
                 Database
                 Database         CRO
                  Database    or In N          Main
                                                Main
                                   Proc
                                        ess      Main
                                              Database
                                              Database
                                               Database
 Web
  Web
   Web
    Web
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers
Main
                       Main
                      Optimized
                     Database
                     Database         CRO
                      Database    or In N          Main
                                                    Main
                                       Proc
                                            ess      Main
                                                  Database
                                                  Database
                                                   Database
 Web
  Web
   Web
    Web
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers




                 This is so 2009!
Main
                     Main
                    Optimized
                   Database
                   Database
                    Database
                                              Main
                                               Main
                                                Main
 Web
  Web                                        Database
                                             Database
   Web
    Web                                       Database
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers
                            Gearman
                            Gearman
                             Gearman
                              Gearman
                            Workers
                              Gearman
                             Workers
                               Gearman
                             Workers
                                Gearman
                              Workers
                                Gearman
                               Workers
                               Workers
                                Workers
                                 Workers
                 Gearmand




                                           Backend
                                            Events
Why Gearman

• Rid us of database spikes
• Changes “feel” realtime
• In the case of an issue, changes can queue
  up and happen when things are stable
• Changes can happen asynchronously
SMTP Replacement
• Large daily newsletter at 3PM
• Email alerts go out on demand to
  thousands of readers as deals are published
• Bottleneck was from double queuing in the
  mail queue
• SMTP Server was a single point of failure
Web
  Web                                   Cron
   Web
    Web                                 Cron
                                         Cron
Servers
     Web
 Servers                                   Cron
                                        Jobs
      Web
  Servers
       Web                                Backend
                                         Jobs
   Servers
        Web
    Servers                               Jobs
                                           Jobs
     Servers
      Servers                              Events
       Servers



                      Gearmand




   Gearman
   Gearman                       Gearman
                                 Gearman
    Gearman
     Gearman                      Gearman
                                   Gearman
   Workers
     Gearman
    Workers                      Workers
                                   Gearman
                                  Workers
      Gearman
    Workers
       Gearman                      Gearman
                                  Workers
                                     Gearman
     Workers
       Gearman
      Workers     SMTP             Workers
                                     Gearman
                                    Workers         SMTP
      Workers
       Workers                      Workers
                                     Workers
        Workers   Server              Workers       Server
Logging
Logging Options

• Disk - reliable unless load is high. Can’t be
  queried easily in real time.
• MySQL - Can make complex queries
  against it. Under high load, data can be lost
• Other - (Spread, Scribe, etc.) New daemons
  to manage, learn, scale, etc.
Logging via Gearman
• Frontend can fire and forget log data,
  returning immediately to the application
• Log data is queued
• Workers can process the logs in any
  number of ways
• Log data can be stored any number of ways
Web
  Web
   Web
    Web
Servers
     Web
                                 Writing Log Data
 Servers
      Web
  Servers
       Web
   Servers
        Web
    Servers
     Servers
      Servers
       Servers



                      Gearmand




   Gearman
   Gearman                       Gearman
                                 Gearman
    Gearman
     Gearman                      Gearman
                                   Gearman
   Workers
     Gearman
    Workers                      Workers
                                   Gearman
                                  Workers
      Gearman
    Workers
       Gearman                      Gearman
                                  Workers
                                     Gearman
     Workers
       Gearman
      Workers     MySQL            Workers
                                     Gearman
                                    Workers     MySQL
      Workers
       Workers                      Workers
                                     Workers
        Workers   Server              Workers   Server
Web
  Web                        Querying Log Data
   Web
    Web
Servers
     Web
 Servers
      Web
  Servers
       Web
   Servers
                             (Map Reduce “ish”)
      Backend
    Servers
     Servers
      Servers
        App



                      Gearmand




   Gearman
   Gearman                       Gearman
                                 Gearman
    Gearman
     Gearman                      Gearman
                                   Gearman
   Workers
     Gearman
    Workers                      Workers
                                   Gearman
                                  Workers
      Gearman
    Workers
       Gearman                      Gearman
                                  Workers
                                     Gearman
     Workers
       Gearman
      Workers     MySQL            Workers
                                     Gearman
                                    Workers     MySQL
      Workers
       Workers                      Workers
                                     Workers
        Workers   Server              Workers   Server
Request Funneling
Normalizing URIs
http://dealnews.com/?ref=google_10-
corporate&s_kwcid=%7Bifcontent%3AContentNetwork
%7D%7Bifsearch%3A%7Bkeyword%7D%7D%7C
%7Bcreative
%7D&WT.term=newdeals&WT.campaign=1799&WT.sour
ce=google&WT.medium=cpc&WT.content=606053200&c
shift_ck=1880996632cs606053200&WT.srch=1

http://dealnews.com/?sort=category

http://dealnews.com/?view=large
Normalizing URIs



  http://dealnews.com/
Normalizing URIs
• Define what parameters a request needs
  • sort
  • view
  • region
  • date
  • start
• Throw out the rest
• Sort what you need
• Build the real URL
Normalizing URIs
    •   http://dealnews.com/
    •   http://dealnews.com/?sort=category
    •   http://dealnews.com/?ref=foobar
    •   http://dealnews.com/?region=nyc

                          All become:

http://dealnews.com/?sort=category&view=large&region=nyc
                   (assuming the user is in New York)
Why normalize/funnel?

• We can now cache the data for this request and
  know it is the same data even if the original URI is
  different. (cache reuse)


• We can fetch the content only once for all
  requests coming in for the content via request
  funneling.
Why normalize/funnel?




• 72 Unique URIs for the front page in 3 minute spike.
  There were only 6 possible real versions. (normalizing)
• Thousands of syndication requests hit the app servers
  between 10:43 and 10:45. There were only 86 unique
  URIs. (funneling)
Request Funneling
                        Proxy Server
Apache   Apache                Apache                  Apache            Apache
 Child    Child                 Child                   Child             Child



          http://dealnews.com/?sort=category&view=large&region=nyc


                            Gearmand




                             Gearman                                  Web
                             Worker                                  Server
What does a worker do?

• Builds a new URI from the input data
• Makes an HTTP request to an app server
• If cacheable, stores the data in the cache
  (important!)

• Returns the data (page) to the proxy (via
  Gearmand)
The Magical
 World of Gearman
                  Brian Moon
                 dealnews.com
          http://brian.moonspot.net/
                 @brianlmoon


             More Information:
             http://gearman.org/

            Need to run PHP workers?
https://github.com/brianlmoon/GearmanManager

More Related Content

What's hot

Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
Issac Goldstand
 
Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniter
Erik Giberti
 
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
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
Andrew Shitov
 
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Jonathan Dahl
 
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
 
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
 
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
 
Single page apps with drupal 7
Single page apps with drupal 7Single page apps with drupal 7
Single page apps with drupal 7
Chris Tankersley
 
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
 
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
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
Merixstudio
 
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
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDAndi Smith
 
WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?
Alexandr Skachkov
 
BlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal MeetupBlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal MeetupBlazeMeter
 
Mad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not GoogleMad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not Google
Abel Muíño
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesCal Henderson
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
Jonathan Klein
 
Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 BostonScaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 Bostonbenbrowning
 

What's hot (20)

Distributed Applications with Perl & Gearman
Distributed Applications with Perl & GearmanDistributed Applications with Perl & Gearman
Distributed Applications with Perl & Gearman
 
Gearman and CodeIgniter
Gearman and CodeIgniterGearman and CodeIgniter
Gearman and CodeIgniter
 
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
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
 
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)Asynchronous Processing with Ruby on Rails (RailsConf 2008)
Asynchronous Processing with Ruby on Rails (RailsConf 2008)
 
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
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 
An Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing DatameerAn Ops Primer to Productionalizing Datameer
An Ops Primer to Productionalizing Datameer
 
Single page apps with drupal 7
Single page apps with drupal 7Single page apps with drupal 7
Single page apps with drupal 7
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
 
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)
 
Why we choose Symfony2
Why we choose Symfony2Why we choose Symfony2
Why we choose Symfony2
 
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)
 
Quest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFREDQuest for the Perfect Workflow for McrFRED
Quest for the Perfect Workflow for McrFRED
 
WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?WebAssembly vs JavaScript: What is faster?
WebAssembly vs JavaScript: What is faster?
 
BlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal MeetupBlazeMeter Presents at the High Performance Drupal Meetup
BlazeMeter Presents at the High Performance Drupal Meetup
 
Mad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not GoogleMad scalability: Scaling when you are not Google
Mad scalability: Scaling when you are not Google
 
Scalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & ApproachesScalable Web Architectures - Common Patterns & Approaches
Scalable Web Architectures - Common Patterns & Approaches
 
BTV PHP - Building Fast Websites
BTV PHP - Building Fast WebsitesBTV PHP - Building Fast Websites
BTV PHP - Building Fast Websites
 
Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 BostonScaling Rails With Torquebox Presented at JUDCon:2011 Boston
Scaling Rails With Torquebox Presented at JUDCon:2011 Boston
 

Similar to Gearman

Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matterTomas Doran
 
Cloud Computing with .Net
Cloud Computing with .NetCloud Computing with .Net
Cloud Computing with .Net
Wesley Faler
 
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
Dan Usher
 
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure PlatformVitor Tomaz
 
XS Japan 2008 Oracle VM English
XS Japan 2008 Oracle VM EnglishXS Japan 2008 Oracle VM English
XS Japan 2008 Oracle VM English
The Linux Foundation
 
SharePoint 2010 - Installation from the Ground Up
SharePoint 2010 - Installation from the Ground UpSharePoint 2010 - Installation from the Ground Up
SharePoint 2010 - Installation from the Ground Up
Dan Usher
 
Scale Fail: How I Learned to Love the Downtime
Scale Fail: How I Learned to Love the DowntimeScale Fail: How I Learned to Love the Downtime
Scale Fail: How I Learned to Love the DowntimePostgreSQL Experts, Inc.
 
Dynamo Systems - QCon SF 2012 Presentation
Dynamo Systems - QCon SF 2012 PresentationDynamo Systems - QCon SF 2012 Presentation
Dynamo Systems - QCon SF 2012 Presentation
Shanley Kane
 
Windows azure uk universities overview march 2012
Windows azure uk universities overview march 2012Windows azure uk universities overview march 2012
Windows azure uk universities overview march 2012
Lee Stott
 
SQL Server 2008 Migration Workshop 04/29/2009
SQL Server 2008 Migration Workshop 04/29/2009SQL Server 2008 Migration Workshop 04/29/2009
SQL Server 2008 Migration Workshop 04/29/2009
Database Architechs
 
SQL Server Workshop Paul Bertucci
SQL Server Workshop Paul BertucciSQL Server Workshop Paul Bertucci
SQL Server Workshop Paul Bertucci
Mark Ginnebaugh
 
Aras PLM Roadmap
Aras PLM RoadmapAras PLM Roadmap
Aras PLM RoadmapAras
 
Performance in a virtualized environment
Performance in a virtualized environmentPerformance in a virtualized environment
Performance in a virtualized environment
IBM India Smarter Computing
 
ITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red PillITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red Pill
Sentri
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
Tony Tam
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetup
Norm Leitman
 
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
Capgemini
 
Immersion Day - Como gerenciar seu catálogo de dados e processo de transform...
Immersion Day -  Como gerenciar seu catálogo de dados e processo de transform...Immersion Day -  Como gerenciar seu catálogo de dados e processo de transform...
Immersion Day - Como gerenciar seu catálogo de dados e processo de transform...
Amazon Web Services LATAM
 
Best Practices for Hosting Web Applications on AWS
Best Practices for Hosting Web Applications on AWSBest Practices for Hosting Web Applications on AWS
Best Practices for Hosting Web Applications on AWSAmazon Web Services
 
January 2006 Document Scanning Considerations Presentation
January 2006 Document Scanning Considerations PresentationJanuary 2006 Document Scanning Considerations Presentation
January 2006 Document Scanning Considerations PresentationJohn Wang
 

Similar to Gearman (20)

Web frameworks don't matter
Web frameworks don't matterWeb frameworks don't matter
Web frameworks don't matter
 
Cloud Computing with .Net
Cloud Computing with .NetCloud Computing with .Net
Cloud Computing with .Net
 
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
SharePoint 2010 - Tips and Tricks of the Trade - Avoiding Administrative Blun...
 
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
[.Net Juniors Academy] Introdução ao Cloud Computing e Windows Azure Platform
 
XS Japan 2008 Oracle VM English
XS Japan 2008 Oracle VM EnglishXS Japan 2008 Oracle VM English
XS Japan 2008 Oracle VM English
 
SharePoint 2010 - Installation from the Ground Up
SharePoint 2010 - Installation from the Ground UpSharePoint 2010 - Installation from the Ground Up
SharePoint 2010 - Installation from the Ground Up
 
Scale Fail: How I Learned to Love the Downtime
Scale Fail: How I Learned to Love the DowntimeScale Fail: How I Learned to Love the Downtime
Scale Fail: How I Learned to Love the Downtime
 
Dynamo Systems - QCon SF 2012 Presentation
Dynamo Systems - QCon SF 2012 PresentationDynamo Systems - QCon SF 2012 Presentation
Dynamo Systems - QCon SF 2012 Presentation
 
Windows azure uk universities overview march 2012
Windows azure uk universities overview march 2012Windows azure uk universities overview march 2012
Windows azure uk universities overview march 2012
 
SQL Server 2008 Migration Workshop 04/29/2009
SQL Server 2008 Migration Workshop 04/29/2009SQL Server 2008 Migration Workshop 04/29/2009
SQL Server 2008 Migration Workshop 04/29/2009
 
SQL Server Workshop Paul Bertucci
SQL Server Workshop Paul BertucciSQL Server Workshop Paul Bertucci
SQL Server Workshop Paul Bertucci
 
Aras PLM Roadmap
Aras PLM RoadmapAras PLM Roadmap
Aras PLM Roadmap
 
Performance in a virtualized environment
Performance in a virtualized environmentPerformance in a virtualized environment
Performance in a virtualized environment
 
ITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red PillITPro's taking the SharePoint 2013 Red Pill
ITPro's taking the SharePoint 2013 Red Pill
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
 
The DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetupThe DevOps PaaS Infusion - May meetup
The DevOps PaaS Infusion - May meetup
 
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
Petabytes of Data and No Servers: Corteva Scales DNA Analysis to Meet Increas...
 
Immersion Day - Como gerenciar seu catálogo de dados e processo de transform...
Immersion Day -  Como gerenciar seu catálogo de dados e processo de transform...Immersion Day -  Como gerenciar seu catálogo de dados e processo de transform...
Immersion Day - Como gerenciar seu catálogo de dados e processo de transform...
 
Best Practices for Hosting Web Applications on AWS
Best Practices for Hosting Web Applications on AWSBest Practices for Hosting Web Applications on AWS
Best Practices for Hosting Web Applications on AWS
 
January 2006 Document Scanning Considerations Presentation
January 2006 Document Scanning Considerations PresentationJanuary 2006 Document Scanning Considerations Presentation
January 2006 Document Scanning Considerations Presentation
 

Recently uploaded

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Gearman

  • 1. The Magical World of Gearman Brian Moon dealnews.com http://brian.moonspot.net/ @brianlmoon
  • 3. “The way I like to think of Gearman is as a massively distributed, massively fault tolerant fork mechanism.” - Joe Stump
  • 4. The Basics • Clients need jobs done • Workers can do jobs • Gearmand coordinates the work
  • 5. Gearmand http://www.flickr.com/photos/andrefromont/4896802557
  • 6. Gearmand Daemon that manages the work. Does not do any work. Accepts a job id and a binary payload from clients. Workers keep connections open at all times. http://www.flickr.com/photos/andrefromont/4896802557
  • 7. Client http://www.flickr.com/photos/pitadel/4951801589
  • 8. Client Clients connect to Gearmand and ask for work to be done. The client can fire and forget or wait on a response. Multiple jobs can be done asynchronously by workers for one client. http://www.flickr.com/photos/pitadel/4951801589
  • 9. Workers http://www.flickr.com/photos/nathaninsandiego/5972599772
  • 10. Workers Daemonized code A single worker can do just one job or can do many jobs. Does not have to be written using the same language as the worker. http://www.flickr.com/photos/nathaninsandiego/5972599772
  • 11. Key Features • Background jobs • De-duplication of jobs • Multiple jobs per client • High, normal and low priority • Work will be resubmitted if not completed
  • 12. Background Jobs • Clients can fire and forget work to be done • Well suited for data marshalling • Minimal ability to track the status
  • 13. De-duplication • Clients provide a unique job id • If more than one client provides the same job id, work is done once • Not a cache, once the job is done, the id is gone. The work will be done again.
  • 14. Priority • High, Normal and Low priority options. • New items are inserted at the end of the queue based on priority • Priority is per job type, not global
  • 15. Worker Selection • Uses the “game show method” • Workers that do multiple jobs will more likely get jobs “higher” in their list • Can appear to be clearing out one queue over another, but not really a design choice
  • 16. Operational Visibility • Gearmand can report status about jobs and workers • It is only a view of current status, not historical • Use outside tools to graph what work was done when
  • 18. Memcached Main Main Main Database Database Database Web Web Web Web Servers Web Servers Web Servers Web Servers Web Servers Servers Servers Servers
  • 19. Memcached Main Main Main Database Database Database Web Web Web Web Servers Web Servers Web Servers Web Servers Web Servers Servers Servers Servers This is so 2005!
  • 20. Main Main Optimized Database Database CRO Database or In N Main Main Proc ess Main Database Database Database Web Web Web Web Servers Web Servers Web Servers Web Servers Web Servers Servers Servers Servers
  • 21. Main Main Optimized Database Database CRO Database or In N Main Main Proc ess Main Database Database Database Web Web Web Web Servers Web Servers Web Servers Web Servers Web Servers Servers Servers Servers This is so 2009!
  • 22. Main Main Optimized Database Database Database Main Main Main Web Web Database Database Web Web Database Servers Web Servers Web Servers Web Servers Web Servers Servers Servers Servers Gearman Gearman Gearman Gearman Workers Gearman Workers Gearman Workers Gearman Workers Gearman Workers Workers Workers Workers Gearmand Backend Events
  • 23. Why Gearman • Rid us of database spikes • Changes “feel” realtime • In the case of an issue, changes can queue up and happen when things are stable • Changes can happen asynchronously
  • 24. SMTP Replacement • Large daily newsletter at 3PM • Email alerts go out on demand to thousands of readers as deals are published • Bottleneck was from double queuing in the mail queue • SMTP Server was a single point of failure
  • 25. Web Web Cron Web Web Cron Cron Servers Web Servers Cron Jobs Web Servers Web Backend Jobs Servers Web Servers Jobs Jobs Servers Servers Events Servers Gearmand Gearman Gearman Gearman Gearman Gearman Gearman Gearman Gearman Workers Gearman Workers Workers Gearman Workers Gearman Workers Gearman Gearman Workers Gearman Workers Gearman Workers SMTP Workers Gearman Workers SMTP Workers Workers Workers Workers Workers Server Workers Server
  • 27. Logging Options • Disk - reliable unless load is high. Can’t be queried easily in real time. • MySQL - Can make complex queries against it. Under high load, data can be lost • Other - (Spread, Scribe, etc.) New daemons to manage, learn, scale, etc.
  • 28. Logging via Gearman • Frontend can fire and forget log data, returning immediately to the application • Log data is queued • Workers can process the logs in any number of ways • Log data can be stored any number of ways
  • 29. Web Web Web Web Servers Web Writing Log Data Servers Web Servers Web Servers Web Servers Servers Servers Servers Gearmand Gearman Gearman Gearman Gearman Gearman Gearman Gearman Gearman Workers Gearman Workers Workers Gearman Workers Gearman Workers Gearman Gearman Workers Gearman Workers Gearman Workers MySQL Workers Gearman Workers MySQL Workers Workers Workers Workers Workers Server Workers Server
  • 30. Web Web Querying Log Data Web Web Servers Web Servers Web Servers Web Servers (Map Reduce “ish”) Backend Servers Servers Servers App Gearmand Gearman Gearman Gearman Gearman Gearman Gearman Gearman Gearman Workers Gearman Workers Workers Gearman Workers Gearman Workers Gearman Gearman Workers Gearman Workers Gearman Workers MySQL Workers Gearman Workers MySQL Workers Workers Workers Workers Workers Server Workers Server
  • 33. Normalizing URIs http://dealnews.com/
  • 34. Normalizing URIs • Define what parameters a request needs • sort • view • region • date • start • Throw out the rest • Sort what you need • Build the real URL
  • 35. Normalizing URIs • http://dealnews.com/ • http://dealnews.com/?sort=category • http://dealnews.com/?ref=foobar • http://dealnews.com/?region=nyc All become: http://dealnews.com/?sort=category&view=large&region=nyc (assuming the user is in New York)
  • 36. Why normalize/funnel? • We can now cache the data for this request and know it is the same data even if the original URI is different. (cache reuse) • We can fetch the content only once for all requests coming in for the content via request funneling.
  • 37. Why normalize/funnel? • 72 Unique URIs for the front page in 3 minute spike. There were only 6 possible real versions. (normalizing) • Thousands of syndication requests hit the app servers between 10:43 and 10:45. There were only 86 unique URIs. (funneling)
  • 38. Request Funneling Proxy Server Apache Apache Apache Apache Apache Child Child Child Child Child http://dealnews.com/?sort=category&view=large&region=nyc Gearmand Gearman Web Worker Server
  • 39. What does a worker do? • Builds a new URI from the input data • Makes an HTTP request to an app server • If cacheable, stores the data in the cache (important!) • Returns the data (page) to the proxy (via Gearmand)
  • 40. The Magical World of Gearman Brian Moon dealnews.com http://brian.moonspot.net/ @brianlmoon More Information: http://gearman.org/ Need to run PHP workers? https://github.com/brianlmoon/GearmanManager

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n