as Brian knows, this is something I have been working on for a little while - and now have a very nice working infrastructure, running pretty much what Dave Barter explained.
This comprises of;LOAD BALANCER
: I have used a product called UltraMonkey 3 (http://www.ultramonkey.org/3/
) to provide the load balancing for the web servers. You can configure this for a "persistent" connection, which allows each user to continue accessing the same webserver they originally connected to during a session (which is important when you have users signing on and assigned a "session")WEB SERVERS
: At the moment I have three Apache webservers running behind the LOAD BALANCER, each ensuring they have the same Apache configuration and file loaded onto them - this can be acheived by either RSYNC -or- a better solution that I have found is something called SSHFS - this allows you to mount drives between Linux clients via SSH (a much securer solution)DB SERVERS
: I have two MySQL servers as well (ran out of boxes
) which are running MySQL in a Master-Slave configuration. These servers also have the UltraMonkey software installed on them as well, which allows me to load balance the queries to them (a kind of intelligent round-robin). I have also configured the MySQL tables to run InnoDB, rather than the default MyISAM, mainly to ensure that any locking on the tables are done on a per record basis rather than a whole table basis.HACKING
: As Dave correctly points out, there is an issue when it comes to writing records to the databases. In the Master-Slave configuration, all writes *MUST* be done to the Master, and not the Slave. This means that a hack was required of Joomla! What I did was to create a "Cluster DB Write
" parameter, within the Global Configuration Admin Screen, which points Joomla! to the IP address of the Master MySQL Server. This now allows all reads to be clustered, and writes to be directed to the Master.
The records are synced between the MySQL cluster in about 2-3 seconds - this could be longer in a larger cluster, but acceptable. There is a better method of clustering mysql, but this involves moving the whole of the database into memory, which is fine for smaller sites - not so good for larger ones (this is called the MySQL NDB Storage Engine).
The hack also allows you to sign onto the backend and work as normal, using the persistent option within UltraMonkey, without being moved from server-to-server within the cluster. Again, all writes are directed towards to the Master DB - via the new configuration parameter.CURRENT STATUS
: I am currently in the process of writing this all up into an article, a HOWTO, but am also continuing the testing of the solution. There are still some issues to iron out, such as caching, session information, document management systems and the speed of uploaded file replication between clustered webservers, etc. that need to be ironed out.
However, it does work using opensource tools - and I have ran load stress tools against the solution (vs a standalone of the same site), and it does give significant improvements. I will also provide a Proof of Concept (PoC) to the rest of the core team, when I have finished documenting and testing, to see whether the hacks are good enough to include into the core in future versions (not guaranteed as the inclusion process is fairly rigorous now - for good reason
Hopefully this shows you that it can be done, and a pointer to the technologies that could be used - I will of course try and get the article finished as quickly as possible.
Hard work never killed anyone, but why take the chance?http://www.troozers.com