![]() |
![]() |
e-docs > WebLogic Server > WebLogic Server Performance and Tuning > Tuning WebLogic Server Applications |
WebLogic Server Performance and Tuning
|
Tuning WebLogic Server Applications
WebLogic Server only performs as well as the applications running on it. It is important to determine the bottlenecks that impede performance, as described in the following sections:
Using Performance Analysis Tools
This section is a quick reference for using the OptimizeItTM and JProbeTM profilers with WebLogic Server.
A profiler is a performance analysis tool that allows you to reveal hot spots in the application that result in either high CPU utilization or high contention for shared resources. For a list of common profilers, see Performance Analysis Tools.
The JProbe Suite is a family of products that provide the capability to detect performance bottlenecks, find and fix memory leaks, perform code coverage, and other metrics.
The JProbe website provides a technical white paper, "Using Sitraka JProbe and BEA WebLogic Server", which describes how developers can analyze code with any of the JProbe Suite tools running inside BEA WebLogic Server.
The Optimizeit Profiler from Borland is aperformance debugging tool for Solaris and Windows platforms.
Borland provides detailed J2EE Integration Tutorials for the supported versions of Optimizeit Profiler that work with WebLogic Server.
Most performance gains or losses in a database application are determined by how the application is designed. The number and location of clients, size and structure of DBMS tables and indexes, and the number and types of queries all affect application performance.
For more information on optimizing your applications for JDBC, see "Performance Tuning Your JDBC Application" in Programming WebLogic JDBC.
JDBC Optimization for Type-4 MS SQL Driver
When using the type-4 MS SQL driver, it may be much faster to create and execute an SQL statement either without parameters or with parameter values converted to their string counterparts and added as appropriate to the string, rather than declaring a long series of setXXX() calls, followed by execute().
For more information, see "Configuring and Using WebLogic jDriver for Microsoft SQL Server"
Optimize your application so that it does as little work as possible when handling session persistence and sessions.
In-memory replication is up to 10 times faster than JDBC-based persistence for session state. Use in-memory replication, if possible.
If you are using JDBC-based persistence, optimize your code so that it has as high a granularity for session state persistence as possible. In the case of JDBC-based persistence, every session "put" operation that you use in your code results in a database write of the entire object.
Keep the number of "puts" that you use during your HTTP session to a minimum.To minimize how often information is persisted during a given session, examine your "puts" and, if possible, combine them into a single, large "put".
Configuring how WebLogic Server manages sessions is a key part of tuning your application for best performance. Consider the following:
Use sessions only for state that cannot realistically be kept on the client or if URL rewriting support is required. Keep simple bits of state, such as a user's name, directly in cookies. You might also write a wrapper class to "get" and "set" these cookies, in order to simplify the work of servlet developers working on the same project.
See "Setting Up Session Management" in Assembling and Configuring Web Applications.
Using Execute Queues to Control Thread Usage
You can fine-tune an application's access to execute threads (and thereby optimize or throttle its performance) by using multiple execute queues in WebLogic Server. However, keep in mind that unused threads represent significant wasted resources in a Weblogic Server system. You may find that available threads in configured execute queues go unused, while applications in other queues sit idle waiting for threads to become available. In such a situation, the division of threads into multiple queues may yield poorer overall performance than having a single, default execute queue.
Default WebLogic Server installations are configured with a default execute queue, which is used by all applications running on the server instance. You may want to configure additional queues to:
Be sure to monitor each execute queue to ensure proper thread usage in the system as a whole. See Setting Thread Count for general information about optimizing the number of threads.
An execute queue represents a named collection of execute threads that are available to one or more designated servlets, JSPs, EJBs, or RMI objects. An execute queue is represented in the domain config.xml file as part of the Server element. For example, an execute queue named CriticalAppQueue with four execute threads appears in the config.xml file as follows:
...
<Server
Name="examplesServer"
ListenPort="7001"
NativeIOEnabled="true"/>
<ExecuteQueue Name="default"
ThreadCount="15"/>
<ExecuteQueue Name="CriticalAppQueue"
ThreadCount="4"/>
...
</Server>
To configure a new execute queue using the Administration Console:
If the maximum Queue Length is reached, WebLogic Server automatically doubles the size of the queue to account for the additional work. Note, however, that exceeding 65536 requests in the queue indicates a problem with the threads in the queue, rather than the length of the queue itself; check for stuck threads or an insufficient thread count in the execute queue.
By default, the Queue Length Threshold Percent value is 90 percent. In most situations, you should leave the value at or near 90 percent, to account for any potential condition where additional threads may be needed to handle an unexpected spike in work requests. Keep in mind that Queue Length Threshold Percent must not be used as an automatic tuning parameter—the threshold should never trigger an increase in thread count under normal operating conditions.
Note that if WebLogic Server increases the number of threads in response to an overflow condition, the additional threads remain in the execute queue until the server is rebooted. In general, you should monitor the error log to determine the cause of overflow conditions, and reconfigure the thread count as necessary to prevent similar conditions in the future. Do not use the combination of Threads Increase and Queue Length Threshold Percent as an automatic tuning tool; doing so generally results in the execute queue allocating more threads than necessary and suffering from poor performance due to context switching.
Assigning Servlets and JSPs to Execute Queues
You can assign a servlet or JSP to a configured execute queue by identifying the execute queue name in the initialization parameters. Initialization parameters appear within the init-param element of the servlet's or JSP's deployment descriptor file, web.xml. To assign an execute queue, enter the queue name as the value of the wl-dispatch-policy parameter, as in the example:
<servlet>
<servlet-name>MainServlet</servlet-name>
<jsp-file>/myapplication/critical.jsp</jsp-file>
<init-param>
<param-name>wl-dispatch-policy</param-name>
<param-value>CriticalAppQueue</param-value>
</init-param>
</servlet>
See "Initializing a Servlet" in Programming WebLogic HTTP Servlets for more information about specifying initialization parameters in web.xml.
Assigning EJBs and RMI Objects to Execute Queues
To assign an RMI object to a configured execute queue, use the -dispatchPolicy option to the rmic compiler. For example:
java weblogic.rmic -dispatchPolicy CriticalAppQueue ...
To assign an EJB object to a configured execute queue, use the -dispatchPolicy option with the ejbc utility. ejbc passes this option and its argument to rmic when compiling the EJB.
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |