 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: Zend Job Queue
by Chris Cornutt January 13, 2012 @ 08:37:31
In this most recent post to PHPMaster.com Alex Stetsenko takes a look at the Zend Job Queue functionality, a part of the Zend Server installation. He talks about some basic usage to make HTTP requests and a more extended example showing report generation.
Web applications usually follow a synchronous communication model. However, non-interactive and long-running tasks (such as report generation) are better suited for asynchronous execution. One way to off-load tasks to run at a later time, or even on a different server, is use the Job Queue module available as a part of Zend Server 5 (though not as part of the Community Edition). Job Queue allows job scheduling based on time, priority, and even dependencies
In his two examples, he shows the code involved to create a new Queue object and define a HttpJob in it. The first just calls a "sample.php" script that's exposed as a part of your external-facing site and shows how you can get the current status of the job. The more advanced example shows a call to a "report.php" script with a set of options defining things like "type", "length" and "priority". He also points out some other options that can do similar things like Gearman, NodeJs and RabbitMQ.
voice your opinion now!
zend job queue zendeserver tutorial task status
Justin Carmony's Blog: PHP Workers with Redis & Solo
by Chris Cornutt January 11, 2012 @ 11:50:52
In this latest post to his blog Justin Carmony shares some of his experience using Redis and Solo to asynchronously run queries and return data without the user having to wait.
Sometimes there are situations when you want to parallel process things. Other times you might have a list of tasks to accomplish, and you don't want to make the user wait after pressing a button. This is where "Workers" can come in. They are independent scripts that run along side of your application, performing tasks, or "jobs."
Solo is a very basic Perl script that ensures only one process of a type is running at once. Using this and a PHP library called predis, he shows how to set up workers and add items to your processing queue. The workers themselves run on a cron job and connect to the queue server to see what they need to do. He also throws in some "bells and whistles" - extras that can enhance your worker system: queue monitoring, version numbering and killing workers based on a hash value.
His code examples are posted on his github account and a screencast is included in the post to show the system in action.
voice your opinion now!
redis solo cron tutorial queue worker
PHPMaster.com: Understanding the Command Design Pattern
by Chris Cornutt January 03, 2012 @ 08:25:29
On PHPMaster.com today there's a new article introducing you to the Command design pattern and looking to help you understand its use a bit better.
The majority of [cell phone] users have opted to receive an email, but a significant number are now opting to receive the notifications via SMS. Here's the problem: How do you send a message via two different channels to both groups of users? The logical approach would be to split the users into 2 groups, email recipients and SMS recipients, which would involve running 2 different queries and sending the codeword to each group separately. Using the Command Pattern, which I will introduce you to in this article, you can send the message to both groups of users in a single process.
He uses the message queue he mentioned as an example - showing how you can can queue up different kinds of objects (actions) based on a common interface into the same process. He creates a "DailyAlertEmail" and "DailyAlertSMS" classes, both with a "send" method. The settings for these are then pulled from a database and the "execute" method on the "MessageQueue" class is called to loop through them, calling "send" to do that work.
voice your opinion now!
command designpattern tutorial message queue sms email
Rasmus Lerdorf's Blog: ZeroMQ + libevent in PHP
by Chris Cornutt September 29, 2011 @ 11:45:39
Rasmus Lerdorf has a new post to his blog sharing the results of some "investigative hacking" he did to see if making ZeroMQ and libevent work together was difficult. Thankfully, the answer was "not hard at all".
While waiting for a connection in Frankfurt I had a quick look at what it would take to make ZeroMQ and libevent co-exist in PHP and it was actually quite easy. Well, easy after Mikko Koppanen added a way to get the underlying socket fd from the ZeroMQ PHP extension. To get this working, install the PHP ZeroMQ extension and the PHP libevent extension.
He includes a sample script show the results of his work, a basic server and client that sends a request to the ZeroMQ server and fires off an event using the libevent library (via PHP's extension. You can find out more about using these two libraries in the PHP manual - libevent and ZeroMQ
voice your opinion now!
zeromq libevent extension library queue example
Kevin Schroeder's Blog: Passing typed ActionScript objects to Flex using PHP and a message queue
by Chris Cornutt June 07, 2011 @ 08:20:12
Continuing on in his Flex and PHP series Kevin Schroeder has a new post to his blog today looking at how to send typed ActionScript objects to Flex so he could pass PHP objects and their structure directly back to the waiting frontend.
What I wanted to do was use the sales notification mechanism to pass PHP objects to Flex using the message queue. But I could not get the unserialization mechanism to work and so I had to settle for passing a simple message that a sale had been made. However, because you can pass typed objects back and forth between PHP and ActionScript over HTTP using Zend_Amf_Server I figured that there MUST be a way of doing it automatically.
He walks you through the steps to discovery that eventually got him to his end goal - making a simple valueObject class to use for the connection, a basic PHP script (using Zend_Amf) to parse the object's data and a bit of code to send it back to the waiting MQ queue via a Zend_Queue adapter.
voice your opinion now!
flex message queue actionscript object mq
Matthew Weier O'Phinney's Blog: Taming SplPriorityQueue
by Chris Cornutt January 18, 2011 @ 12:43:54
Matthew Weier O'Phinney has a new post to his blog today looking at one of the tools the Standard PHP Library (SPL) has to offer developers - the SplPriorityQueue (PHP 5.3+)
SplPriorityQueue is a fantastic new feature of PHP 5.3. However, in trying to utilize it in a few projects recently, I've run into some behavior that's (a) non-intuitive, and (b) in some cases at least, undesired. In this post, I'll present my solutions.
He talks about the "first in, first out" nature of queues and how it differs from a stack (including links to some of the other SPL offerings for both). He then moves into the problems he was seeing - that iteration removes values from the heap and the unexpected order of equal values in the queue. To solve the first problem, he creates an "outer iterator" that creates an "innerQueue" that's protected. The solution for the second issue - the random queue order - is a simple one: priority indexes aren't required to be integers. Strings can be substituted to help make things a bit more unique.
voice your opinion now!
splpriorityqueue heap stack queue spl tutorial iterate priority index
Kevin Schroeder's Blog: Could your PHP application benefit from asynchronous computing?
by Chris Cornutt October 05, 2010 @ 08:42:16
Kevin Schroeder has been conducting an informal poll about asynchronous computing in PHP applications and has posted some of the results (as well as the poll for those that didn't get their votes in) to his blog today.
Tis the season for Zendcon. I am going to be giving a talk at Zendcon called "Do You Queue". It will be about doing asynchronous computing in PHP. In order for me to gather some data I posted a twitpoll poll. The response has been pretty good. However, there have also been several misunderstandings as well.
He points out a few comments on the poll that talk about asynchronous processing being included in the language and dismiss it as something that other technology already does. He agrees that threads shouldn't be in PHP because it would break on of PHP's strongest features - the Shared Nothing architecture. Want to share your opinion? Vote on the poll and be heard!
voice your opinion now!
zendcon10 zc10 queue asynchronous poll results
Kevin Schroeder's Blog: How to (properly) evaluate Zend Server - Introduction
by Chris Cornutt September 01, 2010 @ 10:36:37
Kevin Schroeder has a new post to his blog today on how to correctly evaluate the Zend Server product from Zend (disclaimer: he is a Zend employee).
As you all probably know, Zend has salespeople. Those sales people have sales engineers who show how to use our products. However, I personally hate being on the phone for a canned presentation when all I really want to do is tinker. So, in an effort to produce something of benefit today I decided to start a series of blog posts on how to evaluate Zend Server if you are a tinkerer, like me.
He gives a list of some of the features that the product comes with, but will only really focus on three of them in his series - application monitoring, code tracing and the Zend Server job queue (because he thinks they're the best of the crop). This post is just an introduction to the product and an overview of what it offers - expect more detail to come in future posts.
voice your opinion now!
zendserver evaluate application monitoring code tracing queue
|
Community Events
Don't see your event here? Let us know!
|