EagerThreadLocalCleanup
Specifies whether to clean up all ThreadLocals storage from self-tuning thread pool threads after they have finished processing each work request. By default, the self-tuning thread pool only cleans up ThreadLocal storage in its threads after an application is undeployed to avoid ClassLoader memory leak.
Available Since | Release 12.2.1.0.0 |
Privileges | Read/Write |
Type | boolean |
eagerThreadLocalCleanup属性指定在它们完成处理每个工作请求之后是否从自调整线程池中清除所有ThreadLocal存储。
默认情况下,该eagerThreadLocalCleanup属性设置为false,其中自调整线程池仅在线程返回备用池时以及取消部署应用程序后才清理ThreadLocal存储。
将eagerThreadLocalCleanup属性设置为true可以确保在为新请求运行工作时,所有线程池线程都没有先前请求的剩余ThreadLocal值。但是,开销是由于在每个工作请求之后清理ThreadLocal存储,然后为每个新请求重新建立ThreadLocal值而产生的。由于某些应用程序会在ThreadLocal存储中缓存创建对象的开销很大,因此在每个请求之后清理ThreadLocal值可能会对这些应用程序的性能产生负面影响。
具体修改步骤:
[weblogic@goya ~]$ cd Oracle/Middleware/Oracle_Home/oracle_common/common/bin/
[weblogic@goya bin]$ ./wlst.sh
wls:/offline> connect('weblogic','weblogic123')
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "base_domain".
Warning: An insecure protocol was used to connect to the server.
To ensure on-the-wire security, the SSL port or Admin port should be used instead.
wls:/base_domain/serverConfig/> find('threadlocal')
Finding "threadlocal" in all registered MBean instances ...
/Servers/AdminServer EagerThreadLocalCleanup false
/Servers/Server1 EagerThreadLocalCleanup false
/Servers/Server2 EagerThreadLocalCleanup false
wls:/base_domain/serverConfig/> edit()
Location changed to edit tree.
This is a writable tree with DomainMBean as the root.
To make changes you will need to start an edit session via startEdit().
For more help, use help('edit').
wls:/base_domain/edit/> startEdit()
Starting an edit session ...
Started edit session, be sure to save and activate your changes once you are done.
wls:/base_domain/edit/ !> cd('/Servers/AdminServer')
wls:/base_domain/edit/Servers/AdminServer !> cmo.setEagerThreadLocalCleanup(true)
wls:/base_domain/edit/Servers/AdminServer !> save()
Saving all your changes ...
Saved all your changes successfully.
wls:/base_domain/edit/Servers/AdminServer !> validate()
Validating changes ...
Validated the changes successfully
wls:/base_domain/edit/Servers/AdminServer !> showChanges()
All changes that are made but not yet activated are:
MBean Changed : com.bea:Name=AdminServer,Type=Server
Operation Invoked : modify
Attribute Modified : EagerThreadLocalCleanup
Attributes Old Value : false
Attributes New Value : true
Server Restart Required : true
wls:/base_domain/edit/Servers/AdminServer !> activate()
Activating all your changes, this may take a while ...
The edit lock associated with this edit session is released once the activation is completed.
The following non-dynamic attribute(s) have been changed on MBeans
that require server re-start:
MBean Changed : com.bea:Name=AdminServer,Type=Server
Attributes changed : EagerThreadLocalCleanup
Activation completed
wls:/base_domain/edit/Servers/AdminServer> ls()
dr-- COM
......
-r-- DynamicallyCreated false
-rw- EagerThreadLocalCleanup true
-rw- ExternalDNSName null
-rw- ExtraEjbcOptions null
-rw- ExtraRmicOptions null