Polyglot Background Jobs with Gearman, PHP, Ruby & Node.js

This post is over 5 years old and is probably out of date.

Over on the Engine Yard Blog I wrote about a topic near-and-dear to my heart: Gearman.

For those that don’t know, Gearman is a simple C-based job queue server, that allows you to schedule jobs for other processes (called workers) to pick up and complete, either synchronously, or [usually] asynchronously. It can also be connected to via a number of clients in a bunch of different languages, not just PHP.

I’ve used Gearman for about 4 years, but have never had the opportunity to use it in a multi-language environment. So, I took the time to explore both Ruby and Node.js Gearman clients, and put together a multi-language example for this document. Using PHP for the client, Ruby for the workers, and Node.js for a status check poll.

What’s awesome is that any part of that could have been written in either of the other languages, or indeed in Python, C, Java, Perl — heck, I could’ve used MySQL or PostgreSQL!

I’ve always loved that this was a possibility, and it was great fun to actually put it into practice: even if only for a demo.

If you want to read about it, go checkout Polyglot Background Jobs on the Engine Yard Blog.