SlideShare a Scribd company logo
1 of 28
Download to read offline
Gearman
                 From the Worker's Perspective




Tuesday, June 21, 2011
/usr/bin/whoami
                            Brian Aker
                            CTO/Founder Data Differential
                            Previously MySQL, Slashdot, Sun Microsystems




Tuesday, June 21, 2011
What is Gearman?




Tuesday, June 21, 2011
“The way I like to think of Gearman is a
               massively distributed fork mechanism”
                          -Joe Stump, Digg


                                 “The Not Mechanical Turk”
                                  -Don MacAskill, SmugMug




Tuesday, June 21, 2011
resize_image()
                   do (“resize_image”)   {
                                           …
                                           return $image;
                                         }




Tuesday, June 21, 2011
!"#$%#&'()#*+




       !                       !


Tuesday, June 21, 2011
!"#$%&$'()&$*&+,-./
           !   01"2)3+&$4$3)&51)6-5+3$7+12"-&$&8&5+9
           !   :45-14.$."43$64.47;)7<
                 "       ="1>+1&$41+$7"5),)+3$473$4&>$,"1$#"1>?$7"5$,"1;+3
           !   @-.5)A.47<-4<+$)75+<145)"7
           !   B)&51)6-5+$C1";+&&)7<
                 "       0"&&)6.8$;."&+1$5"$3454
           !   D87;(1"7"-&$473$4&87;(1"7"-&$E-+-+&


       !                                           !


Tuesday, June 21, 2011
Server
                         Provides Asynchronous and Synchronous Requests
                         Restarts Work
                         Durable Requests
                         Gearman Protocol/HTTP
                         Epoch Scheduling
                         Logging




Tuesday, June 21, 2011
Client
                         # Create our client object.
                         $gmclient= new GearmanClient();

                         # Add default server (localhost).
                         $gmclient->addServer();

                         $result= $gmclient->do("reverse", "Hello!");

                         echo "Success: $resultn";


Tuesday, June 21, 2011
Worker
                         # Create our worker object.
                         $gmw= new GearmanWorker();

                         # Add default server (localhost).
                         $gmw->addServer();

                         $gmw->addFunction("reverse", "reverse_fn");
                         while ($gmworker->work()) {…}


Tuesday, June 21, 2011
Worker Function
                          function reverse_fn($job)
                          {
                           $workload= $job->workload();

                              $result= strrev($workload);

                              return $result;
                          }


Tuesday, June 21, 2011
Lots of functions...

                          $gmw->addFunction("resize", "resize_fn");

                          $gmw->addFunction("grep", "grep_fn");

                          $gmw->addFunction("fetch_url", "fetch_url");




Tuesday, June 21, 2011
Function
            gearman_return_t fetch_url(gearman_job_st *job, void*)
            {
              const char *workload= gearman_job_workload(job);
              size_t workload_size= gearman_job_workload_size(job);

                gearman_job_send_status(job, 0, 100);

            …
             gearman_job_send_data(job, chunk, sizeofchunk);

            …
             gearman_job_send_status(job, 50,100);

            … if (issue_warning)
             gearman_job_warning(job, “I'm sorry, Dave. I'm afraid I can't do that.”, size);

                return GEARMAN_SUCCESS;
            }



Tuesday, June 21, 2011
Worker Return

                         GEARMAN_SUCCESS

                         GEARMAN_FATAL

                         GEARMAN_ERROR

                         GEARMAN_SHUTDOWN




Tuesday, June 21, 2011
reduce() {…}
                         map(list[…],
                             reduce());   map() {…}




                                                                   reduce() {…}

                                                  reduce() {…}




Tuesday, June 21, 2011
Map @#$@# ?



Tuesday, June 21, 2011
find()

       Partitioning
                                   find()

                         {A...K}
                         {L...Q}
                         {R...Z}   find()




Tuesday, June 21, 2011
Partitioning
               gearman_return_t split_worker(gearman_job_st *job, void* /* context */)
               {
                 const char *workload= gearman_job_workload(job);
                 size_t workload_size= gearman_job_workload_size(job);

                   const char *chunk_begin= workload;
                   for (size_t x= 0; x < workload_size; x++)
                   {
                     if (workload[x] == 0 or workload[x] == ' ')
                     {
                       gearman_job_send_data(job, chunk_begin,
                                               workload +x -chunk_begin);
                       chunk_begin= workload +x +1;
                     }
                   }

                   return GEARMAN_SUCCESS;
               }



Tuesday, June 21, 2011
$result
      Aggregation
                                        $result
                           + result
                           + result
                           + result
                                        $result
                         = sum result



Tuesday, June 21, 2011
Aggregation
              gearman_return_t cat_aggregator (gearman_aggregator_st *,
                                               gearman_task_st *task,
                                               gearman_result_st *result)
              {
                std::string string_value;

                  do
                  {
                    gearman_result_st *result_ptr= gearman_task_result(task);

                     string_value.append(gearman_result_value(result_ptr),
                                         gearman_result_size(result_ptr));

                  } while ((task= gearman_next(task)));

                  gearman_result_store_value(result, string_value.c_str(),
                                             string_value.size());

                  return GEARMAN_SUCCESS;
              }



Tuesday, June 21, 2011
Do we have to
                           partition?
                          (What other tricks exist!)




Tuesday, June 21, 2011
Pipeline
                         Store()        Resize()   Publish()




Tuesday, June 21, 2011
CPU?    poll()




Tuesday, June 21, 2011
Tuesday, June 21, 2011
multiple languages




Tuesday, June 21, 2011
Namespaces
                         Foo::resize_image()   Acme::resize_image()
                           {                     {
                             …                     …
                             return $image;        return $image;
                         }                     }




Tuesday, June 21, 2011
Future
                         0.22 Released
                         Custom Logging Plugins
                         Client/Worker Configuration
                         Extended Administrative Commands
                         SSL
                         Job Result Cache
                         Uplift!




Tuesday, June 21, 2011
• Gearman.info (up to date)
     • Gearman.org (...)
     • http://launchpad.net/gearmand/
     • twitter: brianaker
     • blog: blog.krow.net

Tuesday, June 21, 2011

More Related Content

What's hot

Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoSF
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
Lei Kang
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
MongoDB
 

What's hot (20)

Functional JS for everyone - 4Developers
Functional JS for everyone - 4DevelopersFunctional JS for everyone - 4Developers
Functional JS for everyone - 4Developers
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
this
thisthis
this
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
Javascript essential-pattern
Javascript essential-patternJavascript essential-pattern
Javascript essential-pattern
 
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловАсинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
 
Herding types with Scala macros
Herding types with Scala macrosHerding types with Scala macros
Herding types with Scala macros
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6
 
Designing Immutability Data Flows in Ember
Designing Immutability Data Flows in EmberDesigning Immutability Data Flows in Ember
Designing Immutability Data Flows in Ember
 
Typelevel summit
Typelevel summitTypelevel summit
Typelevel summit
 
The Ring programming language version 1.3 book - Part 46 of 88
The Ring programming language version 1.3 book - Part 46 of 88The Ring programming language version 1.3 book - Part 46 of 88
The Ring programming language version 1.3 book - Part 46 of 88
 
Javascript
JavascriptJavascript
Javascript
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragment
 
20181020 advanced higher-order function
20181020 advanced higher-order function20181020 advanced higher-order function
20181020 advanced higher-order function
 
Building Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at StripeBuilding Real Time Systems on MongoDB Using the Oplog at Stripe
Building Real Time Systems on MongoDB Using the Oplog at Stripe
 
Hyperparameter optimization landscape
Hyperparameter optimization landscapeHyperparameter optimization landscape
Hyperparameter optimization landscape
 
The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212The Ring programming language version 1.10 book - Part 70 of 212
The Ring programming language version 1.10 book - Part 70 of 212
 
The Ring programming language version 1.2 book - Part 45 of 84
The Ring programming language version 1.2 book - Part 45 of 84The Ring programming language version 1.2 book - Part 45 of 84
The Ring programming language version 1.2 book - Part 45 of 84
 
The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185The Ring programming language version 1.5.4 book - Part 60 of 185
The Ring programming language version 1.5.4 book - Part 60 of 185
 
The Ring programming language version 1.2 book - Part 47 of 84
The Ring programming language version 1.2 book - Part 47 of 84The Ring programming language version 1.2 book - Part 47 of 84
The Ring programming language version 1.2 book - Part 47 of 84
 

Similar to Gearman, from the worker's perspective

Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
Brian Aker
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
archanaemporium
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
parag978978
 
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
DrupalCamp MSK
 

Similar to Gearman, from the worker's perspective (20)

Gearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copyGearmam, from the_worker's_perspective copy
Gearmam, from the_worker's_perspective copy
 
I dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdfI dont know what is wrong with this roulette program I cant seem.pdf
I dont know what is wrong with this roulette program I cant seem.pdf
 
ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?ES6, 잘 쓰고 계시죠?
ES6, 잘 쓰고 계시죠?
 
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
 
JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)JavaScript 1.5 to 2.0 (TomTom)
JavaScript 1.5 to 2.0 (TomTom)
 
The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189The Ring programming language version 1.6 book - Part 62 of 189
The Ring programming language version 1.6 book - Part 62 of 189
 
Functional JavaScript for everyone
Functional JavaScript for everyoneFunctional JavaScript for everyone
Functional JavaScript for everyone
 
Road to react hooks
Road to react hooksRoad to react hooks
Road to react hooks
 
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScriptjQuery & 10,000 Global Functions: Working with Legacy JavaScript
jQuery & 10,000 Global Functions: Working with Legacy JavaScript
 
Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
 
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
Drupal in aerospace - selling geodetic satellite data with Commerce - Martin ...
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
DOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQueryDOM Scripting Toolkit - jQuery
DOM Scripting Toolkit - jQuery
 
linieaire regressie
linieaire regressielinieaire regressie
linieaire regressie
 
EcmaScript 6
EcmaScript 6 EcmaScript 6
EcmaScript 6
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6Redux saga: managing your side effects. Also: generators in es6
Redux saga: managing your side effects. Also: generators in es6
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruit
 
Redux Sagas - React Alicante
Redux Sagas - React AlicanteRedux Sagas - React Alicante
Redux Sagas - React Alicante
 

More from Brian Aker (9)

LinuxCon Keynote
LinuxCon KeynoteLinuxCon Keynote
LinuxCon Keynote
 
Oscon keynote 2012
Oscon keynote 2012Oscon keynote 2012
Oscon keynote 2012
 
Drizzle Keynote from O'Reilly's MySQL's Conference
Drizzle Keynote from O'Reilly's MySQL's ConferenceDrizzle Keynote from O'Reilly's MySQL's Conference
Drizzle Keynote from O'Reilly's MySQL's Conference
 
Drizzle 7.0, Future of Virtualizing
Drizzle 7.0, Future of VirtualizingDrizzle 7.0, Future of Virtualizing
Drizzle 7.0, Future of Virtualizing
 
Tricking out your Memcached Setup
Tricking out your Memcached SetupTricking out your Memcached Setup
Tricking out your Memcached Setup
 
Drizzle Keynote at the MySQL User's Conference
Drizzle Keynote at the MySQL User's ConferenceDrizzle Keynote at the MySQL User's Conference
Drizzle Keynote at the MySQL User's Conference
 
Drizzle @OpenSQL Camp
Drizzle @OpenSQL CampDrizzle @OpenSQL Camp
Drizzle @OpenSQL Camp
 
No SQL Talk
No SQL TalkNo SQL Talk
No SQL Talk
 
Drizzle Talk
Drizzle TalkDrizzle Talk
Drizzle Talk
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Gearman, from the worker's perspective

  • 1. Gearman From the Worker's Perspective Tuesday, June 21, 2011
  • 2. /usr/bin/whoami Brian Aker CTO/Founder Data Differential Previously MySQL, Slashdot, Sun Microsystems Tuesday, June 21, 2011
  • 4. “The way I like to think of Gearman is a massively distributed fork mechanism” -Joe Stump, Digg “The Not Mechanical Turk” -Don MacAskill, SmugMug Tuesday, June 21, 2011
  • 5. resize_image() do (“resize_image”) { … return $image; } Tuesday, June 21, 2011
  • 6. !"#$%#&'()#*+ ! ! Tuesday, June 21, 2011
  • 7. !"#$%&$'()&$*&+,-./ ! 01"2)3+&$4$3)&51)6-5+3$7+12"-&$&8&5+9 ! :45-14.$."43$64.47;)7< " ="1>+1&$41+$7"5),)+3$473$4&>$,"1$#"1>?$7"5$,"1;+3 ! @-.5)A.47<-4<+$)75+<145)"7 ! B)&51)6-5+$C1";+&&)7< " 0"&&)6.8$;."&+1$5"$3454 ! D87;(1"7"-&$473$4&87;(1"7"-&$E-+-+& ! ! Tuesday, June 21, 2011
  • 8. Server Provides Asynchronous and Synchronous Requests Restarts Work Durable Requests Gearman Protocol/HTTP Epoch Scheduling Logging Tuesday, June 21, 2011
  • 9. Client # Create our client object. $gmclient= new GearmanClient(); # Add default server (localhost). $gmclient->addServer(); $result= $gmclient->do("reverse", "Hello!"); echo "Success: $resultn"; Tuesday, June 21, 2011
  • 10. Worker # Create our worker object. $gmw= new GearmanWorker(); # Add default server (localhost). $gmw->addServer(); $gmw->addFunction("reverse", "reverse_fn"); while ($gmworker->work()) {…} Tuesday, June 21, 2011
  • 11. Worker Function function reverse_fn($job) { $workload= $job->workload(); $result= strrev($workload); return $result; } Tuesday, June 21, 2011
  • 12. Lots of functions... $gmw->addFunction("resize", "resize_fn"); $gmw->addFunction("grep", "grep_fn"); $gmw->addFunction("fetch_url", "fetch_url"); Tuesday, June 21, 2011
  • 13. Function gearman_return_t fetch_url(gearman_job_st *job, void*) { const char *workload= gearman_job_workload(job); size_t workload_size= gearman_job_workload_size(job); gearman_job_send_status(job, 0, 100); … gearman_job_send_data(job, chunk, sizeofchunk); … gearman_job_send_status(job, 50,100); … if (issue_warning) gearman_job_warning(job, “I'm sorry, Dave. I'm afraid I can't do that.”, size); return GEARMAN_SUCCESS; } Tuesday, June 21, 2011
  • 14. Worker Return GEARMAN_SUCCESS GEARMAN_FATAL GEARMAN_ERROR GEARMAN_SHUTDOWN Tuesday, June 21, 2011
  • 15. reduce() {…} map(list[…], reduce()); map() {…} reduce() {…} reduce() {…} Tuesday, June 21, 2011
  • 16. Map @#$@# ? Tuesday, June 21, 2011
  • 17. find() Partitioning find() {A...K} {L...Q} {R...Z} find() Tuesday, June 21, 2011
  • 18. Partitioning gearman_return_t split_worker(gearman_job_st *job, void* /* context */) { const char *workload= gearman_job_workload(job); size_t workload_size= gearman_job_workload_size(job); const char *chunk_begin= workload; for (size_t x= 0; x < workload_size; x++) { if (workload[x] == 0 or workload[x] == ' ') { gearman_job_send_data(job, chunk_begin, workload +x -chunk_begin); chunk_begin= workload +x +1; } } return GEARMAN_SUCCESS; } Tuesday, June 21, 2011
  • 19. $result Aggregation $result + result + result + result $result = sum result Tuesday, June 21, 2011
  • 20. Aggregation gearman_return_t cat_aggregator (gearman_aggregator_st *, gearman_task_st *task, gearman_result_st *result) { std::string string_value; do { gearman_result_st *result_ptr= gearman_task_result(task); string_value.append(gearman_result_value(result_ptr), gearman_result_size(result_ptr)); } while ((task= gearman_next(task))); gearman_result_store_value(result, string_value.c_str(), string_value.size()); return GEARMAN_SUCCESS; } Tuesday, June 21, 2011
  • 21. Do we have to partition? (What other tricks exist!) Tuesday, June 21, 2011
  • 22. Pipeline Store() Resize() Publish() Tuesday, June 21, 2011
  • 23. CPU? poll() Tuesday, June 21, 2011
  • 26. Namespaces Foo::resize_image() Acme::resize_image() { { … … return $image; return $image; } } Tuesday, June 21, 2011
  • 27. Future 0.22 Released Custom Logging Plugins Client/Worker Configuration Extended Administrative Commands SSL Job Result Cache Uplift! Tuesday, June 21, 2011
  • 28. • Gearman.info (up to date) • Gearman.org (...) • http://launchpad.net/gearmand/ • twitter: brianaker • blog: blog.krow.net Tuesday, June 21, 2011