Using HTTPRL for Parallelization: PHP Multitasking Without Forking With stream_select()

Did you know that PHP comes with a very powerful function called stream_select()? In short it's a wrapper for the select() system call. This allows for synchronous I/O multiplexing, or in sudo-code, a way to read multiple input/output streams without blocking; only selecting streams that are ready for I/O. In English this means that you can do parallel work from a single PHP thread without forking (forking a process is slow and complex in PHP). In this talk at the High Performance Drupal meetup at Droplabs (http://groups.drupal.org/node/223324) on May 1, 2012, Mike Carper (@mcarper) will be going over some code called the HTTP Parallel Request & Threading Library — or HTTPRL in short. Using PHP's stream_select() HTTPRL can send http requests out in parallel. These requests can be made in a blocking or non-blocking way. Blocking will wait for the http response; Non-Blocking will close the connection not waiting for the response back. Non-Blocking requests are what make this better in comparison to cURL, better control over redirects is the other reason. This talk was recently given as PHP Multitasking Without Forking at LinuxFest Northwest 2012 and the topic is further described by cotto in the High Performance group at http://groups.drupal.org/node/226054

More episodes of Los Angeles Drupal

Featured episodes in Tech & Gadgets

Los Angeles Drupal

Videos of meetings, presentations, tutorials and more from the Drupal user groups in and around Los Angeles, including http://groups.drupal.org/la, http://groups.drupal.org/downtown-los-angeles and http://groups.drupal.org/san-gabriel-valley