Closed yeying1993 closed 3 years ago
Are you trying to completely replace the yesterday's ("old") model with a today's ("new") model?
Guava Caches should purge unused keys/values automatically when the memory starts to run low. Cache keys are typically subclasses of org.dmg.pmml.PMMLObject
, whereas cache values are typically something else. Looks like entity registry caches violate that convention, because the cache value is a BiMap<String, subclass of org.dmg.pmml.PMMLObject>
, which may prevent purging.
Will have to analyze what other caches may be affected. Definitely don't want to make weakValues()
the default policy all of a sudden.
You can set a custom Cache policy for your application using the org.jpmml.evaluator.CacheUtil#setCacheBuilderSpec(CacheBuilderSpec)
utility method. Something like this should do:
class MyPMMLApplication {
static {
CacheUtil.setCacheBuilderSpec(CacheBuilderSpec.parse("weakKeys,weakValues"));
}
}
OK,thank you very much
Hi,I have got a problem,my scene is Model iteration by every day,but the framework of jpmml use LoadingCache as cache, that has a characteristics of delaying to delete.so jpmml leads to jvm memory is very big, even OOM. The solution : At the same time using weakKeys() and weakValues():