Weblogic Overload Protection Steps
Below python/WLST script can be used to configure overload protection in weblogic server using WLST tool.
connect ('weblogic','weblogic','t3://tpaste.com:9001'); edit() startEdit(true) print('List Servers...') cd ("/Servers") ServerName=ls('/Servers',returnMap='true') for domn in ServerName: server=cmo.lookupServer(domn) overload=server.getOverloadProtection() overload.setFailureAction('force-shutdown') failureTrigger = overload.getServerFailureTrigger() if failureTrigger == None: failureTrigger=overload.createServerFailureTrigger() failureTrigger.setStuckThreadCount(25) server.setAutoRestart(true) server.setRestartIntervalSeconds(3600) server.setRestartDelaySeconds(10) server.setRestartMax(20) save() activate() disconnect()
More on Configuring WebLogic Server to Avoid Overload Conditions
When system capacitiy is reached, if an application server continues to accept requests, application performance and stability can deteriorate. The following sections demonstrate how you can configure WebLogic Server to minimize the negative results of system overload.
Limiting Requests in the Thread Pool
In WebLogic Server, all requests, whether related to system administration or application activity—are processed by a single thread pool. An administrator can throttle the thread pool by defining a maximum queue length. Beyond the configured value, WebLogic Server will refuse requests, except for requests on administration channels.
Note: Administration channels allow access only to administrators. The limit you set on the execute length does not effect administration channel requests, to ensure that reaching the maximum thread pool length does not prevent administrator access to the system. To limit the number of administration requests allowed in the thread pool, you can configure an administration channel, and set the MaxConnectedClients attribute for the channel.
When the maximum number of enqueued requests is reached, WebLogic Server immediately starts rejecting:
Web application requests.
Non-transactional RMI requests with a low fair share, beginning with those with the lowest fair share.
If the overload condition continues to persist, higher priority requests will start getting rejected, with the exception of JMS and transaction-related requests, for which overload management is provided by the JMS and the transaction manager.
Throttle the thread pool by setting the Shared Capacity For Work Managers field in the Administration Console (see Environments > Servers > Threads and select an execute queue). The default value of this field is 65536.
Work Managers and Thread Pool Throttling
An administrator can configure Work Managers to manage the thread pool at a more granular level, for sets of requests that have similar performance, availability, or reliability requirements. A Work Manager can specify the maximum requests of a particular request class that can be queued. The maximum requests defined in a Work Manager works with global thread pool value. The limit that is reached first is honored.
Limiting HTTP Sessions
An administrator can limit the number of active HTTP sessions based on detection of a low-memory condition. This is useful in avoiding out of memory exceptions.
WebLogic Server refuses requests that create new HTTP sessions after the configured threshold has been reached. In a WebLogic Server cluster, the proxy plug-in redirects a refused request to another Managed Server in the cluster. A non-clustered server instance can re-direct requests to alternative server instance.
The servlet container takes one of the following actions when maximum number of sessions is reached:
If the server instance is in a cluster, a the servlet container throws a SessionCreationException. Your application code should handle this runtime exception and send a relevant response.
To implement overload protection, you should handle this exception and send a 503 response explicitly. This response can then be handled by the proxy or load balancer.
You set a limit for the number of simultaneous HTTP sessions in the deployment descriptor for the Web Application. For example, the following element sets a limit of 12 sessions:
Exit on Out of Memory Exceptions
Administrators can configure WebLogic Server to exit upon an out of memory exception. This feature allows you to minimize the impact of the out of memory condition—automatic shutdown helps avoid application instability, and you can configure Node Manager or another HA tool to automatically restart WebLogic Server, minimizing down-time.
You can configure this using the Administration Console, or by editing the following elements in config.xml:
<overload-protection> <panic-action>system-exit</panic-action> </overload-protection>
Stuck Thread Handling
WebLogic Server checks for stuck threads periodically. If all application threads are stuck, a server instance marks itself failed, if configured to do so, exits. You can configure Node Manager or a third-part high-availability solution to restart the server instance for automatic failure recovery.
You can configure these actions to occur when not all threads are stuck, but the number of stuck threads have exceeded a configured threshold,
Shut down the Work Manager if it has stuck threads. A Work Manager that is shut down will refuse new work and reject existing work in the queue by sending a rejection message. In a cluster, clustered clients will fail over to another cluster member.
Shut down the application if there are stuck threads in the application. The application is shutdown by bringing it into admin mode. All Work Managers belonging to the application are shut down, and behave as described above.
Mark the server instance as failed and shut it down it down if there are stuck threads in the server. In a cluster, clustered clients that are connected or attempting to connect will fail over to another cluster member.
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.