An application framework
to distribute work
Presenter: Biswajit Maji, Mindfire Solutions
Date: 9/04/2014
Add it to your pr...
Presenter: Biswajit Maji, Mindfire Solutions
OCP – Oracle certified
professional developer
About Me
Skills : Mysql, php, j...
Presenter: Biswajit Maji, Mindfire Solutions
AGENDA
 A short description of Gearman
 Some real time problem we face
 In...
Presenter: Biswajit Maji, Mindfire Solutions
A short description of Gearman
Open source application framework
To distribut...
Presenter: Biswajit Maji, Mindfire Solutions
Some real time problem we face
 Sending bulk email
 Image resizing
 Waterm...
Presenter: Biswajit Maji, Mindfire Solutions
Installing Gearman Server
in linux box
As usual
sudo apt-get install gearman-...
Presenter: Biswajit Maji, Mindfire Solutions
Installing php api
If want to use pecl for installing gearman
sudo apt-get in...
Presenter: Biswajit Maji, Mindfire Solutions
Gearman Worker code
# Create our worker object.
$gmworker= new GearmanWorker(...
Presenter: Biswajit Maji, Mindfire Solutions
Gearman Client code
# Create our client object.
$gmclient= new GearmanClient(...
Presenter: Biswajit Maji, Mindfire Solutions
Few most used Gearman Client methods
addServer("10.0.0.2", 7003)
addServers("...
Presenter: Biswajit Maji, Mindfire Solutions
DEMO
Presenter: Biswajit Maji, Mindfire Solutions
References
http://gearman.org/
http://blog.zitec.com/2011/parallel-processing...
Presenter: Biswajit Maji, Mindfire Solutions
Question and
Answer
Presenter: Biswajit Maji, Mindfire Solutions
Thank
you
www.mindfiresolutions.com
https://www.facebook.com/MindfireSolutions
http://www.linkedin.com/company/mindfire-solutions
ht...
Upcoming SlideShare
Loading in...5
×

Gearman Add To Your Project

597

Published on

This presentation concentrates on how to setup the Gearman server and how can one integrate Gearman into ones project.

Published in: Software, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
597
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Gearman Add To Your Project

  1. 1. An application framework to distribute work Presenter: Biswajit Maji, Mindfire Solutions Date: 9/04/2014 Add it to your project
  2. 2. Presenter: Biswajit Maji, Mindfire Solutions OCP – Oracle certified professional developer About Me Skills : Mysql, php, jQuery, html, VCS(svn, git), Webservices, Linux Connect Me: Facebook: https://www.facebook.com/biswajitmaji.tech LinkedIn: http://www.linkedin.com/profile/view?id=133902574 Google+: https://plus.google.com/105085556902166170611/ Contact Me: Email: biswajitm@mindfiresolutions.com / biswajitmaji.tech@gmail.com Skype: mfsi_biswajitm
  3. 3. Presenter: Biswajit Maji, Mindfire Solutions AGENDA  A short description of Gearman  Some real time problem we face  Installing Gearman Server  Installing PHP API  Gearman Worker code  Gearman Client code  Few most used Gearman client methods  Demo
  4. 4. Presenter: Biswajit Maji, Mindfire Solutions A short description of Gearman Open source application framework To distribute appropriate computer tasks to multiple computers So large tasks can be done more quickly Load balancing Parallel and asynchronous work Scales well Architecture-based workload distributing Fault tolerance using multiple server. It is an application framework to distribute work
  5. 5. Presenter: Biswajit Maji, Mindfire Solutions Some real time problem we face  Sending bulk email  Image resizing  Watermarking  Jobs using other language http://opentechlovers.wordpress.com/2013/12/17/ba ckground-processes-how-dangerous-it-could-be/ Problem we face in real time
  6. 6. Presenter: Biswajit Maji, Mindfire Solutions Installing Gearman Server in linux box As usual sudo apt-get install gearman-job-server Start gearman server: sudo gearmand -d The -d (--daemon) option causes the server to detach from the shell and run in the background. Want to know all available options: Gearmand -h [ --help ] Install gearman tool sudo apt-get install gearman-tools All available option gearman -h
  7. 7. Presenter: Biswajit Maji, Mindfire Solutions Installing php api If want to use pecl for installing gearman sudo apt-get install php-pear It may not be needed if following other way to install gearman php api. apt-get install libgearman-dev // used to configure internally apt-get install php5-dev // this is needed for phpize Install api pecl install gearman Finally add this in php.ini file extension="gearman.so"
  8. 8. Presenter: Biswajit Maji, Mindfire Solutions Gearman Worker code # Create our worker object. $gmworker= new GearmanWorker(); # Add default server (localhost). $gmworker->addServer(); # Register function "reverse" with the server. $gmworker->addFunction("reverse", "reverse_fn");
  9. 9. Presenter: Biswajit Maji, Mindfire Solutions Gearman Client code # Create our client object. $gmclient= new GearmanClient(); # Add default server (localhost). $gmclient->addServer(); # Send reverse job $result = $gmclient->do("reverse", "Hello!");
  10. 10. Presenter: Biswajit Maji, Mindfire Solutions Few most used Gearman Client methods addServer("10.0.0.2", 7003) addServers("10.0.0.1,10.0.0.2:7003") $client->addTask(string $function_name , string $workload [, mixed &$context [, string $unique ]]); $client->runTasks(); $client->addTaskBackground(); $client->addTaskHigh(); setCompleteCallback — Set a function to be called on task completion setCreatedCallback — Set a callback for when a task is queued setExceptionCallback — Set a callback for worker exceptions setFailCallback — Set callback for job failure setWarningCallback — Set a callback for worker warnings
  11. 11. Presenter: Biswajit Maji, Mindfire Solutions DEMO
  12. 12. Presenter: Biswajit Maji, Mindfire Solutions References http://gearman.org/ http://blog.zitec.com/2011/parallel-processing-with-php-and-gearman/ http://www.phpclasses.org/blog/post/108-Distributing-PHP-processing-with-G http://www.cirello.org/2012/05/scalable-architecture-with-gearman-job-server/ http://in3.php.net/manual/en/book.gearman.php
  13. 13. Presenter: Biswajit Maji, Mindfire Solutions Question and Answer
  14. 14. Presenter: Biswajit Maji, Mindfire Solutions Thank you
  15. 15. www.mindfiresolutions.com https://www.facebook.com/MindfireSolutions http://www.linkedin.com/company/mindfire-solutions http://twitter.com/mindfires
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×