<?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>Fri, 24 May 2013 13:59:18 -0500</pubDate>
    <ttl>30</ttl>
    <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[UnixReview.com: PHP Multi-tasks]]></title>
      <guid>http://www.phpdeveloper.org/news/6352</guid>
      <link>http://www.phpdeveloper.org/news/6352</link>
      <description><![CDATA[<p>
From UnixReview.com, there's <a href="http://www.unixreview.com/documents/s=9521/ur0609g/ur0609g.htm">a handy guide</a> to functionality that PHP supports to help you get a handle on things like multiple socket requests - multi-tasking in PHP.
</p>
<blockquote>
<p>
There's quite a bit more to tell, though, about PHP and concurrency. AJAX certainly boasts multi-tasking capabilities, and PHP supports AJAX about as well as the other Web languages support Ajax. An easy conclusion is that, by way of AJAX, therefore, PHP multi-tasks. However, common security, accessibility, and compatibility requirements prevent use of AJAX in many programs.
</p>
<p>
It's also true that PHP does not "support threads", as many observers put it. Even without AJAX, even without threads, there are still at least two distinct ways to achieve server-side multi-tasking with PHP. Let's look at how the language multi-tasks, and why:
</p>
</blockquote>
<p>
They give an example of one way to fetch information from multiple sources normally (concurrent socket requests) to provide the "low level". They then <a href="http://www.unixreview.com/documents/s=9521/ur0609g/ur0609g.htm">show an example</a> of how to use pcntl_fork, pcntl_exec, and streams support that can be built into PHP to create a three process function to grab the main pages (and status codes) from each of the sites in an array. 
</p>]]></description>
      <pubDate>Tue, 26 Sep 2006 07:38:07 -0500</pubDate>
    </item>
  </channel>
</rss>
