XUL and MySQL Cluster at NYPHP

by David Sklar

XUL, for the uninitiated, is Mozilla's XML-based UI language. You build your (client-side) interface in XUL, wire the widgets together with JavaScript, and ta-da! You've got a standalone application.

The PHP connection comes in when using a JavaScript XML-RPC library to call an XML-RPC server (written in PHP, in this case) to provide dynamic info to your XUL app. (Yes, you too can write your own Gmail!)

I am curious to play around with XUL, but first I need to think of an app that I could experiment with building. (And why I should use XUL instead of PHP-GTK, I suppose.)

I know little enough about XUL and about IE to wonder if one could write an IE plugin that could understand and render XUL. That would dramatically increase the XUL potential-user base.

MySQL Cluster is a shared-nothing main memory database clustering technology that MySQL bought from a division of Ericsson. It removes that pesky single point of failure from the database portion of your architecture, but it's not a panacea -- if you've got a lot of data, you need a lot of RAM. In a given cluster, you can store (Nodes x Available-RAM-per-node / Redundancy-level) bytes of data.

For example, if you arrange your 10 nodes in redunancy pairs (each piece of data lives in two places, so "Redundancy-level" is 2), and each node has 4Gb of RAM, then your cluster can hold 10 x 4Gb / 2 = about 20Gb of data. It's "about 20Gb" because all 4Gb on each node isn't really available to MySQL Cluster -- the OS needs some RAM, too.

Future versions of MySQL Cluster will use memory as a disk-backed cache so your storage is bounded by available disk instead of available RAM.

After the meeting, I had an interesting conversation with Johan and Hans (who now works for MySQL) about accessing the NDB Cluster native API directly from PHP. This mode of communication with the cluster wouldn't have an SQL parser, so you'd have to do a bit more work to build queries. With the Cluster API, retrieving data is easiest as lookups on primary keys.

This structure would make the NDB Cluster an excellent session storage handler for PHP -- fast, reliable, and makes sharing data across load-balanced web server machines a snap. If you're looking for a neat PHP/C++ coding project, I think Hans and Johan would be happy to help out anyone who wanted to work on this.

Have you worked with XUL and/or MySQL Cluster?