Gearman is a lightweight, high-performance solution for farming out processing work from one machine to another. I’m currently looking at using Gearman as a key part of the architecture of a new web API that I’m doing the R&D for. (I’ll go into why I need something like this, and why I’ve chosen Gearman in particular, another day).
Getting Gearman up and running on Ubuntu 9.10 (Karmic Koala) is very straight-forward and only takes a few minutes, but oddly not clearly documented on Gearman’s own wiki at the time of writing.
- Add “ppa:gearman-developers/ppa” as a software source.
- sudo apt-get install gearman-job-server
- sudo apt-get install libgearman-dev
- sudo apt-get install uuid-dev
- pecl install “channel://pecl.php.net/gearman-0.6.0”
- Add a gearman.ini to /etc/php5/conf.d, with “extension=gearman.so” as the contents
- sudo /etc/init.d/apache2 restart
- Check phpinfo() to make sure gearman extension loaded
You’ll find that the gearmand process is already up and running, and listening on port 4730 on localhost. All you need to do now is to write some code to take advantage of it 🙂