Our cluster consists of 3 database servers (1 master, 2 slaves) running MySQL 5.5.15 (dual E5620, 32GB RAM, 12*15k RPM SAS drives in RAID6), 4+1 web backends (single X3440, 8GB RAM, 2*7k RPM SATA drives in RAID1), and a couple of other servers for serving static content and proxying the web backends with Varnish.
We're currently only running Coldfusion (or rather OpenBD) on top of Tomcat, so there's no existing PHP environment on the servers.
I understand that XenForo, at least for the time being, is unable to utilize the slave databases for read queries. We can forget about those then.
My questions at this point are:
- What would be the best way for setting up XenForo in a cluster of web servers, any of which can go offline at any given time for maintenance etc.? I'm currently considering using XCache for opcode cacing and a distributed & redundant memcached for session storage.
How about attachments? Is the attachment storage folder a configurable option, or should I just NFS mount the data and internal_data folders on all the backends?
- Are there potential pitfalls in the above setup? I.e. if sessions are stored in memcached, should/does XenForo care if requests are bounced around between different backends. I can't see why it would, but would be nice knowing beforehand if it does. =)
To begin with it wouldn't be a major headache having Xenforo on just one of the backends without any clustering. I don't see any chance of running into performance issues with our initial launch. Later after importing roughly over 5 million posts from our existing forums this could be an issue - especially once the search engine bots crawl in.
- Is there a way of preventing XenForo from creating sessions for guest users / robots? We employ Varnish quite extensively, and would like to do so with XenForo as well. The fact that the xf_session cookie is created and maintained for all visitors makes this rather unfeasible.
Of course I could just drop the Set-Cookie header in Varnish unless the request URL is /login/login, but I suspect that would cause XenForo to create orphan sessions on every single page load that hits the backend.
- How about detaching JS and CSS completely from XenForo? What I mean by this is the ability to serve CSS and JS from a separate server with no XenForo installed. Can this be done? I know JS, data and style images can be served from a separate URL, but I'm looking for a way of "pre-rendering" the CSS and serving it from a static server.
Even though it's not such a big issue nowadays, serving css files as "css.php?css=xenforo,form,public&style=1&dir=LTR&d=1365079688" can cause some proxies not to cache the content. More importantly loading the CSS through css.php prevents serving the CSS from a cookieless, CDN hosted domain.
Yes, the css.php sets expiry to 2020, but it's all about the first page load, empty cache experience.
All input, comments, feedback etc. is much appreciated!