I'm dealing with Hibernate 6 in combination with Ehcache 3 and Spring Boot 3 for quite a time now and I'm wondering, if there is any recommended maximum number of 2nd level cache regions?
All documentations as well as code examples are more or less happy path instructions without any further recommondentations on sizes or numbers. Of course I know that in the end you always have to analyze the running system in production, but I would appreciate to know if there are some recommendations one should follow.
- What is the usual size of regions on the offheap (1, 10, 20MB, ...)?
- What is the usual number being set for the heap (100, 1000, ...)?
- Having tables with limited but often used records, should I have them all cached (with 1MB offheap and 10 heap)?
- Are there any downsides having many cache regions (10, 30, 50, 100, ...)?
- What is really important to consider I haven't on my radar yet?
Since Hibernate dehydrates the Objects down to a minimum of storage size I sometimes think that the chosen values of some examples are way out of senseful settings, but who am I to decide. Therefore, I'm looking for real world answers which I can extrapolate for my usecases.
Many thanks for any information.