<?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>Sun, 19 May 2013 21:40:07 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Ibuildings Blog: Boost performance with parallel processing]]></title>
      <guid>http://www.phpdeveloper.org/news/11798</guid>
      <link>http://www.phpdeveloper.org/news/11798</link>
      <description><![CDATA[<p>
On the Ibuildings blog today there's <a href="http://www.ibuildings.com/blog/archives/1539-Boost-performance-with-parallel-processing.html">a new post</a> from <i>Martin Roest</i> looking at parallel processing in PHP scripts and how it can help you with performance and simplifying your applications.
</p>
<blockquote>
The idea of parallel processing is when you take an atomic transaction or operation called a 'process' and run a couple of those at the same time. [...] In this example I had a PHP CLI script. The purpose of this script was to process remote documents and save it local. It fetched the document from a remote location, processed it and saved the result local - let's call this the transaction. Transactions were done sequentially. It took about 1 second for a transaction to complete and the script had to do roughly 3500 transactions.
</blockquote>
<p>
Obviously, this script/testing method was not very effective, so he went searching for an alternative. The best option came in the shape of forking processes - spawning off a separate script (via PHP's forking functionality) to do the work on one or multiple entries. It uses the <a href="http://php.net/pcntl_fork">pcntl_fork</a> and <a href="http://php.net/pcntl_waitpid">pcntl_waitpid</a> functions to spawn and manage these children. Once they're all finished - working in parallel - they return back to the main script to wait for the slower ones to catch up.
</p>]]></description>
      <pubDate>Fri, 23 Jan 2009 07:51:05 -0600</pubDate>
    </item>
  </channel>
</rss>
