使用EhCache在生产中缓存的对象数 [英] Number of objects cached in production using EhCache
问题描述
有什么方法可以知道生产中缓存的对象数量吗?
我在我的项目上使用EhCache,并在NewRelic上进行监视.
我不知道这是否对我有帮助,或者NewRelic是否与EhCache集成.
您可能会使用NewRelic的JMX集成,但是还有此处.
例如,您可以在/opt/newrelic/extension/ehcache.yaml
名称:EhCacheMetrics版本:1.0已启用:truejmx:-object_name:{请参阅VisualVM MBeans浏览器中的元数据}指标:-属性:CacheHitPercentage,CacheHits,CacheMisses,ObjectCount类型:简单
您需要通过注册EhCache进行JMX管理来找出可用的功能如此处所述.
有一个很好的Spring Boot示例 解决方案
You could potentially use NewRelic's JMX integration, but also there is JCache API integration in NewRelic, which may instrument the right parts if you are using the JCache compatible features of EhCache.
If you want to export select JMX information, then you need to specify in your NewRelic config on the server as documented here.
For example you could create the following file in /opt/newrelic/extension/ehcache.yaml
name: EhCacheMetrics
version: 1.0
enabled: true
jmx:
- object_name: {see Metadata within VisualVM MBeans browser}
metrics:
- attributes: CacheHitPercentage, CacheHits, CacheMisses, ObjectCount
type: simple
You'll need to find out what is available which you can do by registering EhCache for JMX management as documented here.
There is a good Spring Boot sample here
这篇关于使用EhCache在生产中缓存的对象数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!