尝试计算对象图的大小时,已达到1.000个对象引用的配置限制 [英] The configured limit of 1.000 object references was reached while attempting to calculate the size of the object graph

查看:526
本文介绍了尝试计算对象图的大小时,已达到1.000个对象引用的配置限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jhipster项目,并添加了一些实体。

我的服务非常慢,因为出现以下警告消息:

I have a jhipster project and I added some entities.
My services are very slow because this warning message:


尝试计算对象图的大小时,已达到1.000个对象引用的配置限制。如果继续执行上浆操作,则可能会导致严重的性能下降。通过将CacheManger或Cache< sizeOfPolicy>元素maxDepthExceededBehavior设置为中止或添加带有@IgnoreSizeOf注释的停止点,可以避免这种情况。如果在配置的限制下性能下降不是问题,请使用CacheManager或Cache< sizeOfPolicy>元素maxDepth属性提高限制值。有关更多信息,请参见Ehcache配置文档。

The configured limit of 1.000 object references was reached while attempting to calculate the size of the object graph. Severe performance degradation could occur if the sizing operation continues. This can be avoided by setting the CacheManger or Cache <sizeOfPolicy> elements maxDepthExceededBehavior to "abort" or adding stop points with @IgnoreSizeOf annotations. If performance degradation is NOT an issue at the configured limit, raise the limit value using the CacheManager or Cache <sizeOfPolicy> elements maxDepth attribute. For more information, see the Ehcache configuration documentation.

我可以更改些什么以增加此限制或取消项目中的缓存?

What I can change to increase this limit or to cancel cache in my project?

推荐答案

这是 Ehcache官方文档关于缓存条目的大小

Here is what Ehcache official documentation says about Sizing of cached entries:

放入内存受限的缓存中的元素将测量其内存大小
。测量添加到缓存的整个Element实例,包括键和值的
,以及将该实例添加到内部数据结构中的
的内存占用量。键和值以对象图的形式测量
–遵循每个引用,对象
的引用也进行度量。

Elements put in a memory-limited cache will have their memory sizes measured. The entire Element instance added to the cache is measured, including key and value, as well as the memory footprint of adding that instance to internal data structures. Key and value are measured as object graphs – each reference is followed and the object reference also measured. This goes on recursively.

共享引用将由每个引用它的类进行度量。
这将导致多报。

Shared references will be measured by each class that references it. This will result in an overstatement. Shared references should therefore be ignored.

调整缓存大小涉及遍历对象图,该过程可能受注释限制。此过程也可以在CacheManager和缓存级别上进行控制。

Sizing caches involves traversing object graphs, a process that can be limited with annotations. This process can also be controlled at both the CacheManager and cache levels.

通过添加以下元素,控制在调整堆上元素的大小时,引擎大小可以达到的深度在CacheManager级别

Control how deep the size-of engine can go when sizing on-heap elements by adding the following element at the CacheManager level

<sizeOfPolicy maxDepth="100" maxDepthExceededBehavior="abort" />  

此元素具有以下属性:


  • maxDepth 控制大小引擎执行任何操作之前可以访问多少个链接对象。 此属性是必需的

  • maxDepth which controls how many linked objects can be visited before the size-of engine takes any action. This attribute is required.

maxDepthExceededBehavior 指定当调整对象图大小时超出最大深度。此字段的可能值为:

maxDepthExceededBehavior which specifies what happens when the max depth is exceeded while sizing an object graph. Possible values for this filed are:


  • continue 这会强制
    的大小引擎记录警告并继续调整
    的大小。如果未指定此属性,则 continue 是使用的
    行为

  • continue which forces the size-of engine to log a warning and continue the sizing operation. If this attribute is not specified, continue is the behavior used

abort 会强制大小引擎中止
的大小调整,记录警告并标记高速缓存为未正确跟踪
的内存使用情况。使用此设置, Ehcache.hasAbortedSizeOf()返回
true

abort which forces the size-of engine to abort the sizing, log a warning, and mark the cache as not correctly tracking memory usage. With this setting, Ehcache.hasAbortedSizeOf() returns true

SizeOf策略可以在缓存管理器级别
(直接在< ehcache> )和缓存级别(在< cache>
< defaultCache> )。如果同时设置了高速缓存策略
,则高速缓存策略始终优先于高速缓存管理器
该元素对分布式
缓存无效。

The SizeOf policy can be configured at the cache manager level (directly under <ehcache>) and at the cache level (under <cache> or <defaultCache>). The cache policy always overrides the cache manager one if both are set. This element has no effect on distributed caches.

这篇关于尝试计算对象图的大小时,已达到1.000个对象引用的配置限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆