-
15. Re: Load-Balancing SLSB
craigduncan Nov 1, 2005 11:25 AM (in response to joff)I think I am having a similar problem to you. I have servlet that looks up the SLSB on HA-JNDI. The behaviour I see is that the only SLSB that gets called is the one living on the same JBoss instance as the servlet.
My guess is that the reason for this is the optimization that JBoss does when calling EJB's in the same JVM. Even though you attempt to do a remote call it sees that there is an EJB in the local environment and calls that one instead.
In my case, if I want load balancing of my SLSB I need to front my jboss cluster with a HTTP load balancer. -
-
17. Re: Load-Balancing SLSB
craigduncan Nov 1, 2005 12:03 PM (in response to joff)Scott,
Thanks for the response. I looked at the comments for JBAS-1442 but I am still a little confused. I am using jboss4.0.2. The comments by Adrian Brock on 22 Feb 05 seem to indicate that this problem was fixed, but I am still seeing the incorrect behavior. To get the correct behavior do I need to use one of the workarounds?
BTW, we have a support account with JBoss and when I asked this question there the response was that the only fix would be to disable the jboss otpimization altogether with the caveat that it could degrade performance.
Craig -
18. Re: Load-Balancing SLSB
starksm64 Nov 1, 2005 9:40 PM (in response to joff)Certainly disabling the call by reference invoker will fix the issue, but this should be working with the default invoker interceptor in 4.0.2. There is a org.jboss.test.cluster.test.CrossServerCallsUnitTestCase that validates repeated calls to a SLSB from a server in a cluster does in fact result in calls to both the local and peer deployment of the SLSB. The details of how the SLSB is lookedup/used would be neede to understand how load balancing might be failing to work properly. TRACE level logging of the org.jboss.invocation category should shed light on what is going on as well.
-
19. Re: Load-Balancing SLSB
craigduncan Dec 2, 2005 5:12 PM (in response to joff)I have done some more testing on this.
I turned on the TRACE for org.jboss.invocation and found some strange results. I see the TRACE logging when JBoss is starting up but when my Servlet is called and does the service lookup and subsequent call on the SLSB I do not see any TRACE code for org.jboss.transaction.
Here is a snippet from the server.log:2005-12-02 16:06:09,232 DEBUG [com.invisioninc.optimizer.web.MessageServlet] Entering doGet(request, response) 2005-12-02 16:06:09,263 DEBUG [com.invisioninc.optimizer.web.Utils] Entering extractMethodName(request) 2005-12-02 16:06:09,263 DEBUG [com.invisioninc.optimizer.web.Utils] Returning: >TestMessage< 2005-12-02 16:06:09,263 DEBUG [com.invisioninc.optimizer.web.Utils] Exiting extractMethodName(request) 2005-12-02 16:06:09,263 DEBUG [com.invisioninc.optimizer.web.Utils] Entering extractXmlRequest(request) 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] in: org.apache.catalina.connector.CoyoteReader@178b9ce 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] xmlRequest is null or empty, looking for parameter 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] Entering extractSoapBody(soapMessage) 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] Found Body begin: 0 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] Extracted Soap Body: Jaguar 2005-12-02 16:06:09,279 DEBUG [com.invisioninc.optimizer.web.Utils] Exiting extractSoapBody(soapMessage) 2005-12-02 16:06:09,279 INFO [com.invisioninc.optimizer.web.POMessageService] Getting InitialContext 2005-12-02 16:06:09,279 INFO [com.invisioninc.optimizer.web.POMessageService] Using this for jndi url: localhost:1200,localhost:1300 2005-12-02 16:06:09,279 INFO [com.invisioninc.optimizer.web.POMessageService] InitialContext established. 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.BaseStatelessBean] ENTERING void com.invisioninc.arch.services.BaseStatelessBean.setSessionContext(SessionContext) ARGS={org.jboss.ejb.StatelessSessionEnterpriseContext$SessionContextImpl@10ab67f} 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.BaseStatelessBean] EXITING void com.invisioninc.arch.services.BaseStatelessBean.setSessionContext(SessionContext) 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.BaseStatelessBean] ENTERING void com.invisioninc.arch.services.BaseStatelessBean.ejbCreate() ARGS={} 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.BaseStatelessBean] EXITING void com.invisioninc.arch.services.BaseStatelessBean.ejbCreate() 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.data.ClientInterceptorSniffer] In the client interceptor. 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.data.InvThread] Current user value is: null 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.data.ClientInterceptorSniffer] Here is userid: null 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.ServerInterceptorSniffer] - Username : null 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.services.ServerInterceptorSniffer] - User id : null 2005-12-02 16:06:09,388 DEBUG [com.invisioninc.arch.data.InvThread] Setting current user to: null 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.arch.data.HibernateInterceptor] Invoked Method: public abstract java.lang.String com.invisioninc.optimizer.data.OptimizerPilot.testMessage() throws com.invisioninc.arch.data.InvisionException,java.rmi.RemoteException 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.arch.data.HibernateInterceptor] right before invocation 2005-12-02 16:06:09,404 DEBUG [net.sf.hibernate.impl.SessionImpl] opened session 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.arch.data.ServiceLocator] Attempting to retrieve value for: HibernateFactory 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.arch.data.ServiceLocator] Returning string value: java:/HibernateFactoryOptimizer 2005-12-02 16:06:09,404 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] JNDI lookup: HibernateFactoryOptimizer 2005-12-02 16:06:09,404 DEBUG [net.sf.hibernate.impl.SessionFactoryObjectFactory] lookup: uid=402882f507ed35690107ed356d6d0000 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.arch.data.HibernateInterceptor] Created Here? true 2005-12-02 16:06:09,404 DEBUG [com.invisioninc.optimizer.services.OptimizerPilotBean] ENTERING String com.invisioninc.optimizer.services.OptimizerPilotBean.testMessage() ARGS={} 2005-12-02 16:06:09,982 DEBUG [com.invisioninc.optimizer.services.OptimizerBo] ENTERING void com.invisioninc.optimizer.services.OptimizerBo.sendTestMessage(String) ARGS={c:\jboss-4.0.2\server\clusterNode2}
I am using a custom-rmi-invoker and an extension of the container configuration for a Stateless Session Bean. Below is a snippet from my jboss.xml deployment descriptor:<invoker-proxy-bindings> <invoker-proxy-binding> <name>custom-rmi-invoker</name> <invoker-mbean>jboss:service=invoker,type=jrmpha</invoker-mbean> <proxy-factory>org.jboss.proxy.ejb.ProxyFactoryHA</proxy-factory> <proxy-factory-config> <client-interceptors> <home> <interceptor>org.jboss.proxy.ejb.HomeInterceptor</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor> <interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor> <interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor> </home> <bean> <interceptor>org.jboss.proxy.ejb.StatelessSessionInterceptor</interceptor> <interceptor>com.invisioninc.arch.data.ClientInterceptorSniffer</interceptor> <interceptor>org.jboss.proxy.SecurityInterceptor</interceptor> <interceptor>org.jboss.proxy.TransactionInterceptor</interceptor> <interceptor call-by-value="false">org.jboss.invocation.InvokerInterceptor</interceptor> <interceptor call-by-value="true">org.jboss.invocation.MarshallingInvokerInterceptor</interceptor> </bean> </client-interceptors> </proxy-factory-config> </invoker-proxy-binding> </invoker-proxy-bindings> <container-configurations> <container-configuration extends="Clustered Stateless SessionBean"> <container-name>Sniffer Stateless SessionBean</container-name> <container-interceptors> <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor> <interceptor>org.jboss.ejb.plugins.CleanShutdownInterceptor</interceptor> <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor> <interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor> <!-- CMT --> <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor> <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor> <interceptor transaction="Container">org.jboss.webservice.server.ServiceEndpointInterceptor </interceptor> <interceptor transaction="Container">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor> <!-- BMT --> <interceptor transaction="Bean">org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor</interceptor> <interceptor transaction="Bean">org.jboss.ejb.plugins.TxInterceptorBMT</interceptor> <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor> <interceptor transaction="Bean">org.jboss.webservice.server.ServiceEndpointInterceptor </interceptor> <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor> <interceptor>com.invisioninc.arch.services.ServerInterceptorSniffer</interceptor> <interceptor>com.invisioninc.arch.data.HibernateInterceptor</interceptor> </container-interceptors> </container-configuration> </container-configurations>
If you look at the server.log you can see it is going through my custom interceptors listed in the custom-rmi-invoker but it doesn't seem to be going through the interceptors listed in the "home" section of the client-interceptors.
Any ideas why the servlet would not be going through the "home" section? -
20. Re: Load-Balancing SLSB
starksm64 Dec 3, 2005 3:31 PM (in response to joff)The custom-rmi-invoker has not been associated with any container (certainly not the "Sniffer Stateless SessionBean" shown here. See the invoker-proxy-binding-name in the jboss_4_0.dtd:
<!ELEMENT container-configuration (container-name , call-logging?, invoker-proxy-binding-name?, sync-on-commit-only?, insert-after-ejb-post-create?, call-ejb-store-on-clean?, container-interceptors? , instance-pool? , instance-cache? , persistence-manager? , web-class-loader? , locking-policy? , container-cache-conf? , container-pool-conf? , commit-option? , optiond-refresh-rate? , security-domain?, cluster-config?, depends*)> <!-- The invoker-proxy-binding-name elements maps to the name element of an invoker-proxy-binding definition. Used in: container-configuration, invoker --> <!ELEMENT invoker-proxy-binding-name (#PCDATA)>
-
21. Re: Load-Balancing SLSB
craigduncan Dec 5, 2005 10:47 AM (in response to joff)We associate the SLSB to the custom-rmi-invoker in our jboss.xml file:
<session> <ejb-name>OptimizerPilot</ejb-name> <jndi-name>OptimizerPilotBean</jndi-name> <local-jndi-name>OptimizerPilotLocal</local-jndi-name> <configuration-name>Sniffer Stateless SessionBean</configuration-name> <invoker-bindings><invoker> <invoker-proxy-binding-name>custom-rmi-invoker</invoker-proxy-binding-name> </invoker></invoker-bindings> <clustered>true</clustered> <method-attributes> </method-attributes> </session>
From looking at the snippet of the server.log in my previous post I can see that it is calling the ClientInterceptorSniffer class which is listed in the custom-rmi-invoker client interceptor list. But I do not see any debug tracing where it is calling any of the classes listed in the client-interceptors "HOME" section. With the org.jboss.invocation TRACE turned on I expect to see some TRACE lines when it hits the InvokerInterceptor.