<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 21 May 2013 06:17:59 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Wan Qi Chen: Background jobs with php and resque (Series, Parts 4, 5 & 6)]]></title>
      <guid>http://www.phpdeveloper.org/news/18618</guid>
      <link>http://www.phpdeveloper.org/news/18618</link>
      <description><![CDATA[<p>
<i>Wan Qi Chen</i> has returned with the next three parts in his "Background jobs with PHP and resque" series (first parts <a href="http://phpdeveloper.org/news/18581">here</a>) with parts four, five and six helping you implement the concepts from the first three parts.
</p>
<ul>
<lI><a href="http://www.kamisama.me/2012/10/12/background-jobs-with-php-and-resque-part-4-managing-worker/">Background jobs with php and resque: part 4, managing worker</a>
<li><a href="http://www.kamisama.me/2012/10/13/background-jobs-with-php-and-resque-part-5-creating-jobs/">Background jobs with php and resque: part 5, creating jobs</a>
<li><a href="http://www.kamisama.me/2012/10/16/background-jobs-with-php-and-resque-part-6-integration-into-cakephp/"> Background jobs with php and resque: part 6, integration into CakePHP</a>
</ul>
<p>
That sixth part of the series uses the <a href="http://cakeresque.kamisama.me/">CakeRisque</a> plugin to make the integration simpler. Save that, you could integrate this setup pretty easily into whatever framework you choose.
</p>]]></description>
      <pubDate>Wed, 17 Oct 2012 09:05:55 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Justin Carmony's Blog: PHP Workers with Redis & Solo]]></title>
      <guid>http://www.phpdeveloper.org/news/17378</guid>
      <link>http://www.phpdeveloper.org/news/17378</link>
      <description><![CDATA[<p>
In <a href="http://www.justincarmony.com/blog/2012/01/10/php-workers-with-redis-solo/">this latest post</a> to his blog <i>Justin Carmony</i> shares some of his experience using Redis and <a href="http://timkay.com/solo/solo">Solo</a> to asynchronously run queries and return data without the user having to wait. 
</p>
<blockquote>
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."
</blockquote>
<p>
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 <a href="https://github.com/nrk/predis">predis</a>, 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.
</p>
<p>
His code examples are posted on <a href="https://github.com/JustinCarmony/PHP-Workers-with-Redis-Solo-Examples">his github account</a> and a screencast is <a href="http://www.justincarmony.com/blog/2012/01/10/php-workers-with-redis-solo/">included in the post</a> to show the system in action.
</p>]]></description>
      <pubDate>Wed, 11 Jan 2012 11:50:52 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Wells' Blog: Kohana and Gearman - Practical Multitasking]]></title>
      <guid>http://www.phpdeveloper.org/news/16791</guid>
      <link>http://www.phpdeveloper.org/news/16791</link>
      <description><![CDATA[<p>
<i>Matthew Wells</i> has a new post that looks at <a href="http://www.ninjapenguin.co.uk/blog/2011/08/29/kohana-and-gearman-practical-multitasking/">combining Kohana and Gearman</a> to create a system to handle large data processing without slowing down the rest of the application.
</p>
<blockquote>
A commonly identified bottleneck arises when dealing with large, 'expensive' data. This is commonly seen when an application posts a large volume of well structured data to the API (that some process must be carried out upon), before some form of structured receipt is then returned as a request response. [...] Analysing such a request tends to show high PHP CPU usage with lower database consumption. [...] The structured nature of data exchanged via an API means that we can, relatively simply and reliably, divide the submitted data and process it simultaneously with the help of a great tool called Gearman.
</blockquote>
<p>
He walks you through the entire process including his initial thoughts on what the system should be and how it should behave when the requests are made. He <a href="https://github.com/ninjapenguin/AntFarm/blob/master/application/classes/controller/farmable.php">shares the code</a> he used to implement the system - a simple worker that processes part of the request and returns the results. The command-line calls to run the worker manually for testing are also included.
</p>]]></description>
      <pubDate>Tue, 30 Aug 2011 11:39:11 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Watermarks in our images with PHP and Gearman]]></title>
      <guid>http://www.phpdeveloper.org/news/16007</guid>
      <link>http://www.phpdeveloper.org/news/16007</link>
      <description><![CDATA[<p>
<i>Gonzalo Ayuso</i> had <a href="http://phpdeveloper.org/news/15975">previously shown</a> how to dynamically add watermarks to your images with the help of a mod_rewrite rule. One of the side effects of this is that, with a high load on your server, things can get bogged down quite quickly. His alternative? Add the watermarks to your images <a href="http://gonzalo123.wordpress.com/2011/03/07/watermarks-in-our-images-with-php-and-gearman/">with Gearman</a> workers.
</p>
<blockquote>
In this second solution I will use a <a href="http://gearman.org/">gearman</a> worker to generate the watermarks. The benefits of <a href="http://gearman.org/?id=gearman_php_extension">gearman</a> is the possibility of use a <a href="http://www.php.net/manual/en/gearmanclient.addserver.php">pool</a> of workers. We can add/remove workers if our application scales. Those workers can be placed even at different hosts, and we can swap easily from one configuration to another.
</blockquote>
<p>
He includes some sample scripts to illustrate the process - a Gearman client that'll call the watermarking process and a worker that takes in the image and transforms it with GD to add a new layer for the watermark.
</p>]]></description>
      <pubDate>Mon, 07 Mar 2011 12:12:17 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lorna Mitchell's Blog: Using Gearman from PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/15912</guid>
      <link>http://www.phpdeveloper.org/news/15912</link>
      <description><![CDATA[<p>
<i>Lorna Mitchell</i> has a new post today about using a popular backend processing tool, <a href="http://www.lornajane.net/posts/2011/Using-Gearman-from-PHP">Gearman</a>, from inside of PHP. Her example gives a <a href="http://www.lornajane.net/posts/2011/Using-Gearman-from-PHP">full overview</a> of how to add a new job and write the worker for it to make things happen.
</p>
<blockquote>
Basically, this application generates some PDFs from a variety of data sources, makes images, and emails it. Since the whole data processing, image handling, PDF generation process is fairly heavy, I'm putting the requests to generate these onto a gearman queue and having some workers process the jobs.
</blockquote>
<p>
You'll need to have the Gearman server and extension installed (<a href="http://www.lornajane.net/posts/2011/Installing-Gearman-for-PHP-and-Ubuntu">sample instructions here for Ubuntu</a>) to use the sample code she gives using the Gearman_Client and GearmanWorker objects to create the pieces of the puzzle. You can find out more about the Gearman PECL extension <a href="http://pecl.php.net/package/gearman">here</a>.
</p>]]></description>
      <pubDate>Wed, 16 Feb 2011 09:51:07 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ibuildings techPortal: Doing the Heavy Lifting: Gearman and Magento]]></title>
      <guid>http://www.phpdeveloper.org/news/15754</guid>
      <link>http://www.phpdeveloper.org/news/15754</link>
      <description><![CDATA[<p>
New from the Ibuildings techPortal today, there's a tutorial from <i>Michael Davey</i> looking at <a href="http://techportal.ibuildings.com/2011/01/17/doing-the-heavy-lifting-gearman-and-magento/">using Gearman with Magento</a> to do some of the "heavy lifting" of queuing jobs from inside the tool.
</p>
<blockquote>
With most web applications, there comes a time where there is a need to perform either CPU or I/O intensive work based on user actions. Whether processing uploaded files, or performing system-wide database updates, developers are increasingly turning to <a href="http://www.gearman.org/">Gearman</a> as a simple way to hand off the heavy lifting to another server to be performed asynchronously.
</blockquote>
<p>
He's created a <a href="https://github.com/ibuildings/Magento-Gearman-Module/tree/Version_1_0_0">basic module</a> that can be downloaded and dropped right into your Magento install to make it work with your Gearman queues. He includes an installation guide and a bit of code on how to make a sample job to run an event and the class sitting on the other side for the worker to use in handling it.
</p>]]></description>
      <pubDate>Mon, 17 Jan 2011 14:09:38 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: Writing Gearman Workers in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/14476</guid>
      <link>http://www.phpdeveloper.org/news/14476</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> has <a href="http://weierophinney.net/matthew/archives/240-Writing-Gearman-Workers-in-PHP.html">a new post today</a> about creating <a href="http://gearman.org/">Gearman</a> workers in PHP to be able to handle some of the more complex functionality they want surrounding the <a href="http://framework.zend.com">Zend Framework</a>.
</p>
<blockquote>
We're looking at migrating to Git for our primary development on the framework. There are a lot of use cases we need to accommodate [...] Git allows you to define "hooks", scripts that are run at various points of the git commit lifecycle. One hook that can run on the server is called "post-receive". [...] And now we get to Gearman. I realized I could have my post-receive script queue a background task to Gearman. Since this is almost an instantaneous operation, it meant that my hook was completed before Gearman started a worker; if it wasn't, I could always do a sleep() within my worker to ensure it was. 
</blockquote>
<p>
He uses the <a href="http://pecl.php.net//package/gearman">gearman PECL extension</a> to interface with the Gearman backend service and shows how to push off his post-recieve and rss processes to be handled separately from the current process. He includes the PHP code for both of these processes as well as the actual worker process.
</p>]]></description>
      <pubDate>Fri, 07 May 2010 08:11:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Content with Style: PHP worker processes with Beanstalk and Daemontools]]></title>
      <guid>http://www.phpdeveloper.org/news/14283</guid>
      <link>http://www.phpdeveloper.org/news/14283</link>
      <description><![CDATA[<p>
On the Content with Style blog there's a new post looking at <a href="http://www.contentwithstyle.co.uk/content/php-worker-processes-with-beanstalk-and-daemontools">creating a worker process</a> with PHP and the help of two other tools - <a href="http://kr.github.com/beanstalkd/">Beanstalkd</a> and <a href="http://cr.yp.to/daemontools.html">Daemontools</a>.
</p>
<blockquote>
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. 
</blockquote>
<p>
The technique uses beanstalkd as a messaging queue to handle the requests based on the user's request via the interface the <a href="http://kr.github.com/beanstalkd/">beanstalkd library</a> provides. Then, to keep the queue running in the background and available, he uses daemotools to run a worker process. You can <a href="http://www.contentwithstyle.co.uk/resources/queue_test.zip">download the complete code</a> for a working example.
</p>]]></description>
      <pubDate>Thu, 01 Apr 2010 10:11:49 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Brian Moon's Blog: Apache Worker and PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/9641</guid>
      <link>http://www.phpdeveloper.org/news/9641</link>
      <description><![CDATA[<p>
In a <a href="http://doughboy.wordpress.com/2008/02/13/apache-worker-and-php/">recent post</a> to his blog, <i>Brian Moon</i> talks about the experience he's had with using PHP on Apache 2 with a <a href="http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2">threaded MPM</a> at Dealnews.com.
</p>
<blockquote>
Well, first, what is an MPM? It stands for Multi-Processing Module. [...] The most commonly used threaded MPM is the Worker MPM. In this MPM, you have several processes that run multiple threads within it. This is the one I will be talking about.
</blockquote>
<p>
He <a href="http://doughboy.wordpress.com/2008/02/13/apache-worker-and-php/">goes on</a> to describe the "huge memory savings" that using the module got them - using the worker process to increase the child capacity of the Apache instance. He recommends keeping it simple when compiling a server to work with the worker functionality and mentions  how it can also help with serving static pages right along side the dynamic ones (without a second server!).
</p>
<p>
Check out <a href="http://doughboy.wordpress.com/2008/02/13/apache-worker-and-php/">the post</a> for a few more tips.
</p>]]></description>
      <pubDate>Fri, 15 Feb 2008 08:43:00 -0600</pubDate>
    </item>
  </channel>
</rss>
