Getting Started with Beanstalkd

I had a good experience implementing beanstalkd for the first time last week, so I thought I’d write down how that went and what I learned.

Why Beanstalkd?

My requirements were simply to add both asynchronous (for processing things like recalculating counts) and periodic (mostly for garbage collection) tasks to a PHP application. The application has a separate web application and backend API, both made of PHP’s Slim framework, and the API talks to MySQL. It’s all very lightweight and scalable, and I was looking for something to fit in with what we have, with good PHP support.

Enter beanstalkd, it’s a super-simple job queue and has great PHP support in the shape of Pheanstalk (I’m saving my PHP + beanstalkd examples for another day because this post would get too long to read otherwise!). I’ve used gearman in the past but beanstalkd seemed lighter, and when I started looking at their documentation I discovered that I had a working installation in about the time it would take me to fall off a log – which is always a good indicator of a tool that will be fun to work with :) Continue reading