SlideShare une entreprise Scribd logo
1  sur  65
Les rouages du travail distribué
   julien.salleyron@gmail.com
    ◦ Geek
                                                @juguul
    ◦ Copix Team

    ◦ Lead developper de l’extension AOP pour PHP*


                                   https://github.com/AOP-PHP




                * Présentation de AOP et AOP-PHP à 15h45 même salle
« O Draconian Devil ! Oh Lame Saint. »
 « Leonardo Da Vinci, The Mona Lisa »
?
manager
« Quelqu’un de dispo sait faire ça ? »
Gearman




             Worker              Worker             Worker


Je sais faire « Hello »   Je sais faire « Bye »   Je sais faire « Hello »
                                                  Je sais faire « Bye »
Tâches       Tâches    Workers
                    en attente   en cours    total


   telnet server port (telnet 127.0.0.1 4730)
    ◦ Status




    ◦ Workers
Client   J’aimerai faire « Hello » ?




            Gearman




                              Worker
 Worker     Worker
                             « Hello »
« Hello »   « Bye »
                              « Bye »
Moi aussi                                        Bah moi
je veux faire     Client             Client     Je veux faire
   « Hello »                                       « Bye »



                           Gearman




                                           Worker
             Worker        Worker
                                          « Hello »
            « Hello »      « Bye »
                                           « Bye »
« Quelle est la plus grosse tâche ? »
FIFO
(First In First Out)
FIFO
  (First In First Out)

           FIFE
(First In First Execute)
12:00:00 -> demande « BonjourMadame »
12:00:05 -> demande « HelloTheWorld »

12:00:07 <- réponse « HelloTheWorld »
12:00:10 <- réponse « BonjourMadame »
12:00:00 -> demande « Bye » (1)
12:00:01 -> demande « Bye » (2)
12:00:02 -> demande « Bye » (3)

12:00:05 <- réponse « bye » (1)
12:00:10 <- réponse « bye » (2)
12:00:15 <- réponse « bye » (3)
Client3
Client1   Client2
                     HIGH




          Gearman




          Worker
           Bye
Client2
Client1             Client3
           LOW




          Gearman




          Worker
           Task
12:00:00   ->   demande       «   Hello   »   (1)
12:00:01   ->   demande       «   Hello   »   (Low 2)
12:00:02   ->   demande       «   Hello   »   (3)
12:00:03   ->   demande       «   Hello   »   (High 4)

12:00:05   <-   réponse   «   Hello   »   (1)
12:00:10   <-   réponse   «   Hello   »   (4)
12:00:15   <-   réponse   «   Hello   »   (3)
12:00:20   <-   réponse   «   Hello   »   (2)
Un manager polyglotte
   Création d’un worker qui compte :


Appel client d’un worker qui compte :
gearman -f wc -h localhost -p 4730
   PECL (utilisé dans les slides)
pecl install gearman


   PEAR
pear install Net_Gearman
« Et les workers, ils travaillent sans données ? »
Chaine de caractères *




                         * Norme JSON
Reconnaissance de QRCode
« J’aimerai reconnaitre
un QRCode »




                          Gearman




                                    « Je sais reconnaitre les QRCode »
« Plus de puissance ! Toujours plus de
                         puissance ! »
Client             Client




             Gearman




                                Worker
Worker       Worker
                                Task1
Task1        Task2
                                Task2
Server 1               Server 2


      Client                 Client




                Gearman




                                      Worker
Worker          Worker
                                      Task1
Task1           Task2
                                      Task2

Server 3                  Server 4
Server 1             Server 2


      Client                Client




                Server




                                     Worker
Worker          Worker
                 Worker              Task1
                                     Worker
Task1           Task2
                  Task1              Task2
                                      Task1
                  Task2               Task2
Server 3                Server 4
Server 1                 Server 2


            Client                   Client




                           Server




                                                          Worker
Worker                Worker          Worker
                                                          Task1
Task1                 Task1           Task2
                                                          Task2

Server 5              Server 3                 Server 4
Server 1                         Server 2


               Client                           Client




                                   Server




                                                                   Worker
Worker                   Worker                  Worker
                                                                   Task1
Task1                    Task1                   Task2
           Worker                     Worker                Worker Task2
           Task1                      Task1                 Task1
Server 5                 Server 3                         Server 4

           Server N                 Server N+1            Server N+2
                         GearMan                          39
Server 1                 Server 2


            Client                   Client




                           Server




                                                          Worker
Worker                Worker          Worker
                                                          Task1
Task1                 Task1           Task2
                                                          Task2

Server 5              Server 3                 Server 4
mais ce n’est pas tout !
Le résultat m’importe peu, « just do it » !
Client    « Tu le feras plus tard »
Background




 Gearman




  Worker
   Task
Gestion des logs
Client
Background




 Gearman



  Worker
 Envoi log
 par mail
Client
             « Tant que tu le fais un jour »
Background




 Gearman
   Gestion par timeout
« Elle est où la liste des tâches à faire »
« il reste tout ça à
             faire »




Gearman
   gearmand -d -q libsqlite3 --libsqlite3-db ./test.db



                   « ce qu’il reste à faire »



                                                BDD



                            Gearman
« Tous ensemble, tous ensemble ! Hey !! »
Client
          Task1
            +
          Task1
            +
          Task2




         Gearman




                   Worker
Worker   Worker
                   Task1
Task1    Task2
                   Task2
Tarification multi-produit
« Mais il est où ce bug »
« les workers ont planté,
 faut les relancer !!!!!!! »
« Au fait, il prends quoi
en paramètre ton worker ? »
Des questions ?

Contenu connexe

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Gearman

  • 1. Les rouages du travail distribué
  • 2. julien.salleyron@gmail.com ◦ Geek @juguul ◦ Copix Team ◦ Lead developper de l’extension AOP pour PHP* https://github.com/AOP-PHP * Présentation de AOP et AOP-PHP à 15h45 même salle
  • 3. « O Draconian Devil ! Oh Lame Saint. » « Leonardo Da Vinci, The Mona Lisa »
  • 4. ?
  • 6. « Quelqu’un de dispo sait faire ça ? »
  • 7. Gearman Worker Worker Worker Je sais faire « Hello » Je sais faire « Bye » Je sais faire « Hello » Je sais faire « Bye »
  • 8.
  • 9. Tâches Tâches Workers en attente en cours total  telnet server port (telnet 127.0.0.1 4730) ◦ Status ◦ Workers
  • 10. Client J’aimerai faire « Hello » ? Gearman Worker Worker Worker « Hello » « Hello » « Bye » « Bye »
  • 11. Moi aussi Bah moi je veux faire Client Client Je veux faire « Hello » « Bye » Gearman Worker Worker Worker « Hello » « Hello » « Bye » « Bye »
  • 12.
  • 13. « Quelle est la plus grosse tâche ? »
  • 15. FIFO (First In First Out) FIFE (First In First Execute)
  • 16. 12:00:00 -> demande « BonjourMadame » 12:00:05 -> demande « HelloTheWorld » 12:00:07 <- réponse « HelloTheWorld » 12:00:10 <- réponse « BonjourMadame »
  • 17. 12:00:00 -> demande « Bye » (1) 12:00:01 -> demande « Bye » (2) 12:00:02 -> demande « Bye » (3) 12:00:05 <- réponse « bye » (1) 12:00:10 <- réponse « bye » (2) 12:00:15 <- réponse « bye » (3)
  • 18. Client3 Client1 Client2 HIGH Gearman Worker Bye
  • 19. Client2 Client1 Client3 LOW Gearman Worker Task
  • 20.
  • 21. 12:00:00 -> demande « Hello » (1) 12:00:01 -> demande « Hello » (Low 2) 12:00:02 -> demande « Hello » (3) 12:00:03 -> demande « Hello » (High 4) 12:00:05 <- réponse « Hello » (1) 12:00:10 <- réponse « Hello » (4) 12:00:15 <- réponse « Hello » (3) 12:00:20 <- réponse « Hello » (2)
  • 23.
  • 24.
  • 25. Création d’un worker qui compte : Appel client d’un worker qui compte : gearman -f wc -h localhost -p 4730
  • 26.
  • 27. PECL (utilisé dans les slides) pecl install gearman  PEAR pear install Net_Gearman
  • 28. « Et les workers, ils travaillent sans données ? »
  • 29. Chaine de caractères * * Norme JSON
  • 30.
  • 32. « J’aimerai reconnaitre un QRCode » Gearman « Je sais reconnaitre les QRCode »
  • 33.
  • 34. « Plus de puissance ! Toujours plus de puissance ! »
  • 35. Client Client Gearman Worker Worker Worker Task1 Task1 Task2 Task2
  • 36. Server 1 Server 2 Client Client Gearman Worker Worker Worker Task1 Task1 Task2 Task2 Server 3 Server 4
  • 37. Server 1 Server 2 Client Client Server Worker Worker Worker Worker Task1 Worker Task1 Task2 Task1 Task2 Task1 Task2 Task2 Server 3 Server 4
  • 38. Server 1 Server 2 Client Client Server Worker Worker Worker Worker Task1 Task1 Task1 Task2 Task2 Server 5 Server 3 Server 4
  • 39. Server 1 Server 2 Client Client Server Worker Worker Worker Worker Task1 Task1 Task1 Task2 Worker Worker Worker Task2 Task1 Task1 Task1 Server 5 Server 3 Server 4 Server N Server N+1 Server N+2 GearMan 39
  • 40. Server 1 Server 2 Client Client Server Worker Worker Worker Worker Task1 Task1 Task1 Task2 Task2 Server 5 Server 3 Server 4
  • 41. mais ce n’est pas tout !
  • 42. Le résultat m’importe peu, « just do it » !
  • 43. Client « Tu le feras plus tard » Background Gearman Worker Task
  • 44.
  • 46. Client Background Gearman Worker Envoi log par mail
  • 47.
  • 48. Client « Tant que tu le fais un jour » Background Gearman
  • 49.
  • 50. Gestion par timeout
  • 51. « Elle est où la liste des tâches à faire »
  • 52. « il reste tout ça à faire » Gearman
  • 53. gearmand -d -q libsqlite3 --libsqlite3-db ./test.db « ce qu’il reste à faire » BDD Gearman
  • 54. « Tous ensemble, tous ensemble ! Hey !! »
  • 55. Client Task1 + Task1 + Task2 Gearman Worker Worker Worker Task1 Task1 Task2 Task2
  • 56.
  • 58.
  • 59.
  • 60.
  • 61. « Mais il est où ce bug »
  • 62.
  • 63. « les workers ont planté, faut les relancer !!!!!!! »
  • 64. « Au fait, il prends quoi en paramètre ton worker ? »