oracle / coherence

Oracle Coherence Community Edition
https://coherence.community
Universal Permissive License v1.0
427 stars 70 forks source link

Support to change the percentage used for calculating default low-units #96

Open javafanboy opened 1 year ago

javafanboy commented 1 year ago

If you don't specify a value for "low-units" (or specify 0) the value used is today calculated as 0.75 * high-units.

It would be very nice to be able to set this percentage to another value than 0.75 and in this way not having to specify an explicit calculated value for "low-units" for every cache as soon as you would like another percentage.

Perhaps there is already a parameter or method for overriding this but in that case we have failed to find it....

aseovic commented 1 year ago

It's actually 0.80 (see OldCache.DEFAULT_PRUNE), but that's beyond the point.

Unfortunately, there is no way to change the default atm, but we could easily introduce a system property that would allow you to change it for all the caches. If you want to have different default for different caches, that may be doable as well, but it would be a bit more complicated.

The former can be easily accomplished by changing

    public static final double DEFAULT_PRUNE = 0.80;

to

    public static final double DEFAULT_PRUNE  = Config.getDouble("coherence.local.cache.default.prune", 0.80);

The latter would require that we allow a double/percentage to be specified for the <low-units> in addition to the explicit memory size, and use it to change the prune level for that particular cache.

I guess both improvements make sense: the first one would allow you to change the default, the second to set low units based on high units percentage for a specific cache. I'll create a few enhancement requests, thanks for pointing it out.