This discussion is archived
1 Reply Latest reply: Aug 31, 2011 10:57 AM by Felipe RSS

Stateless session beans and idle timeouts (weblogic 10.3.1)

885400 Newbie
Currently Being Moderated
Need clarification about stateless session beans and the idle-timeout-seconds setting.
Situation is this – we have a process that is timing out due to an API call to a very slow Authentication server.
I am trying to resolve this with a code change, but need to further other understand what the server is actually doing.
We have a session bean which calls another which is calling a util class that does all the work and returns the results back up to the initial session bean. I have left out the ejbName in these examples (it’s irrelevant here).

Example:

SessionBean1 // basically called just once a day
@Session(defaultTransaction = Constants.TransactionAttribute.SUPPORTS,
enableCallByReference = Constants.Bool.TRUE,
type = Session.SessionType.STATELESS,
transTimeoutSeconds = "0",
initialBeansInFreePool = "0",
maxBeansInFreePool = "20")

Methods
@RemoteMethod() public boolean getUserList(String adminGroup) {
...
Map usrList = getUserList(adminGroup);
...
}

Private Map getUserList(String adminGroup) {
...
     return SessionBean2.getUsers(adminGroup);
...
}

SessonBean2
@Session(defaultTransaction = Constants.TransactionAttribute.SUPPORTS,
enableCallByReference = Constants.Bool.TRUE,
type = Session.SessionType.STATELESS,
transTimeoutSeconds = "0",
initialBeansInFreePool = "3",
maxBeansInFreePool = "20")

Method
@RemoteMethod() public Map getUsers(String adminGroup) throws RemoteException {
return javaUtilClass.getUsers(adminGroup);
}


JavaUtilClass

Method
public Map getUsers(String adminGroup) throws RemoteException {
     ...
     // This is where the work happens, calling the Authentication server to get a complete
     // list of users for an admin group. When the user list is around 1500 entries, this can
     // take an hour. Did I mention this server is very slow? It’s about this threshold of 1500
     // that causes the timeout.
     ...
     return Map of users
}


First thought, just bump the idle-timeout-seconds setting for the session beans (from the default 600), but that would be a temporary solution until the user list grew larger.

Second thought, refactor the call to the Authentication Server API to get the user list in blocks of data (say 400 at a time) and decreasing the call/response time between the method getUsers and the API call. This would still occur in the JavaUtilClass, so I am unsure this would make a difference. The session beans would still be idle and subject to timeout, correct?

Would setting initialBeansInFreePool to 1 in SessionBean1 make any difference?

Or should I be looking at replicating the re-factored method from the JavaUtilClass in SessionBean1 where the user list is being used so that the API calls come back to it and keep it 'active'?

Thanks for any advice you could give me on this.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points