際際滷

際際滷Share a Scribd company logo
Gearman
What is Gearman?
German?
GEARMAN !=
 GERMAN
GEARMAN
   Application Framework to distribute work

   System where server accepts tasks from clients, sends them to
    workers, and dispatches results back

   It does nothing except telling workers what to do and getting thank
    you from clients
MANAGE
  R
MANAGE
   R
GEARMA
   N
Client     Client         Client



     Gearman Job Server
        (gearmand)




Worker    Worker      Worker
   Open Source

   Multi-language

   Flexible
   Fast

   Embeddable

   No single point of failure
Gearman Client


<?php
$client= new GearmanClient();
$client->addServer();
print $client->do("reverse", "Apple pie");
Gearman Worker

#!/usr/bin/python
import gearman

def my_reverse(job):
   return reverse(job.data)

gm_worker = gearman.GearmanWorker()
gm_worker.register_task('reverse', my_reverse)

while True:
   gm_worker.work()
Reverse                                 Reverse
        Apple pie         Apple pie Worker
 Client             Gearman
                      Job
Gearman              Server             Gearman
 Client eip elppA         eip elppA Worker
 API                                      API
Campaigns Queue




Campaigns To Contacts
Campaigns Queue   Queue Daemon




Campaigns To Contacts
Campaigns Queue     Queue Daemon
                            Gearman Client


Campaigns To Contacts      Gearman Job Server
Campaigns Queue              Queue Daemon
                                      Gearman Client


 Campaigns To Contacts               Gearman Job Server


Worker       Worker         Worker          Worker
Campaigns Queue              Queue Daemon
                                      Gearman Client


 Campaigns To Contacts               Gearman Job Server


Worker       Worker         Worker          Worker
Campaigns Queue              Queue Daemon
                                      Gearman Client


 Campaigns To Contacts               Gearman Job Server


Worker       Worker         Worker          Worker




   Messages Queue
Campaigns Queue              Queue Daemon
                                      Gearman Client


 Campaigns To Contacts               Gearman Job Server


Worker       Worker         Worker          Worker
Client        Client        Client          Client


   Messages Queue           Gearman Job Server
Campaigns Queue               Queue Daemon
                                           Gearman Client


 Campaigns To Contacts                   Gearman Job Server


Worker         Worker          Worker            Worker
Client          Client         Client            Client


   Messages Queue              Gearman Job Server


    Worker     Worker    Worker         Worker    Worker
Campaigns Queue               Queue Daemon
                                           Gearman Client


 Campaigns To Contacts                   Gearman Job Server


Worker         Worker          Worker            Worker
Client          Client         Client            Client


   Messages Queue              Gearman Job Server


    Worker     Worker    Worker         Worker    Worker
Campaigns Queue               Queue Daemon
                                           Gearman Client


 Campaigns To Contacts                   Gearman Job Server


Worker         Worker          Worker            Worker
Client          Client         Client            Client


   Messages Queue              Gearman Job Server


    Worker     Worker    Worker         Worker    Worker
Questions?

More Related Content

Gearman

  • 5. GEARMAN Application Framework to distribute work System where server accepts tasks from clients, sends them to workers, and dispatches results back It does nothing except telling workers what to do and getting thank you from clients
  • 7. MANAGE R GEARMA N
  • 8. Client Client Client Gearman Job Server (gearmand) Worker Worker Worker
  • 9. Open Source Multi-language Flexible Fast Embeddable No single point of failure
  • 10. Gearman Client <?php $client= new GearmanClient(); $client->addServer(); print $client->do("reverse", "Apple pie");
  • 11. Gearman Worker #!/usr/bin/python import gearman def my_reverse(job): return reverse(job.data) gm_worker = gearman.GearmanWorker() gm_worker.register_task('reverse', my_reverse) while True: gm_worker.work()
  • 12. Reverse Reverse Apple pie Apple pie Worker Client Gearman Job Gearman Server Gearman Client eip elppA eip elppA Worker API API
  • 14. Campaigns Queue Queue Daemon Campaigns To Contacts
  • 15. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server
  • 16. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker
  • 17. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker
  • 18. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker Messages Queue
  • 19. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker Client Client Client Client Messages Queue Gearman Job Server
  • 20. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker Client Client Client Client Messages Queue Gearman Job Server Worker Worker Worker Worker Worker
  • 21. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker Client Client Client Client Messages Queue Gearman Job Server Worker Worker Worker Worker Worker
  • 22. Campaigns Queue Queue Daemon Gearman Client Campaigns To Contacts Gearman Job Server Worker Worker Worker Worker Client Client Client Client Messages Queue Gearman Job Server Worker Worker Worker Worker Worker