在前些天的项目里,发现一个关于WebLogic 缓存和钝化有状态会话EJB
的问题。
简单描述下:
===========================================
当cache-type
设置为NRU
的时候,按照官方文档上的描述:
Lazy Passivation (
NRU
)
When lazy passivation is configured by setting
cache-type
to NRU
, the container
avoids passivating beans, because of the associated systems
overhead—pressure on the cache is the only event that causes passivation
or eager removal of beans.
The container:
Removes a bean instance from cache when idle-timeout-seconds
expires, and does not passivate it to disk. This is referred to as a eager remove
. An eager remove ensures that an inactive instance does not consume memory or disk resources.
Passivates instances to disk when max-beans-in-cache
is reached, even though idle-timeout-seconds
has not expired.
懒 钝化
(NRU
)
当cache-type
被配置为NRU
的时候,容器会回避钝化Bean,因为关系到关联的系统的缓存开销,导致钝化或渴望删除Beans。
The container:
当经过idle-timeout-seconds
(闲置时间)时从Cache里直接删除bean,而不是钝化到硬盘上。这被作为一个渴望删除。
一个渴望删除保证了不会耗尽内存和硬盘资源。
当达到max-beans-in-cache
时 钝化硬盘上的bean实例,即使没有超过idle-timeout-seconds
(闲置时间)
详见:摸我
图5-2
之后
=============================================================
也就是说设置成NRU时 如果超过idle-timeout-seconds
时间就会把Cache中的Bean直接干掉。图5-2
也是这么画的。
但项目中始终没有验证出这个结论----即使经过闲置时间,不管超没超过max-beans-in-cache
,也不会从Cache中删除-------开始以为项目本身的框架有一些特殊的实现导致的,后来就做了一个纯净版的ejb sample(见附件 )。发现结果还是这样。
难道是Oracle的文档的问题 还是Bug,还是自己在验证中出现了什么差错? 不解!!!
后来添附上Sample 问了一下Oracle。一个月过去了,还是没有答复。
想请教一下大家,原因是什么?
为什么超过
idle-timeout-seconds
时间后没有像官方文档上描述的"直接从内存中删除Bean"?
****************************************************************************
附上相关文档说明:
cache-type
功能
指定从缓存中删除 EJB 的顺序。值包括:
最近最少使用(Least recently used,简称 LRU)
最近未使用(Not recently used,简称 NRU)
NRU 缓存大小的最小值为 8。如果 max-beans-in-cache
小于 3,WebLogic Server 会对
max-beans-in-cache
使用 8 这个值。
示例
<stateful-session-cache>
<cache-type>NRU</cache-type>
</stateful-session-cache>
Controlling Passivation
The rules that govern the passivation of stateful session beans vary, based on the value of the beans cache-type
element, which can be:
LRU
—least recently used, or eager passivation.
NRU
—not recently used, or as lazy passivation
****************************************************************************
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com