简体   繁体   English

Hibernate中的分布式查询缓存

[英]Distributed Query Caching In Hibernate

Can we maintain consistency in query caches across multiple nodes? 我们可以在多个节点之间保持查询缓存的一致性吗? Or else I should just drop the idea of using query cache in a distributed architecture? 否则我应该放弃在分布式体系结构中使用查询缓存的想法?

If you are referring to MySQL's Query cache, then NO. 如果您指的是MySQL的查询缓存,则为否。 It is unavailable in Galera cluster and Group replication -- for good reason. 有充分的理由,它在Galera群集和组复制中不可用。 The maintenance of it far outweighs the benefit. 它的维护远远超过了收益。

If you are referring to some other caching, I would probably advise against it, for much the same reasons. 如果您提到其他缓存,出于同样的原因,我可能建议不要这样做。

If you would like to explain what you are doing, we can discuss further. 如果您想解释自己在做什么,我们可以进一步讨论。

The better alternatives: 更好的选择:

  • Speed up queries via better indexing, schema design, query formulation, etc. 通过更好的索引,方案设计,查询表述等方式加快查询速度。
  • Rethink other things that lead to slowdowns. 重新思考导致减速的其他因素。

That is, focus on making the system fast enough not to need a distributed cache. 也就是说,专注于使系统足够快而无需分布式缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM