title: How do you make good use of multicore CPUs in your PHP/MySQL applications?
body: <p>I maintain a custom built CMS-like application.</p>
  
  <p>Whenever a document is submitted, several tasks are performed that can be roughly grouped into the following categories:</p>
  
  <ol>
  <li>MySQL queries.</li>
  <li>HTML content parsing.</li>
  <li>Search index updating.</li>
  </ol>
  
  <p>Category 1 includes updates to various MySQL tables relating to a document's content.</p>
  
  <p>Category 2 includes parsing of HTML content stored in MySQL LONGTEXT fields to perform some automatic anchor tag transformations. I suspect that a great deal of computation time is spent in this task.</p>
  
  <p>Category 3 includes updates to a simple MySQL-based search index using just a handful of fields corresponding to the document.</p>
  
  <p>All of these tasks need to complete for the document submission to be considered complete.</p>
  
  <p>The machine that hosts this application has dual quad-core Xeon processors (a total of 8 cores). However, whenever a document submits, all PHP code that executes is constrained to a single process running on one of the cores.</p>
  
  <p>My question: </p>
  
  <p>What schemes, if any, have you used to split up your PHP/MySQL web application processing load among multiple CPU cores? My ideal solution would basically spawn a few processes, let them execute in parallel on several cores, and then block until all of the processes are done.</p>
  
  <p>Related question:</p>
  
  <p>What is your favorite PHP performance profiling tool? </p>