Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can hibernate's hibernate.cache.use_structured_entries do?

<property name="hibernate.cache.use_structured_entries">true</property>

What can it do?I don't know? Please give an example!

like image 880
ketayao Avatar asked Dec 26 '22 18:12

ketayao


1 Answers

From Hibernate Docs - Chapter 3. Configuration:

Forces Hibernate to store data in the second-level cache in a more human-friendly format. e.g. true|false

It specifies whether entries will be written in a readable format or not in the L2 cache. You probably should turn it on if you plan to browse through the cache.

From Hibernate Docs - Chapter 19. Improving performance :

To browse the contents of a second-level or query cache region, use the Statistics API: <code ommited> You will need to enable statistics and, optionally, force Hibernate to keep the cache entries in a more readable format:
hibernate.generate_statistics = true
hibernate.cache.use_structured_entries = true

Setting the parameter to true will generate some overhead in the L2 cache. Seemingly, it cannot be turned off in a clustered environment, because the overhead is needed to rehydrate entities in such a scenario.

You might find the following blog post particulary helpful on this matter: Hibernate Wars: The Query Cache Strikes Back, particularly the Bonus: L2 Cache Reduction section.

like image 93
Xavi López Avatar answered Dec 30 '22 09:12

Xavi López