19 Configuring Partition Concurrent Managed Objects
Note:
WebLogic Server Multitenant domain partitions, resource groups, resource group templates, virtual targets, and Resource Consumption Management are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.This chapter includes the following sections:
Configuring Partition Concurrent Managed Templates: Overview
In addition to providing support for domain- and server-level CMOs, WebLogic Server also provides partition-level CMO templates to perform partition-scoped task execution.
This document discusses CMO templates only as they apply to partitions.
Concurrent Managed Object Components
The primary components of the concurrency utilities are:
-
ManagedExecutorService (MES): Used by applications to execute submitted tasks asynchronously. Tasks are executed on threads that are started and managed by the container. The context of the container is propagated to the thread executing the task.
-
ManagedScheduledExecutorService (MSES): Used by applications to execute submitted tasks asynchronously at specific times. Tasks are executed on threads that are started and managed by the container. The context of the container is propagated to the thread executing the task.
-
ManagedThreadFactory (MTF): Used by applications to create managed threads. The threads are started and managed by the container. The context of the container is propagated to the thread executing the task.
-
ContextService: Used to create dynamic proxy objects that capture the context of a container and enable applications to run within that context at a later time or be submitted to a Managed Executor Service. The context of the container is propagated to the thread executing the task.
For more detailed information, see Concurrency Utilities for Java EE in The Java EE 7 Tutorial. Also see the Java Specification Request 236: Concurrency Utilities for Java EE 1.0 (http://jcp.org/en/jsr/detail?id=236
).
Partition-Level Asynchronous Task Management by CMOs
In WebLogic Server, asynchronous task management is provided by four types of CMOs, as summarized in Table 19-1.
Table 19-1 CMOs That Provide Asynchronous Task Management
Managed Object | Context Propagation | Self-Tuning | Thread Interruption While Shutting Down | Limit of Concurrent Long-Running New Threads |
---|---|---|---|---|
Managed Executor Service (MES) |
Contexts are propagated based on configuration. |
Only short-running tasks are dispatched to the single self-tuning thread pool by a specified Work Manager. |
When the Work Manager is shutting down, all the unfinished tasks will be canceled. |
The maximum number of long-running threads created by MES/MSES can be configured to avoid excessive number of these threads making negative effects on server. |
Managed Scheduled Executor Service (MSES) |
Contexts are propagated based on configuration. |
Same behavior as MES. |
Same behavior as MES. |
Same behavior as MES. |
Context Service |
Contexts are propagated based on configuration. |
NA |
NA |
NA |
Managed Thread Factory (MTF) |
Contexts are propagated based on configuration. |
Threads returned by the |
Threads created by the |
The maximum number of new threads created by MTF can be configured to avoid excessive number of these threads making negative effects on server. |
There are three types of JSR236 CMOs in WebLogic Server, each one characterized by its scope and how it is defined and used.
-
Default Java EE CMOs: Required by the Java EE standard that default resources be made available to applications, and defines specific JNDI names for these default resources.
-
Customized CMOs in configuration files: Can be defined at the application and module level or referenced from an application component environment that is bound to JNDI.
-
Global CMO templates: Can be defined globally as templates in the domain, server, and partition level configuration by using the WebLogic Server Administration Console and configuration MBeans.
Note:
This document discusses global CMO templates only as they apply to domain partitions. For detailed conceptual information about default Java EE CMOs and customized CMOs in configuration files, see Configuring Concurrent Managed Objects in Administering Server Environments for Oracle WebLogic Server.
Similar to Work Managers, global CMO templates can be defined at the domain, server, and partition level using the WebLogic Server Administration Console or configuration MBeans. For more information about configuring CMOs at the partition level, see Configuring Partition CMO Templates: Main Steps.
Partition-Level MES Template Configuration Elements
Table 19-2 defines the configuration elements for a partition-level MES template.
Table 19-2 Managed Executor Service Configuration Elements
Name | Description | Required | Default Value | Range |
---|---|---|---|---|
name |
Name of the MES.
|
Yes |
NA |
An arbitrary non-empty string. |
dispatch-policy |
Name of the Work Manager. The partition-level Work Manager will be picked by this name. If the Work Manager does not exist, use the partition-level default Work Manager. |
No |
Default Work Manager |
NA |
max-concurrent-long-running-requests) |
Maximum number of concurrent long running tasks. |
No |
10 |
[0-65534]. When out of range, the default value will be used. |
long-running-priority |
An integer that specifies the long-running daemon thread's priority. If specified, then all long-running threads will be affected. |
No |
|
1-10 Range between |
Partition-Level MSES Template Configuration Elements
Table 19-3 defines the configuration elements for a partition-level MSES template, which are similar to a partition-level MES template.
Table 19-3 Managed Scheduled Executor Service Configuration Elements
Name | Description | Required | Default Value | Range |
---|---|---|---|---|
name |
The name of the MSES. For naming convention rules, see Table 19-2. |
Yes |
NA |
An arbitrary non-empty string. |
dispatch-policy |
The name of the Work Manager. For Work Manager usage rules, see Table 19-2. |
No |
Default Work Manager |
NA |
max-concurrent-long-running-requests |
Maximum number of concurrent long running tasks. |
No |
10 |
[0-65534]. When out of range, the default value is used. |
long-running-priority |
An integer that specifies the long-running daemon thread's priority. If specified, then all long-running threads will be affected. |
No |
5 |
1-1 Range between |
Partition-Level MTF Template Configuration Elements
Table 19-4 defines the configuration elements for a partition-level MTF template.
Table 19-4 Managed Thread Factory Configuration Elements
Name | Description | Required | Default Value | Range |
---|---|---|---|---|
name |
The name of the MTF. For naming convention rules, see Table 19-2. |
Yes |
NA |
An arbitrary non-empty string. |
priority |
The priority to assign to the thread. (The higher the number, the higher the priority.) |
No |
5 |
1-10 Range between |
max-concurrent-new-threads |
The maximum number of threads created by the MTF that are still executing the |
No |
10 |
[0-65534] When out of range, the default value is used. |
Table 19-5 defines the configuration elements for a partition-level MTF.
Table 19-5 Managed Thread Factory Configuration Elements
Name | Description | Required | Default Value | Range |
---|---|---|---|---|
name |
The name of the MTF. For naming convention rules, see Table 19-2. |
Yes |
NA |
An arbitrary non-empty string. |
priority |
The priority to assign to the thread. (The higher the number, the higher the priority.) |
No |
5 |
1-10 Range between |
max-concurrent-new-threads |
The maximum number of threads created by the MTF that are still executing the |
No |
10 |
[0-65534] When out of range, the default value is used. |
Partition-Level CMO Constraints for Long-Running Threads
Long-running tasks submitted to MES and MSES and the calling of newThread()
method of MTF need to create new threads that will not be managed as a part of the self-tuning thread pool. Because an excessive number of running threads can have a negative effect on server performance and stability, configurations are provided to specify the maximum number of running threads that are created by concurrency utilities API.
Setting Limits for Maximum Concurrent Long-Running Requests
The limit of concurrent long-running requests submitted to MES and MSES can be specified in partitions. All levels of configurations are independent and the maximum of the concurrent long-running requests cannot exceed any of them.
Table 19-6 summarizes the limit of concurrent long-running requests with the max-concurrent-long-running-requests
element that can be defined in the deployment descriptors.
Table 19-6 Limit of Concurrent Long-Running Requests in Partitions
Scope | Deployment Descriptor | Description | <max-concurrent-long-running-requests> Element Details |
---|---|---|---|
Partition |
In As the subelement of |
Limit of concurrent long-running requests specified for that partition in that server. |
Optional Range: [0-65534]. When out of range, the default value will be used. Default value: 50 |
When the specified limit is exceeded, the MES or MSES takes the following actions for new long-running tasks submitted to them:
-
The
java.util.concurrent.RejectedExecutionException
is thrown when calling the task submission API. -
If the user registered the task with the
ManagedTaskListener
, then this listener is not notified because the submit method failed.
Note that the preceding rule is not applied for the invokeAll()
and invokeAny()
methods. If any of the tasks submitted by these methods is rejected by the specified limit, then the following events occur:
-
The user-registered managed task listener's
taskSubmitted()
method is called. -
The user-registered managed task listener's
taskDone()
method is called and thethrowableParam
isjavax.enterprise.concurrent.AbortedException
. -
Other submitted tasks are not affected.
-
The method does not throw the exception
RejectedExecutionException
.
The following example demonstrates how the value specified for the max-concurrent-long-running-requests
element in the config.xml
file can affect the maximum number of long-running requests.
<domain> <server> <name>myserver</server> <max-concurrent-long-running-requests>50</max-concurrent-long-running-requests> (place 1) </server> <max-concurrent-long-running-requests>10</max-concurrent-long-running-requests> (place 2) <partition> <name>mypartition</name> <max-concurrent-long-running-requests>5</max-concurrent-long-running-requests> (place 3) </partition> <server-template> <name>mytemplate</name> <max-concurrent-long-running-requests>50</max-concurrent-long-running-requests> (place 4) </server-template> </domain>
-
place 1
: Affects the MES and MSES defined in the server instance myserver. All the MES and MSES running in that server instance can create only a maximum of 50 long-running-requests in total. -
place 2
: Only affects MES and MSES defined in the domain. It does not affect partition-level MES and MSES. All the MES and MSES running in the domain can create a maximum of 10 long-running requests in total. -
place 3
: Only affects MES and MSES defined in mypartition. All the MES and MSES running in partition mypartition can create maximally 5 long-running requests in total. -
place 4
: Affects MES and MSES defined in the server instances that apply to the template mytemplate. All the MES and MSES running in that server instance can create only a maximum of 50 long-running-requests in total.
The following example demonstrates how the value specified for the max-concurrent-long-running-requests
element in the config.xml
file can affect the maximum number of long-running requests.
In the following case, none of the limits is exceeded and the prior actions are not taken:
-
Assume 120 long-running tasks were submitted to
managed-executor-service1
, 115 of them were finished, 5 of them are being executed, if one more long-running task is submitted tomanaged-executor-service1
, then it is executed because no limit is exceeded.
In the following cases, one of the limits is exceeded and the prior actions are taken:
-
Assume 10 long-running tasks are being executed by
managed-scheduled-executor-service1
, if one more long-running task is submitted tomanaged-scheduled-executor-service1
, then the limit ofmanaged-scheduled-executor-service1
is exceeded. -
Assume 10 long-running tasks are being executed by
application1
, and 40 are being executed byapplication2
; if one more long-running task is submitted toapplication1
orapplication2
, then the limit ofpartition1
is exceeded. -
Assume 10 long-running tasks are being executed by
application1
, 30 are being executed byapplication2
, and 60 are being executed bypartition2
; if one more long-running task is submitted toapplication1
, orapplication2
, orpartition2
, then the limit ofserver1
is exceeded.
server1(100) |---partition1(50) |---application1 |---managed-scheduled-executor-service1(not specified) |---module1 |---managed-executor-service1(20) |---managed-scheduled-executor-service2(not specified) |---application2 |---partition2(70)
Setting Limits for Maximum Concurrent New Threads
The limit of concurrent new running threads created by calling the newThread()
method of the MTF can be specified in a managed object, domain, and server level. All levels of configurations are independent and the maximum of the concurrent new running threads cannot exceed any of them.
Note that the meaning of running thread is a thread that has been created by the MTF that has not finished its run()
method.
Table 19-7 summarizes the limit of concurrent new running threads with an element <max-concurrent-new-threads>
that can be defined in the deployment descriptors.
Table 19-7 Limit of Concurrent New Running Threads
Scope | Deployment Descriptor | Description | <max-concurrent-long-running-requests> Element Details |
---|---|---|---|
Partition |
In As the subelement of |
Limit of concurrent new running threads specified for that partition in that server. |
Optional Range: [0-65534], when out of range, the default value is used. Default value: 50 |
When the specified limit is exceeded, calls to the newThread()
method of the MTF will return null
to be consistent with the ThreadFactory.newThread
Javadoc.
To see a sample of using max-concurrent-new-threads
, see Example 19-*.
Configuring Partition CMO Templates: Main Steps
You can define global CMOs as templates in the partition's configuration by using the WebLogic Server Administration Console and configuration MBeans. CMO templates can be assigned to any application, or application component in the partition.
Note:
Partitioned domains for multitenancy are only available in WebLogic Server Premium Edition. See About WebLogic Server MT.
You can define three types of CMO templates in a partition:
-
Managed Executor Service
-
Managed Scheduled Executor Service
-
Managed Thread Factory
For example, if you define a managed-executor-service-template
, a unique MES instance is created for each application deployed in the partition.
Using the Administration Console to Configure a Partition-Scoped CMO Template
CMO templates can be configured and scoped to a partition using the WebLogic Server Administration Console.
For more detailed information about configuring CMO templates for a domain and server scope, see Global CMO Templates in Administering Server Environments for Oracle WebLogic Server.
Using MBeans to Configure CMO Templates
CMO templates can be configured using the following configuration MBeans under PartitionMBean
:
See the PartitionMBean section in the MBean Reference for Oracle WebLogic Server.
Configuring Partition Concurrent Constraints: Main Steps
You can also define constraints for a partition scope using the WebLogic Server Administration Console and configuration MBeans.
Using the Administration Console to Configure Concurrent Constraints for a Partition
Concurrent constraints can be configured per partition using the WebLogic Server Administration Console.
Using MBeans to Configure Concurrent Constraints
Concurrent constraints can be configured per partition using the following methods under the PartitionMBean
:
-
maxConcurrentLongRunningRequests()
The maximum number of concurrent long-running requests that can be submitted to all of the Managed Executor Services or Managed Scheduled Executor Services in the partition scope.See Setting Limits for Maximum Concurrent Long-Running Requests.
-
maxConcurrentNewThreads()
The maximum number of concurrent new threads that can be created by all of the Managed Thread Factories in the partition scope.
For more information about using WebLogic Server MBeans, see Accessing WebLogic Server MBeans with JMX in Developing Custom Management Utilities Using JMX for Oracle WebLogic Server.
Monitoring Partition-level CMO Templates
Concurrent constraints can be queried directly, through MBeans, and by using the WebLogic Server Administration Console.
Using the Administration Console to Monitor CMO Templates
CMO templates can be monitored using the Administration Console.
To monitor the threads created by CMOs in a partition:
-
In the Domain Structure tree, click Domain Partitions.
-
In the Summary of Domain Partitions table, select the partition you want to monitor.
-
In the Settings for partition-name page, select the Monitoring > Concurrent Templates tab.
The table provides configuration information for CMO templates that have been targeted to the partition.
Using MBeans to Monitor CMO Templates
A a partition's CMO templates can be monitored using the ConcurrentManagedObjectsRuntimeMBean
, which can be accessed from the following MBean attribute:
-
PartitionRuntimeMBean.ConcurrentManagedObjectsRuntime
– Provides configuration information for CMO templates that have been targeted to the partition.
See the ConcurrentManagedObjectsRuntimeMBean in the MBean Reference for Oracle WebLogic Server
For more information about using WebLogic Server MBeans, see Accessing WebLogic Server MBeans with JMX in Developing Custom Management Utilities Using JMX for Oracle WebLogic Server.
Configuring Partition Concurrent Managed Objects: Related Tasks and Links
-
Configuring Concurrent Managed Objects in Administering Server Environments for Oracle WebLogic Server.
-
For more information about CMO-related configuration and runtime MBeans, see the ManagedExecutorServiceTemplateMBean, ManagedScheduledExecutorServiceTemplateMBean, ManagedThreadFactoryTemplateMBean, and the PartitionMBean in the MBean Reference for Oracle WebLogic Server.
-
For more information about using WLST commands, see WebLogic Server WLST Online and Offline Command Reference in the WLST Command Reference for WebLogic Server.
-
Sample Applications and Code Examples in Understanding Oracle WebLogic Server.
-
Concurrency Utilities for Java EE in The Java EE 7 Tutorial.
-
The Java Specification Request 236: Concurrency Utilities for Java EE 1.0 (
http://jcp.org/en/jsr/detail?id=236
).