Parallel PHP (HipHop) using TBB, Kiwi Style

I've been chatting with a small group of dedicated fans of Intel Threading Building Blocks (TBB)  in New Zealand.  They've been looking at adding parallelism, using TBB, to Wordpress, PHP, HipHop, Perl, and other open source projects.  They have published their code and some interesting results.  They have a web site http://openparallel.com explaining some of their work.

The PHP (HipHip) project, using TBB, is hosted at https://github.com/openparallel/hiphop-php

Their PHP wrapper has been primarily implemented as an extension for the HipHop PHP compiler. This provides a thread-safe compiled implementation of PHP 5.2 with a fairly comprehensive set of libraries.

Their first version includes:

parallel_for / parallel_for_array - provides the TBB parallel_for functionality with PHP arrays for input and output.

concurrent_vector - this PHP extension class wraps the TBB concurrent_vector and provides thread-safe access to a vector type collection.

concurrent_hash_map - this PHP extension class wraps the TBB concurrent_hash_map and provides thread-safe access to a hash collection keyed on any PHP type.

concurrent_globals - this function provides thread-safe, read-only access to the PHP global variables. (These are normally thread-local in HipHop, where a thread is typically associated with a web request).
Some PHPDoc documentation has been produced for these functions and ore is being worked on. They are also looking at conventional PHP extensions to enable application developers to run an application that uses TBB extensions in the conventional PHP interpreter for development and testing purposes. In this case, all operations will execute on a single thread. This would support single source.

They presented much of their early work in January at a conference in Australia. I couldn't swing visiting there myself, so I've resigned myself to occassional emails and phone calls to catch-up with them.

Here's what they've done that I've spoken with them about:

They made slight modifications to WordPress, to use a TBB-enabled HipHop they created - and they had VERY impressive results. The bigger surprise was the huge drop in memory footprint. They have theories why, but this seems to have been the leading reason for the higher performance. Sometime algorithm changes improve performance for unexpected reasons!  You can read their two short white papers on what they did:

http://openparallel.wordpress.com/2010/11/01/tbb-in-wordpress-%E2%80%93-white-paper/

and

http://openparallel.wordpress.com/2010/11/01/wordpress-on-hiphop-white-paper/

I know they interested in hearing from developers of like mind (wanting to add parallelism to open source projects) - but they really enjoy talking with projects that want help improving performance. Given their results with PHP/HipHop so far, they would seem to be worth contacting for such work.

Parallelism is worth adding in many places.  It's fun to see the results with PHP so far!

I know they are working on Perl too... I'll catch up with them on that work and write a blog next week with what I find.

 

Para obtener información más completa sobre las optimizaciones del compilador, consulte nuestro Aviso de optimización.