简体   繁体   English

Hibernate缓存和MySql查询缓存

[英]Hibernate cache and MySql query cache

Caching is all about application performance optimization and it sits between your application and the database to avoid the number of database hits as many as possible to give a better performance for performance critical applications. 缓存全都与应用程序性能优化有关,它位于您的应用程序和数据库之间,以避免尽可能多的数据库命中次数,从而为性能关键型应用程序提供更好的性能。

I have ability to use Hibernate cache and MySql query cache . 我有能力使用Hibernate缓存MySql查询缓存

What mechanism should i choose ? 我应该选择什么机制? Or may be i should use both of them to rich maximum performance (and maximum RAM usage :D) ? 还是我应该同时使用它们来丰富最大的性能(和最大的RAM使用量:D)?

We have two ways of Cache in Hibernate. 我们在Hibernate中有两种缓存方式。

1) Memory (RAM) 1)内存(RAM)

2) Disk (HD) 2)磁盘(HD)

Since you are trying to save the RAM, please try to create the cache in the disk. 由于您要保存RAM,因此请尝试在磁盘中创建缓存。

Use the DiskStore option in the EnCache. 使用EnCache中的DiskStore选项。

<cache>
   <persistence strategy=”localRestartable|localTempSwap|none|distributed” synchronousWrites=”false|true”/>
</cache>

If you are using Java 7 and plus. 如果您使用的是Java 7及更高版本。

Go for BigMemory for the best performance. 选择BigMemory以获得最佳性能。

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

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