Firstly a little bit of theory. Its important you understand the concept of WM (and its as per Oracle documentation).
The number of active threads will never exceed 400.
As requests enter the server, a scheduler manages the order in which the requests are executed. When the number of requests exceeds the number of available threads, they are queued and then executed as threads return to the pool and become available.
Work Managers indicate the type of work and priority of a request to the scheduler.
1. Request and response pipelines always execute in separate threads. While the request thread originates from the proxy service transport, the response thread originates from the business service transport.
2. When external services are invoked, threads can be blocking or non-blocking, depending on the pipeline action, the Quality of Service (QoS) configuration, and the transport being used.
3. When using blocking calls, a Work Manager with a minimum thread constraint must be associated with the response in order to prevent server deadlocks.
A maximum thread constraint limits the number of concurrent threads executing a type of request by restricting the scheduler from executing more than the configured number at one time. However, the thread pool is shared among all Work Managers, so there is no guarantee the maximum number of threads will be available for processing at any given time.
A minimum thread constraint guarantees a minimum number of threads for processing. If sufficient threads are not available in the thread pool to process up to the minimum number, the scheduler uses standby threads to satisfy the minimum. Standby threads are not counted as part of the maximum number of 400 threads in the pool. When a thread is executing a request associated with a Work Manager containing a minimum thread constraint, the Work Manager first checks the queue for another request associated with the same constraint and executes it (instead of returning to the free pool). For this reason, use minimum thread constraints judiciously. Over-use can cause resource starvation of the default Work Manager, leading to unpredictable results.
A minimum thread constraint guarantees a minimum number of threads for processing. If sufficient threads are not available in the thread pool to process up to the minimum number, the scheduler uses standby threads to satisfy the minimum. Standby threads are not counted as part of the maximum number of 400 threads in the pool. When a thread is executing a request associated with a Work Manager containing a minimum thread constraint, the Work Manager first checks the queue for another request associated with the same constraint and executes it (instead of returning to the free pool). For this reason, use minimum thread constraints judiciously. Over-use can cause resource starvation of the default Work Manager, leading to unpredictable results.
If a proxy service invokes the business service using a service callout, a publish action, or routing with exactly-once QoS, consider using different Work Managers for the proxy service and the business service instead of using the same for both. For the business service Work Manager, configure the Min Thread Constraint property to a small number (1-3) to guarantee an available thread.
1. Login to Admin Console : http://host:port/console
2. Click on Lock & Edit
3. Navigate to Environments > Work Managers
4. Create New
5. Select Maximum/Minimum Thread Constraint (which ever you want to create)
6. Provide Logical Name and Count - say MaxThread4 and 4
7. Click on Next
8. Choose the target server
9. Finish
Now again click on New
1. Select Work Manager
2. Provide a Logical Name
3. Click Next
4. For Max and Min Threads Constraint from the drop-down select the ones you have created above
5. Finish and your WM is created with the constraints
Now assigning the WM to your service
1. Login to Service Bus console
2. Create Session
3. Navigate to your Proxy or Business Service
4. Under Transport Details Tab > from drop-down select your WM you have created.
5. Save and then Activate your session
Helpful? Comment
Happy Learning!
No comments:
Post a Comment