Websphere user registry get users for group performance/delay

433 Views Asked by At

I have the following jsp that I am deploying to WAS where I have my LDAP configured using Federated repository.

<%@page import="com.ibm.websphere.security.UserRegistry"%>
<%@page import="com.ibm.websphere.security.Result"%>
<%@page import="java.io.PrintWriter"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="java.util.*"%>

<html>
<head>
<title>
test user's group
</title>
</head>
<body>
<%!
String group = "my_test_group";

%>
<%

String req = request.getParameter ("group");
if (req != null) {
group = req;
}

%>
<form method="post" action="<%=request.getRequestURI()%>">

Enter Group Name:<input type="text" value="<%=group%>" name="group"/><br>
<input type="submit" value="submit"/>

</form>
<br>
<%

InitialContext ctx = new InitialContext();
UserRegistry userRegistry = (UserRegistry) ctx.lookup("UserRegistry");
try {
        long start = System.currentTimeMillis();
        Result result = userRegistry.getUsersForGroup(group, 0);
        long end = System.currentTimeMillis();
        List list = result.getList();
        out.println ("call took " + (end - start) + " milliseconds<br>");
        out.println (list.size() + " users for " + group + "<br>");
        for (int i=0;i<list.size();i++) {
        String name = (String) list.get(i);
        out.println (name + "<br>");
        }
}
catch (Exception e) {
    PrintWriter pw = new PrintWriter (out);
%>
    There was an error getting the users for the group <%=group %><br>
    <pre>
        <%
        e.printStackTrace (pw);
        %>
    </pre>
    <%

}
%>
</body>
</html>

When I hit this jsp via WebSphere, I don't get a response for roughly 150s+ for some of my LDAP groups. Now the interesting part is that when I run the same query against LDAP directly (using LDAP browser query) from the same WAS host, I get sub second response times.

Is it the JSP code that is doing something weird? Or WAS doing something weird or both? Any thoughts/pointers are greatly appreciated.

1

There are 1 best solutions below

0
On

Looks like all consequent runs are taking much less, so, seems like a VMM caching thing. WAS Virtual member manager caches the query results from repositories (for example, an LDAP server).

You need to monitor the status of the cache and makes adjustments to the cache control parameters to improve the performance of the cache. Because the WebSphere Dynamic Cache (DynaCache) is used as the implementation of the virtual member manager cache, you can utilize the tools and services provided by WebSphere DynaCache to monitor the virtual member manager cache.