Multiple Server Balanced Implementation (Cache & rsync issue)
Permalink 1 user found helpful
Hi,
We have a customer who requires Concrete5 to be load balanced across two physical servers.
We have a load balanced domain and also two subdomains setup to access each server individually. We have an rsync process running every min to copy files from the primary server to the secondary which is working great for uploaded images and code drops etc..
What I have found is that if I included the cache folder in the rsync process any traffic to the secondary server causes the cache files to be rebuilt.. which takes around 10seconds. So at the moment I have excluded these from rsync and performance is great, just the user experience from a CMS point of view is rather confusing and slow, as changes on server1 aren't being replicated on server2 without a full cache flush on server2.
We have built a script that clears the cache on both servers, but ideally we can configure things to just work.
We definitely need cache enabled, is there any proper guidelines on setting up the cache in a multi server environment? Is there a way I can get the cache files that are generated on server1 to also be valid on server2?
I've found some posts on the net around moving the cache to a memcache server, which sounds like an ideal solution. But want to explore all options first.
Any help would be greatly appreciated.
We have a customer who requires Concrete5 to be load balanced across two physical servers.
We have a load balanced domain and also two subdomains setup to access each server individually. We have an rsync process running every min to copy files from the primary server to the secondary which is working great for uploaded images and code drops etc..
What I have found is that if I included the cache folder in the rsync process any traffic to the secondary server causes the cache files to be rebuilt.. which takes around 10seconds. So at the moment I have excluded these from rsync and performance is great, just the user experience from a CMS point of view is rather confusing and slow, as changes on server1 aren't being replicated on server2 without a full cache flush on server2.
We have built a script that clears the cache on both servers, but ideally we can configure things to just work.
We definitely need cache enabled, is there any proper guidelines on setting up the cache in a multi server environment? Is there a way I can get the cache files that are generated on server1 to also be valid on server2?
I've found some posts on the net around moving the cache to a memcache server, which sounds like an ideal solution. But want to explore all options first.
Any help would be greatly appreciated.
I have been running with define('REDIRECT_TO_BASE_URL', false); but when you rsync these cache files to server2 it definitely doesn't like them.
I also tried some other options which I found in the documentation.
http://www.concrete5.org/documentation/developers/system/caching/...
http://framework.zend.com/manual/en/zend.cache.html...
$backendOptions = array('file_locking' => FALSE);
$frontendOptions = array('cache_id_prefix' => 'randomID');
define('CACHE_BACKEND_OPTIONS', serialize($backendOptions));
define('CACHE_FRONTEND_OPTIONS', serialize($frontendOptions));
Which didn't seem to improve thing at all... Best thing was to add --exclude "files/cache/*" to the rsync crontab
The other article I found is here:http://www.concrete5.org/community/forums/customizing_c5/caching-is...
Which goes over memcache, but I'm sure there must be a way to get the zend files to work in both locations...
I also tried some other options which I found in the documentation.
http://www.concrete5.org/documentation/developers/system/caching/...
http://framework.zend.com/manual/en/zend.cache.html...
$backendOptions = array('file_locking' => FALSE);
$frontendOptions = array('cache_id_prefix' => 'randomID');
define('CACHE_BACKEND_OPTIONS', serialize($backendOptions));
define('CACHE_FRONTEND_OPTIONS', serialize($frontendOptions));
Which didn't seem to improve thing at all... Best thing was to add --exclude "files/cache/*" to the rsync crontab
The other article I found is here:http://www.concrete5.org/community/forums/customizing_c5/caching-is...
Which goes over memcache, but I'm sure there must be a way to get the zend files to work in both locations...
Do you know that the cached files are definitely getting moved by rsync? I only mention this as I cannot sync C5 cache files via DropBox. My guess is the filenames are the problem in that scenario.
Yip fairly confident that the files are being transferred when I allow them to..
But at the moment I have the cache folder excluded so it doesn't cause a cache rebuild on server2...
That seems strange about DropBox.. I wouldn't imagine files would be excluded like that..
But at the moment I have the cache folder excluded so it doesn't cause a cache rebuild on server2...
That seems strange about DropBox.. I wouldn't imagine files would be excluded like that..
If you set both to use the same domain and the set the redirect to base URL constant to false this "might" generate cache files the same on both servers.
Let us know, I'm looking at using rsync too so v interested.