MidCOM caches don't take multiple databases/servers into account
-
Ala-Louvesniemi, Jarkko
MidCOM caches don't take multiple databases/servers into account
Wed July 21 2010 13:25:07 UTCContent cache is ok because for error pages and such it uses $GLOBALS['midcom_config']['cache_module_content_name'] which contains server name + prefix by default and for content pages it uses etag which is based on the content itself.
Also phpscripts cache is ok because it doesn't have a backend at all and writes to local filesystem. (MidCOM itself is local so local fs as cache is naturally ok there.)
But the memcache and nap caches... They just use keys where the prefix is e.g. "NAP-" or "ACL-" etc. When most of the data items have then keys based on object ids it means multiple databases/servers aren't taken into account.
There can be multiple Midgard databases on the same server. Different databases can have objects with same ids but they are obviously different objects with different data. Also if external memcached is used and there are multiple Midgard servers using the same memcached there also the same thing applies. (Well then there's also the fact that the same memcached can be used also for something else than Midgard and we don't use any prefix like "midgard" - not sure though if such is necessary.)
Perhaps we should add $GLOBALS['midcom_config']['cache_module_memcache_name'] and have the same default value for it as what $GLOBALS['midcom_config']['cache_module_content_name'] uses. Then we could add that to nap and memcache prefixes. So then prefixes in nap and memcache caches would be "NAP-IDENTIFIER-" and "ACL-IDENTIFIER-".
Or is there a better solution / should we fix this issue?
Is there something which needs to be taken into consideration regarding this? E.g. if the suggestion above is ok, is it so simple to implement (just add identifier to prefixes) or did I miss something?
Another but related issue: Of course the identifier could in theory be physical server name (instead of http service name) + database name (instead of site prefix) so that we would share as much data as possible but I wonder if that's possible to implement. (Not sure where to e.g. read the database name because mod_midgard doesn't use unified configuration.)
--
jval
_______________________________________________
dev mailing list
dev@lists.midgard-project.org
http://lists.midgard-project.org/mailman/listinfo/dev
