IBM Support

Certain ConfigService API methods and constructors might cause workspace memory leaks and performance degradation

Troubleshooting


Problem

Certain types of constructors and ConfigService application programming interface (API) methods might cause problems with workspace session management and the performance of the application serving environment.

Cause

There are workspace and memory leak issues that are associated with various API methods when they are implemented incorrectly.

For example, a workspace memory leak might result in the following situations:

  • When you create a new workspace session and do not discard it when it is no longer needed
  • When you create a new workspace session and an existing workspace session can be reused

In addition, overall performance might be degraded when you use certain ConfigService API methods.

Resolving The Problem

Use the following guidelines for workspace session management and ConfigService API methods to minimize workspace leak problems and performance degradation.

Guidelines for workspace session management
Each workspace is associated with a session object. There are two types of constructors to create a new session.

  • Session()
    This constructor always creates a new unique session. The ID of the session is anonymous+current-time-in-milliseconds.
  • Session(id, reuse)
    This constructor creates a new session based upon the supplied ID. If a workspace is already created for that ID, the same workspace is used unless the reuse flag is set to false. If the reuse flag is set to false, a new session with the id+current-time-in-milliseconds ID is created.

Example 1
The following two lines of code result in the creation of a new unique workspace:

Session session = new Session();
configService.resolve(session, "Cell=");

The corresponding workspace files are located under install_root/profiles/profile_name/wstemp/anonymous12341324324

Where 12341324324 is the time in milliseconds when the session was created.

Every time a new session object is created with this method, a new unique workspace directory is created. If you use this method, remove these workspaces when you are finished with them.

Example 2
The following two lines result in the creation of a new workspace if the corresponding workspace directory does not exist:

Session session = new Session("myWorkspace", true);
configService.resolve(session, "Cell=");

The corresponding workspace files are located under install_root/profiles/profile_name/wstemp/myWorkspace

If the same two lines are subsequently run, the same workspace is re-used.

This type of workspace is created by the administrative console. When the server shuts down while a user is still logged onto the administrative console, the workspace is not removed. The next time the server starts and the administrative console is reconnected to the server with the same user ID, the workspace can be reused. However, if the user logs out of the administrative console, the workspace directory is removed if all of the workspace changes are saved and there are no user-specific references.

Example 3
The following two lines result in the creation of a new unique workspace:

Session session = new Session("myWorkspace", false);
configService.resolve(session, "Cell=");

The corresponding workspace files are located under install_root/profiles/profile_name/wstemp/myWorkspace3523532452345
Where 3523532452345 is the time in milliseconds when the session was created.

Every time a session object is created using this method, the result is the creation of a new, unique workspace. Depending upon your configuration, this method might remove all of the workspace that is created using this method after the session.

Other considerations for session management
Many components use the ConfigService methods to read configuration data, create a new session temporarily, and discard the session after it is used. However, it is not necessary to create and discard a session for every ConfigService operation.

If these ConfigService operations are called frequently, it is better to reuse the same session and discard it only when there is a change in the configuration repository. The configuration repository sends a notification when a document is added, modified, or deleted in the repository. Configure these components to listen to the configuration repository notifications and discard the session only if there are changes to the documents that are relevant to the operation.

In addition, all of the command extensions should reuse the workspace session that is created and used by the base command unless there is a special reason. The AbstractAdminCommand provides the getConfigSession method to get this workspace session.

To remove the workspaces, invoke the following methods:

configService.discard(session)
or
workspace.remove()


Guidelines for ConfigService methods

The following ConfigService methods are widely used.
  • queryConfigObjects method
    This method searches recursively under the given scope to find all of the objects of a given type. The given type is specified in the pattern parameter. Because it searches the whole tree recursively, use the method judiciously. If you know that you do not need to recursively search the given type of object, do not use this method.

    For example, if you use this method to find all of the clusters under cell scope, the method searches all of the contexts under the cell and traverses through the nodes, applications, node groups, core groups, clusters, and so on. In a large configuration, this process might take some time. Therefore, in these cases, do not use this method. Instead, use the resolve method.

    Example:
    The following method is recommended. This method searches under serverObj only.
    configService.queryConfigObjects(session, serverObj, webContainer, null)

    The following method is not recommended because it searches the entire configuration tree under the cell for the webContainer object. If you need to find all of the webContainer objects, use the resolve API, which is more efficient.
    configService.queryConfigObjects(session, null, webContainer, null)
  • resolve method
    This method does not search recursively. It searches the containment path only.

    For example, the method searches recursively through the Server= containment path until it finds a context where the Server object exists. The method traverses cell, node, applications, node groups, core groups, clusters, and so on until the entire configuration tree is searched. If you specify the Cell=:Node=:Server:containment path, the method searches for servers only under the nodes directory. With this containment path, the method does not traverse applications, cluster, node groups, and others.

    Example:
    The following example is recommended. This method searches all of the nodes and servers for webContainer objects only and skips other contexts in the configuration tree.
    configService.resolve(session, "Cell=:Node=:Server=:WebContainer=")

    The following example is not recommended because it searches the entire configuration tree:
    configService.resolve(session, "webContainer=")
  • getAttributes method
    Use this method when you need all, or more than one, of the attributes of an object. If you need only one attribute, use the getAttribute method.

    The getAttributes method results in reading all of the attributes within the object. This method also performs validation to make sure that each attribute is valid for a given version of a node. If there are numerous attributes in the object, this process is time consuming. Therefore, use the getAttribute method instead.

    Example:
    The following example is not recommended because it collects all of the attributes of the serverEntry object and it selects one required attribute only:
    configService.getAttributes(session, serverEntryObj, null, false);
    String serverName = (String)ConfigServiceHelper.getAttributeValue(attrList, "serverName");
  • getAttribute method
    The getAttribute method queries objects for the specific attribute that you specify in the method call. Applications do not use extraneous processing with this method, because the getAttribute method searches an object for the attribute requested and ignores all others.

    Example:
    The following example is recommended. It makes one ConfigService method calls, but it gets only the single attribute that is needed:
    String serverName = (String)configService.getAttribute(session, serverEntryObj, "serverName", false);

Related Information

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Hangs\/Performance Degradation","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF012","label":"IBM i"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5;8.0;7.0;6.1","Edition":"Base;Express;Network Deployment","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SS7K4U","label":"WebSphere Application Server for z\/OS"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Hangs\/Performance Degradation","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"6.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
06 June 2019

UID

swg21251825