• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Gearman Add To Your Project
 

Gearman Add To Your Project

on

  • 265 views

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

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

Statistics

Views

Total Views
265
Views on SlideShare
264
Embed Views
1

Actions

Likes
0
Downloads
2
Comments
0

1 Embed 1

http://www.slideee.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Gearman Add To Your Project Gearman Add To Your Project Presentation Transcript

    • An application framework to distribute work Presenter: Biswajit Maji, Mindfire Solutions Date: 9/04/2014 Add it to your project
    • 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
    • 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
    • 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
    • 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
    • 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
    • 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"
    • 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");
    • 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!");
    • 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
    • Presenter: Biswajit Maji, Mindfire Solutions DEMO
    • 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
    • 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 http://twitter.com/mindfires