News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell:
Working with PHP and Beanstalkd
March 06, 2014 @ 10:36:53

Lorna Mitchell has posted a new tutorial to her site today walking you through using Beanstalkd with PHP for a simple queuing setup in your application. Beanstalkd is "a simple, fast work queue. Its interface is generic, but was originally designed for reducing the latency of page views in high-volume web applications by running time-consuming tasks asynchronously."

I have an API backend and a web frontend on this project (there may be apps later. It's a startup, there could be anything later). Both front and back ends are PHP Slim Framework applications, and there's a sort of JSON-RPC going on in between the two. The job queue will handle a few things we don't want to do in real time on the application, such as: updating counts of things like comments, [...] cleaning up, [...] other periodic things like updating incoming data/content feeds or talking to some of the 3rd party APIs we use like Mailchimp and Bit.ly.

She starts with a look at how to add jobs to the queue (she assumes that you've already set up the Beanstalkd instance at this point). She uses the Pheanstalk library for the job handling and includes a sample call to configure the connection and create an instance to make the connection. The sample job contains an array of data including an "action" and "data" for it to use when processing. She also includes an example of a basic PHP-based Beanstalkd worker that will go through currently pending jobs and execute them based on the action/data combination. In the sample worker script, she defines the action as a method in the class to be executed directly on the worker instance. She finishes off the post with a few "things to remember" about working with workers and long-running PHP scripts.

0 comments voice your opinion now!
beanstalkd tutorial introduction pheanstalk worker

Link: http://www.lornajane.net/posts/2014/working-with-php-and-beanstalkd

SitePoint PHP Blog:
Message Queues Comparing Beanstalkd, IronMQ and Amazon SQS
January 08, 2014 @ 10:37:35

The SitePoint PHP blog has a new post looking at using message queues in PHP. More specifically it compares a few of the different solutions out there and their advantages/disadvantages - Beanstalkd, IronMQ and the Amazon SQS.

This article introduces the concept of message queues and discusses the strengths and weaknesses of three specific message queue services: Beanstalkd, IronMQ and Amazon SQS. [...] Queues allow you to store metadata for processing jobs at a later date. They can aid in the development of SOA (service-oriented architecture) by providing the flexibility to defer tasks to separate processes. When applied correctly, queues can dramatically increase the user experience of a web site by reducing load times.

He starts with some of the overall benefits and downfalls of using a queueing system in your application, including some common use cases. From their he breaks it up into sections, in each talking about the option and how it differs from the others:

  • Services
  • Server setup
  • Service Level Agreements (SLAs)
  • Architecture
  • Client libraries
  • Management interface
  • Redundancy
  • Security
  • Speed
  • Fidelity
  • One-time pickup

...and many, many more. If you're looking for a good, complete overview of how these three options compare on a wide range of features and configurations, definitely check out this post. It even includes some PHP close to the end to make the connections to each and send/receive messages.

0 comments voice your opinion now!
message queue compare beanstalkd ironmq amazonsqs advantage disadvantage tutorial

Link: http://www.sitepoint.com/message-queues-comparing-beanstalkd-ironmq-amazon-sqs/

Content with Style:
PHP worker processes with Beanstalk and Daemontools
April 01, 2010 @ 10:11:49

On the Content with Style blog there's a new post looking at creating a worker process with PHP and the help of two other tools - Beanstalkd and Daemontools.

Sometimes things just get too heavy for a straight forward approach. Memory usage might be too high or interaction might be delayed. In this case it might make sense to queue the task up for later execution.

The technique uses beanstalkd as a messaging queue to handle the requests based on the user's request via the interface the beanstalkd library provides. Then, to keep the queue running in the background and available, he uses daemotools to run a worker process. You can download the complete code for a working example.

0 comments voice your opinion now!
worker daemon process beanstalkd daemontools



Community Events





Don't see your event here?
Let us know!


interview release unittest api podcast testing wordpress library developer threedevsandamaybe application list laravel language install community code series introduction configure

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework