SlideShare une entreprise Scribd logo
1  sur  38
Gearman
From the Worker's Perspective
/usr/bin/whoami
• Brian Aker
• HP Fellow
• Previously MySQL, Slashdot, Sun Microsystems
What is Gearman?
“The way I like to think of Gearman is a
massively distributed fork mechanism”
          -Joe Stump, Digg


                  “The Not Mechanical Turk”
                   -Don MacAskill, SmugMug
resize_image()
do                   {
(“resize_image”)       …
                       return $image;
                   }
(Livejournal)
Server
Provides Asynchronous and Synchronous Requests
Restarts Work
Durable Requests (MySQL, Postgres,...)
Gearman Protocol/HTTP
Epoch Scheduling
Logging
(also available, native Servers in Java, Erlang, and Perl)
Client

# Create our client object.$gmclient= new
GearmanClient();# Add default server
(localhost).$gmclient->addServer();

$result= $gmclient->do("reverse", "Hello!");
echo "Success: $resultn";
Worker
# Create our worker object.$gmw= new
GearmanWorker();# Add default server
(localhost).$gmw->addServer();

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


 function reverse_fn($job){ $workload= $job-
 >workload(); $result= strrev($workload);
 return $result;}
Lots of functions...

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

$gmw->addFunction("fetch_url", "fetch_url");
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;}
Worker Return

  GEARMAN_SUCCESS

  GEARMAN_FATAL

  GEARMAN_ERROR

  GEARMAN_SHUTDOWN
Your Client
                         request()

                          Client API
                    (C, PHP, Perl, Python, Java,Drizzle, ...)




Network,
Highly Available,              Server
Fault Tolerant

                       Worker API
                        (C, PHP, Perl, Python, Java, ...)



                     Your Worker
                      function()
Your Client
resize_image(“            request()
…”);

                           Client API
                     (C, PHP, Perl, Python, Java,Drizzle, ...)




Network,
Highly Available,                                                Provided by
                                Server
Fault Tolerant                                                    Gearman


                        Worker API
 resize_image()          (C, PHP, Perl, Python, Java, ...)
 {
   …;
   return resized;    Your Worker
 }                     function()
CPU?   event()
multiple languages
Connectors?
• C/C++
• PHP
• Python
• Java
• MySQL and Postgres
• ....
Other items of
         interest?
• Work status requests.
• Chunked Data.
• Exception Handling.
• Up to 4gig message sizes.
• Threaded server.
• Coalescence (the stealth killer feature)
Namespaces
Foo::resize_image()   Acme::resize_image()
  {                     {
    …                     …
    return $image;        return $image;
}                     }
Better Map Reduce?
reduce()
                                      {…}
map(list[…],
                   map()
      reduce());
                   {…}




                                        reduce()
                                        {…}
                           reduce()
                           {…}
Map @#$@# ?
find()

Partitioning
                     find()

           {A...K}
           {L...Q}
           {R...Z}   find()
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;}
$resu

Aggregation             lt



                      $resu
                        lt
         + result
         + result
         + result     $resu
                        lt
       = sum result
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;}
Do we have to
  partition?
 (What other tricks exist!)
Pipeline
Store()        Resize()   Publish()
Future
0.32 Released
Custom Logging Plugins
Client/Worker Configuration
Extended Administrative Commands
SSL
Status lookup via Unique Identifier
Job Result Cache
Uplift!
Gearman.inf
                                       o
• Gearman.org (...)
• http://launchpad.net/gearmand/
• twitter: brianaker
• blog: blog.krow.net

Contenu connexe

Tendances

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 javascriptLei Kang
 
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловАсинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловYandex
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6m0bz
 
Designing Immutability Data Flows in Ember
Designing Immutability Data Flows in EmberDesigning Immutability Data Flows in Ember
Designing Immutability Data Flows in EmberJorge Lainfiesta
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragmentChiwon Song
 
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 88Mahmoud Samir Fayed
 
20181020 advanced higher-order function
20181020 advanced higher-order function20181020 advanced higher-order function
20181020 advanced higher-order functionChiwon Song
 
Hyperparameter optimization landscape
Hyperparameter optimization landscapeHyperparameter optimization landscape
Hyperparameter optimization landscapeneptune.ml
 
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 212Mahmoud Samir Fayed
 
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 185Mahmoud Samir Fayed
 
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 84Mahmoud Samir Fayed
 
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 84Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 60 of 180
The Ring programming language version 1.5.1 book - Part 60 of 180The Ring programming language version 1.5.1 book - Part 60 of 180
The Ring programming language version 1.5.1 book - Part 60 of 180Mahmoud Samir Fayed
 
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...British Council
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSRyan Anklam
 
The Ring programming language version 1.2 book - Part 48 of 84
The Ring programming language version 1.2 book - Part 48 of 84The Ring programming language version 1.2 book - Part 48 of 84
The Ring programming language version 1.2 book - Part 48 of 84Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84Mahmoud Samir Fayed
 

Tendances (20)

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)
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий КуриловАсинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
Асинхронность и многопоточность в Яндекс.Такси — Дмитрий Курилов
 
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
 
Javascript
JavascriptJavascript
Javascript
 
20180721 code defragment
20180721 code defragment20180721 code defragment
20180721 code defragment
 
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
 
20181020 advanced higher-order function
20181020 advanced higher-order function20181020 advanced higher-order function
20181020 advanced higher-order function
 
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.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 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.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
 
The Ring programming language version 1.5.1 book - Part 60 of 180
The Ring programming language version 1.5.1 book - Part 60 of 180The Ring programming language version 1.5.1 book - Part 60 of 180
The Ring programming language version 1.5.1 book - Part 60 of 180
 
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
Sokoban Game Development Using Java ( Updated using Screenshots & Class Diagr...
 
Add Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJSAdd Some Fun to Your Functional Programming With RXJS
Add Some Fun to Your Functional Programming With RXJS
 
The Ring programming language version 1.2 book - Part 48 of 84
The Ring programming language version 1.2 book - Part 48 of 84The Ring programming language version 1.2 book - Part 48 of 84
The Ring programming language version 1.2 book - Part 48 of 84
 
The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84The Ring programming language version 1.2 book - Part 46 of 84
The Ring programming language version 1.2 book - Part 46 of 84
 
Codigos
CodigosCodigos
Codigos
 

En vedette

Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Bachkoutou Toutou
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Brian Moon
 
Quick Introduction to Gearman
Quick Introduction to GearmanQuick Introduction to Gearman
Quick Introduction to GearmanGiuseppe Maxia
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01longtuan
 
Website review
Website reviewWebsite review
Website reviewspg
 
Work Queues
Work QueuesWork Queues
Work Queuesciconf
 
Scale like a pro with Gearman
Scale like a pro with GearmanScale like a pro with Gearman
Scale like a pro with GearmanAmal Raghav
 
Gearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsGearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsTeamskunkworks
 

En vedette (8)

Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
Kill bottlenecks with gearman, sphinx, and memcached, Confoo 2011
 
Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Quick Introduction to Gearman
Quick Introduction to GearmanQuick Introduction to Gearman
Quick Introduction to Gearman
 
Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01Gearmanpresentation 110308165409-phpapp01
Gearmanpresentation 110308165409-phpapp01
 
Website review
Website reviewWebsite review
Website review
 
Work Queues
Work QueuesWork Queues
Work Queues
 
Scale like a pro with Gearman
Scale like a pro with GearmanScale like a pro with Gearman
Scale like a pro with Gearman
 
Gearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applicationsGearman and asynchronous processing in PHP applications
Gearman and asynchronous processing in PHP applications
 

Similaire à Gearmam, from the_worker's_perspective copy

Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs偉格 高
 
Gearman jobqueue
Gearman jobqueueGearman jobqueue
Gearman jobqueueMagento Dev
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonAlex Payne
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)Takayuki Goto
 
Thinking Functionally with JavaScript
Thinking Functionally with JavaScriptThinking Functionally with JavaScript
Thinking Functionally with JavaScriptLuis Atencio
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Codemotion
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей КоваленкоFwdays
 
Distributed work with Gearman
Distributed work with GearmanDistributed work with Gearman
Distributed work with GearmanDominik Jungowski
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairMark
 
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...Codemotion
 
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 JavaScriptGuy Royse
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with ClojureDmitry Buzdin
 
FunctionalJS - George Shevtsov
FunctionalJS - George ShevtsovFunctionalJS - George Shevtsov
FunctionalJS - George ShevtsovGeorgiy Shevtsov
 
1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScriptInnovecs
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 ReviewSperasoft
 

Similaire à Gearmam, from the_worker's_perspective copy (20)

Functional programming using underscorejs
Functional programming using underscorejsFunctional programming using underscorejs
Functional programming using underscorejs
 
ES6 Overview
ES6 OverviewES6 Overview
ES6 Overview
 
Gearman jobqueue
Gearman jobqueueGearman jobqueue
Gearman jobqueue
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
Emerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the HorizonEmerging Languages: A Tour of the Horizon
Emerging Languages: A Tour of the Horizon
 
Groovy
GroovyGroovy
Groovy
 
オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)オープンデータを使ったモバイルアプリ開発(応用編)
オープンデータを使ったモバイルアプリ開発(応用編)
 
Thinking Functionally with JavaScript
Thinking Functionally with JavaScriptThinking Functionally with JavaScript
Thinking Functionally with JavaScript
 
Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016Promises are so passé - Tim Perry - Codemotion Milan 2016
Promises are so passé - Tim Perry - Codemotion Milan 2016
 
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко"Немного о функциональном программирование в JavaScript" Алексей Коваленко
"Немного о функциональном программирование в JavaScript" Алексей Коваленко
 
Distributed work with Gearman
Distributed work with GearmanDistributed work with Gearman
Distributed work with Gearman
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
 
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...
Matteo Collina | Take your HTTP server to Ludicrous Speed | Codmeotion Madrid...
 
Academy PRO: ES2015
Academy PRO: ES2015Academy PRO: ES2015
Academy PRO: ES2015
 
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
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
FunctionalJS - George Shevtsov
FunctionalJS - George ShevtsovFunctionalJS - George Shevtsov
FunctionalJS - George Shevtsov
 
1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript1. George Shevtsov - Functional JavaScript
1. George Shevtsov - Functional JavaScript
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
 

Plus de Brian Aker

LinuxCon Keynote
LinuxCon KeynoteLinuxCon Keynote
LinuxCon KeynoteBrian Aker
 
Oscon keynote 2012
Oscon keynote 2012Oscon keynote 2012
Oscon keynote 2012Brian Aker
 
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 copyBrian Aker
 
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 ConferenceBrian Aker
 
Drizzle 7.0, Future of Virtualizing
Drizzle 7.0, Future of VirtualizingDrizzle 7.0, Future of Virtualizing
Drizzle 7.0, Future of VirtualizingBrian Aker
 
Tricking out your Memcached Setup
Tricking out your Memcached SetupTricking out your Memcached Setup
Tricking out your Memcached SetupBrian Aker
 
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 ConferenceBrian Aker
 
Drizzle @OpenSQL Camp
Drizzle @OpenSQL CampDrizzle @OpenSQL Camp
Drizzle @OpenSQL CampBrian Aker
 

Plus de Brian Aker (10)

LinuxCon Keynote
LinuxCon KeynoteLinuxCon Keynote
LinuxCon Keynote
 
Oscon keynote 2012
Oscon keynote 2012Oscon keynote 2012
Oscon keynote 2012
 
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
 
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
 

Dernier

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Dernier (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Gearmam, from the_worker's_perspective copy

  • 2. /usr/bin/whoami • Brian Aker • HP Fellow • Previously MySQL, Slashdot, Sun Microsystems
  • 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
  • 5.
  • 6. resize_image() do { (“resize_image”) … return $image; }
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Server Provides Asynchronous and Synchronous Requests Restarts Work Durable Requests (MySQL, Postgres,...) Gearman Protocol/HTTP Epoch Scheduling Logging (also available, native Servers in Java, Erlang, and Perl)
  • 14. Client # Create our client object.$gmclient= new GearmanClient();# Add default server (localhost).$gmclient->addServer(); $result= $gmclient->do("reverse", "Hello!"); echo "Success: $resultn";
  • 15. Worker # Create our worker object.$gmw= new GearmanWorker();# Add default server (localhost).$gmw->addServer(); $gmw->addFunction("reverse", "reverse_fn");while ($gmworker->work()) {…}
  • 16. Worker Function function reverse_fn($job){ $workload= $job- >workload(); $result= strrev($workload); return $result;}
  • 17. Lots of functions... $gmw->addFunction("resize", "resize_fn"); $gmw->addFunction("grep", "grep_fn"); $gmw->addFunction("fetch_url", "fetch_url");
  • 18. 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;}
  • 19. Worker Return GEARMAN_SUCCESS GEARMAN_FATAL GEARMAN_ERROR GEARMAN_SHUTDOWN
  • 20. Your Client request() Client API (C, PHP, Perl, Python, Java,Drizzle, ...) Network, Highly Available, Server Fault Tolerant Worker API (C, PHP, Perl, Python, Java, ...) Your Worker function()
  • 21. Your Client resize_image(“ request() …”); Client API (C, PHP, Perl, Python, Java,Drizzle, ...) Network, Highly Available, Provided by Server Fault Tolerant Gearman Worker API resize_image() (C, PHP, Perl, Python, Java, ...) { …; return resized; Your Worker } function()
  • 22. CPU? event()
  • 23.
  • 25. Connectors? • C/C++ • PHP • Python • Java • MySQL and Postgres • ....
  • 26. Other items of interest? • Work status requests. • Chunked Data. • Exception Handling. • Up to 4gig message sizes. • Threaded server. • Coalescence (the stealth killer feature)
  • 27. Namespaces Foo::resize_image() Acme::resize_image() { { … … return $image; return $image; } }
  • 29. reduce() {…} map(list[…], map() reduce()); {…} reduce() {…} reduce() {…}
  • 31. find() Partitioning find() {A...K} {L...Q} {R...Z} find()
  • 32. 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;}
  • 33. $resu Aggregation lt $resu lt + result + result + result $resu lt = sum result
  • 34. 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;}
  • 35. Do we have to partition? (What other tricks exist!)
  • 36. Pipeline Store() Resize() Publish()
  • 37. Future 0.32 Released Custom Logging Plugins Client/Worker Configuration Extended Administrative Commands SSL Status lookup via Unique Identifier Job Result Cache Uplift!
  • 38. Gearman.inf o • Gearman.org (...) • http://launchpad.net/gearmand/ • twitter: brianaker • blog: blog.krow.net

Notes de l'éditeur

  1. There is no difference if one of the actors is using one operating system rather than the same one used by the server. Actually, clients can get specific advantage of this architecture, by requesting tasks that are not available in their operating system but can be easily performed in the OS of one of the workers.
  2. Language, the greatest divider in the recent technology, is not an obstacle anymore. Clients can keep coding in the language they are most familiar with, and the workers will use libraries and classes that are only available to specific languages, without need for the clients to be involved with the nitpicks of such complex systems.