Hey everyone,
Question for you on Drupal cache. Our new site, nhpr.org, is running on two servers to handle an increasing amount of traffic. The servers sync up their MySQL data instantly, so that if a user edits a node, the edit registers on both servers immediately. Problem is, Drupal's cache is getting in the way of this sync process, so if there's an edit made on the nodes the database data is indeed the same, but the site will display the old data on the second server, until I manually flush the cache.
We've disabled the main Drupal cache for now, but we don't expect that's a long-term solution. Anybody out there familiar with different cache options for a load-balancing server setup? If you'd rather e-mail me directly, that's cool too. bcarlson (at) nhpr dot org.
Comments
Separate db server?
It sounds like each server has its own copy of the site files and database server? Why not have them share a single database server, and the files directory as well? Hope this helps...
Yeah, that's one of the ideas
Yeah, that's one of the ideas we're looking at, as it would take that whole sync issue right off the table. I think only question was whether that setup would wind up hurting us in terms of the load balancing... which is well above my level of expertise. :)
Thanks so much for the reply!
Load balancing
I don't think so -- I have experience with a setup where we had a load balancer directing traffic to two web servers, and they shared a single database on a third box. The LB will just determine which of the two web servers handles the request, but either way, the database requests will go to the same db server. So database caching will be shared which sounds like just what you want.
The one issue you would have is the Drupal files directory, which includes javascript and css aggregated file caches (assuming you have those enabled), as well as any uploaded files, and you do want those shared between the servers. The solution we used was to set up an NFS mount on the third machine and have the two web servers mount it. This can be tricky with permissions, I suggest having your hosting provider help set this up and be sure to test all operations including reading and writing to the NFS mount on both servers.
But yes, this should be very doable and solve your problems -- good luck and let us know how it goes!
There are two types of mysql
There are two types of mysql scale out on the cheap.
One is to use DRBD to make a fault tolerant failover server with a shared IP. This is a good idea, but doesn't help with performance.
The other is to make one or more read-mostly slave servers. Mysql will handle synchronization of data to the slaves.
Combining the two requires three or more machine instances, scales, is fault tolerant, and mostly hands off once it is all running. I've set up and maintained a few. Shoot me and email sometime.