Behind the Site »

Zend - The PHP Company

Zend Platform Job Queues In-Depth

Additional Products:
Zend Core |
Zend Studio |
Zend Guard

Job Queues is an approach to streamline offline processing of PHP scripts. Job Queue Server provides the ability to reroute and delay the execution of PHP scripts that are not essential during user interaction with the Web Server. Job Queues improve the response time during interactive web sessions and utilizes unused resources.

Basically, each server in your cluster can contain a Queue which would be functioning as a container for Jobs. You can view the state of a Queue such as number of completed successfully jobs, number of failed jobs, number of recurring jobs, number of dependent jobs and so forth. Additionally, statistics about the jobs are displayed as well, such as average wait time per job, number of requested jobs, and more. It is also possible to Suspend or Resume a Queue which controls the execution of new Jobs entered into the queue.

The task of adding a new Job is simple & intuitive and it can be done using the UI. It is possible to set the Job priority, application name and script file to be executed. It is also possible to make the Job dependent on another Job and to set the scheduling data per the Job – the Job can run immediately or at a certain time in the future. Additionally, the Job can be recurring so that it can be executed infinitely.

The Job Queues feature has a full programmatic API that allows access to all of its functionality.

Zend Platform Job Queues
              View screenshot


How Job Queues Works:

Whenever the Job Queues feature is enabled, the Job Queue Daemon is run on each of the servers in the cluster. The Job Queue Daemon acts as the execution unit behind the Job Queues feature. When a new Job is added to a Queue, its attributes (name, priority, application ID, etc.) as well as its dependency and scheduling data are stored in Zend Platform database. Each Job is also inserted into the Queue which is the logical container for the Jobs. The Job Queues Daemon is responsible for updating the status of each Job and for checking whether the actual status of a Job requires additional operations, such as Job execution. For instance, if a Job's scheduled time has arrived, or if a Job’s dependency conditions are met, the daemon starts execution of the Job, runming the PHP script which is associated with the Job, i.e. it runs the PHP script which is associated with the Job. Additionally, it also catches the output of the Job’s execution. The ability to centrally configure the Jobs and Queues all across the cluster is obtained thanks to the ability of the Job Queues Daemon to communicate, in both directions, with the Job Queues UI, located on the Central server.
White Paper: Scalability and Responsiveness with Zend Platform's Job Queue

Return to the Features page