Load Balancing - Replication/Clustering?!

Hi All,

I'm just about to start putting together the architecture for what is going to be a big site. I am most likely going to need multiple servers to handle the traffic and keep page loads at respectable times.

I really want this setup to be scalable, a few options spring to mind...

1. Create LAMP servers and load balance.
I presume this would have to use mySQL master/master setup to allow all servers to read and write and would have to some how share the writable files/folders (config, files, packages)

2. Create 2 LA_P servers and have an off-box mySQL setup.
Slight concern about latency here.

3. Create LAMP servers and try to split out read and write connections to use master/slave setup on box... this would be my preferred option but not sure its possible using the current core setup (maybe a hack with ADO?)

Anyway, opinions very welcome!


View Replies:
Mainio replied on at Permalink Reply
As you said, separating read/write tasks is pretty hard "out of the box" at this stage with concrete5, so yes you'll need a hack if you want to do that.

This is how I would do:
- Multiple LA_P-setups that serve as the "application servers" with load balancing
- Centralized MySQL cluster with load balancing where each site connects to as "database servers"
- Centralized static assets server(s) that serves the static files (the files you mentioned), on each of the "application server" you need to have a custom add-on that will send the files to the static assets server as it is uploaded into the file manager, just grab on to the file events:http://www.concrete5.org/documentation/developers/system/events/...
* This way you don't have to replicate the whole files-directory on each of the application servers and you can basically have one location (that can possibly be replicated to its slaves).
* I'd have one "master" statics assets server that replicates the whole files directory for each of its slaves, if you have multiple of these

In concrete5 you can set the relative files path with this variables:
define('REL_DIR_FILES_UPLOADED', 'http://static.service.com/files/');

Depending on the level of traffic you're about to get, I'm not even sure whether you need more than one static assets servers. Also, if you're using links that have "download_file" in them, you'll need to re-write controllers/download_file.php in able for it to use the centralized file storage as well. (Redirect download calls to the static server and change the view_inline path to point there as well).

Other directories (packages, etc.) I would replicate with all the "application servers".

Yes, there is a bit of latency when connecting to the database server, but I'd keep the MySQL cluster within the same sub-network so that it would be quite minimal to connect to external database location. That way you can keep the latency in milliseconds. E.g. just checked out from one of our services that does this, it connects to the external database in 0.003 seconds with IP resolving and with plain IP 0.001 second).