I maintain a custom built CMS-like application.
Whenever a document is submitted, several tasks are performed that can be roughly grouped into the following categories:
- MySQL queries.
- HTML content parsing.
- Search index updating.
Category 1 includes updates to various MySQL tables relating to a document's content.
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.
Category 3 includes updates to a simple MySQL-based search index using just a handful of fields corresponding to the document.
All of these tasks need to complete for the document submission to be considered complete.
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.
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.
What is your favorite PHP performance profiling tool?