Monday 9 January 2012

Throttling in OSB

A common problem with integration is the risk of overloading a particular web service. When the capacity of a web service is reached and it continues to accept connections, it will most likely start to deteriorate.
Funnel
Fortunately there are 2 techniques, with Oracle Service Bus, that you can apply for protecting this from happening. You can either limit the concurrent number of requests for a Business Service (outbound requests) or you can limit the number of threads processing the requests for a Proxy Service (inbound requests).

Limiting the Concurrent Number of Requests

Limiting the concurrent requests for a Business Service cannot be set at design time so you have to use the built-in Oracle Service Bus Administration Console to do it (/sbconsole). Follow these steps to enable it:
  1. In Change Center, click Create to start a new Session
  2. Select Project Explorer, and navigate to the Business Service you want to limit
  3. Select the Operational Settings tab of the View a Business Service page
  4. In this tab, under Throttling, select the Enable check box. By enabling throttling you
    1. Specify a value for Maximum Concurrency
    2. Specify a positive integer value for Throttling Queue to backlog messages that has exceeded the message concurrency limit
    3. Specify the maximum time in milliseconds for Message Expiration a message can spend in Throttling Queue
  5. Click Update
  6. Click Active in Change Center to active the new settings
Enable Throttling
If you re-publish the service, it will not overwrite the settings. Only if the resource is renamed or moved, it will.
Please note that a throttling queue is an in-memory queue. Messages that are placed in this queue are not recoverable when a server fails or when you restart a server.

Limiting the Number of Threads

A better approach, in my opinion, is to limit the number of threads that can work with request. Follow these steps to do it:
  1. Open the WebLogic Server Console (/console)
  2. In Change Center, click Create to start a new Session
  3. In the left pane expand Environment and select Work Managers Domain Structure - Work Managers
  4. In the Global Work Managers page, click New  Global Work Managers - New 
  5. Click the Work Manager radio button, then click Next Create a New Work Manager Component
  6. Enter a Name for the new Work Manager, and click Next
  7. In the Available Targets list, select server instances or clusters on which you will deploy applications that reference the Work Manager
  8. Click Finish. The new Work Manager now appears in the Global Work Managers page.
  9. Select the new Work Manager
  10. Right next to the Maximum Threads Constraint drop-down box, click New  MyWorkManager - Settings
  11. Click the Maximum Threads Constraint radio button, then click Next Maximum Threads Constraint
  12. Enter a Name and a thread Count to be the maximum size to allocate for requests. Click Next  Maximum Threads Constraint II
  13. In the Available Targets list, select server instances or clusters on which you will deploy applications that reference the Work Manager
  14. Click Finish
  15. Click Save
  16. Click Active in Change Center to active your changes.  A restart may be necessary.   Puh! Almost there.
  17. Start a new session. Go to the Service Bus Console (/sbconsole) and find your consuming Proxy Service.
  18. Click the Edit button of the Transport Configuration tab.
  19. Click Next Edit a Proxy Service I
  20. Set the Dispatch Policy to the new Work Manager Edit a Proxy Service II
  21. Click Last
  22. Click Save
  23. Click Active in Change Center to active your changes. 

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...