-
1. Re: stateless ejb load balancing wildfly
wdfink Mar 18, 2014 7:11 AM (in response to igor.dragic)The ejb invocation is prefered on the local node to prevent from unnecessary costs (i.e. serialization, network ...)
If you have a web app which is not loadbalanced with a LB in front you might separate it and run the web-app unclustered and try to invoke the EJB's installed at a backend cluster.
But from my experiance I would cluster the web-app directly
-
2. Re: stateless ejb load balancing wildfly
pferraro Mar 18, 2014 8:22 AM (in response to igor.dragic)1 of 1 people found this helpful -
3. Re: stateless ejb load balancing wildfly
igor.dragic Mar 18, 2014 10:06 AM (in response to wdfink)Thank for the reply.
My idea is to build application which would have LB in front but also I want to distribute ejb calls through cluster. I have some methods that can be break into couple of calls to the database(read only) to get speed.
Is this a bad idea? Does wildfly always make call to local ejb and in which case call is distributed?
-
4. Re: stateless ejb load balancing wildfly
pferraro Mar 18, 2014 11:12 AM (in response to igor.dragic)Wouldn't you be better off deploying your web application and EJBs to all nodes in the cluster and using local SLSB invocations? Since your load is already being distributed by the load balancer, I don't see much benefit from the additional distribution of your SLSB invocations. You'd be better off avoid unnecessary remote invocations.
-
5. Re: stateless ejb load balancing wildfly
igor.dragic Mar 19, 2014 10:14 AM (in response to pferraro)Paul Ferraro wrote:
See: https://docs.jboss.org/author/display/WFLY8/EJB+invocations+from+a+remote+server+instance
Thank you for the link. It works as described. But I have question about cluster. I want to expand this example and to call same ejb deployed in cluster environment. What address should I specify into standalone-full.xml. My cluster has two instances: 10.8.10.204 and 10.8.10.205.
If I specify 10.8.10.204 in standalone-full.xml I am getting error:
<code>
[org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager] (default task-4) Could not create a connection for cluster node ClusterNode{clusterName='ejb', nodeName='slave:server-three-slave', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='10.8.10.205', destinationPort=8330}], resolvedDestination=[Destination address=10.8.10.205, destination port=8330]} in cluster ejb: java.lang.RuntimeException: Operation failed with status WAITING
</code>
If I shutdown instance on 10.8.10.205 it works.
P.S.
I have changed client servlet where I have add for loop:
<code>
for (int i = 0; i < 10; i++) {
System.out.println(bean.greet());
}
</code>
-
6. Re: stateless ejb load balancing wildfly
pferraro Mar 26, 2014 10:39 AM (in response to igor.dragic)If I specify 10.8.10.204 in standalone-full.xml I am getting error:
What do you mean by "specify 10.8.10.204 in standalone-full.xml"? Where are you defining the address?
-
7. Re: stateless ejb load balancing wildfly
igor.dragic Mar 26, 2014 10:47 AM (in response to pferraro)I have solved that issue. I specified this:
<code>
<outbound-socket-binding name="remote-ejb1">
<remote-destination host="10.8.10.204" port="8230"/>
</outbound-socket-binding>
<outbound-socket-binding name="remote-ejb2">
<remote-destination host="10.8.10.205" port="8230"/>
</outbound-socket-binding>
</code>
in standalone-full.xml and that work as expected. Even load balancing works well. I'm now trying to deploy client application at the same cluster where ejb is deployed but I was wondering where to put above xml snippet to make this to work?
Is this possible?
Thanks.
-
8. Re: stateless ejb load balancing wildfly
pferraro Mar 26, 2014 11:16 AM (in response to igor.dragic)The node on which your client application will be deployed needs to define a remote-outbound-connection and corresponding outbound-socket-binding in its standalone-full.xml.
-
9. Re: stateless ejb load balancing wildfly
igor.dragic Mar 26, 2014 11:52 AM (in response to pferraro)My cluster is configured in domain mode following this url https://docs.jboss.org/author/display/WFLY8/WildFly+8+Cluster+Howto.
Do I need to put remote-outbound-connection and corresponding outbound-socket-binding in standalone-full.xml because config files for this mode are domain.xml and host.xml?
-
10. Re: stateless ejb load balancing wildfly
wdfink Mar 26, 2014 11:54 AM (in response to igor.dragic)You might have a look to the ejb-multi-server quickstart.
The configuration is in the appropriate profile of domain.xml
-
11. Re: stateless ejb load balancing wildfly
pferraro Mar 26, 2014 11:57 AM (in response to igor.dragic)Oh - I didn't realize you were using the domain controller. outbound-socket-bindings per <server/> would go in host.xml, within the <servers/> section.
-
12. Re: stateless ejb load balancing wildfly
wdfink Mar 26, 2014 12:20 PM (in response to pferraro)I thought it was configured per profile in domain.xml, host.xml/server can only set a different socket-binding-group or a specific offset.
Or am I wrong?
-
13. Re: stateless ejb load balancing wildfly
pferraro Mar 26, 2014 2:12 PM (in response to wdfink)Sorry - I misspoke. In host.xml, you'd specify the socket-binding-group to use for that server, the definition of which contains the the outbound-socket-binding.
-
14. Re: stateless ejb load balancing wildfly
igor.dragic Mar 27, 2014 9:46 AM (in response to pferraro)Thank both of you for replies. I have make some progress but now i'm facing a strange issue.
I have created two server groups - one for server app and one for client app. My goal is to deploy and client and server app to cluster.
Deployment of server app is done without problems. Deployment of client apps causing this error:
On master node:
<code>
[Server:web-client] 13:30:01,190 INFO [org.jboss.ejb.client.remoting] (default task-5) EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
[Server:web-client] 13:30:01,199 INFO [org.jboss.ejb.client.remoting] (MSC service thread 1-1) EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@66321800, receiver=Remoting connection EJB receiver [connection=Remoting connection <4f4f0770>,channel=jboss.ejb,nodename=slave:web-server-slave]} on channel Channel ID 987816ab (outbound) of Remoting connection 5303f245 to test/10.8.10.205:8380
[Server:web-client] 13:30:01,982 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017534: Registered web context: /client-app-web
[Server:web-client] 13:30:02,219 INFO [org.jboss.as.server] (host-controller-connection-threads - 1) JBAS018559: Deployed "client-app-ear-1.0-SNAPSHOT.ear" (runtime-name : "client-app-ear-1.0-SNAPSHOT.ear")
[Server:web-client] 13:30:06,301 INFO [org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager] (ejb-client-cluster-node-connection-creation-4-thread-2) Could not create a connection for cluster node ClusterNode{clusterName='ejb', nodeName='master:web-server', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='10.8.10.204', destinationPort=8380}], resolvedDestination=[Destination address=10.8.10.204, destination port=8380]} in cluster ejb: java.lang.RuntimeException: Operation failed with status WAITING
[Server:web-client] at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:94) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at org.jboss.ejb.client.remoting.ConnectionPool.getConnection(ConnectionPool.java:77) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at org.jboss.ejb.client.remoting.RemotingConnectionManager.getConnection(RemotingConnectionManager.java:51) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:79) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:405) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.call(ClusterContext.java:379) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
[Server:web-client] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_40]
[Server:web-client] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_40]
[Server:web-client] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_40]
[Server:web-client] at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_40]
[Server:web-client]
</code>
Same error is on the slave node except that address is 10.8.10.205. It's like client can not make connection to server on the same host.
When I run application with http://10.8.10.204:8580/client-app-web/Test all ejb calls are executed on 10.8.10.205 (slave). When I run application with http://10.8.10.205:8580/client-app-web/Test all ejbs are executed on 10.8.10.204.
My config in host.xml on 10.8.10.204 is:
<code>
<servers>
<server name="web-client" group="client-web-app" auto-start="true">
<socket-bindings port-offset="500"/>
</server>
<server name="web-server" group="server-web-app" auto-start="true">
<socket-bindings port-offset="300"/>
</server>
</code>
Config in host.xml on 10.8.10.205 is:
<code>
<servers>
<server name="web-server-slave" group="server-web-app" auto-start="true">
<socket-bindings port-offset="300"/>
</server>
<server name="web-client" group="client-web-app" auto-start="true">
<socket-bindings port-offset="500"/>
</server>
</servers>
</code>
Relevant part of domain.xml on both machines is:
<code>
<subsystem xmlns="urn:jboss:domain:remoting:2.0">
<endpoint worker="default"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
<outbound-connections>
<remote-outbound-connection name="remote-connection-war-ejb-1" outbound-socket-binding-ref="remote-war-1" username="ejb" security-realm="ejb-security-realm-1" protocol="http-remoting">
<properties>
<property name="SASL_POLICY_NOANONYMOUS" value="false"/>
<property name="SSL_ENABLED" value="false"/>
</properties>
</remote-outbound-connection>
<remote-outbound-connection name="remote-connection-war-ejb-2" outbound-socket-binding-ref="remote-war-2" username="ejb" security-realm="ejb-security-realm-2" protocol="http-remoting">
<properties>
<property name="SASL_POLICY_NOANONYMOUS" value="false"/>
<property name="SSL_ENABLED" value="false"/>
</properties>
</remote-outbound-connection>
</outbound-connections>
</subsystem>
</code>
<code>
<server-groups>
<server-group name="server-web-app" profile="ha">
<jvm name="default">
<heap size="64m" max-size="512m"/>
</jvm>
<socket-binding-group ref="ha-sockets"/>
</server-group>
<server-group name="client-web-app" profile="default">
<jvm name="default">
<heap size="64m" max-size="512m"/>
</jvm>
<socket-binding-group ref="standard-sockets"/>
</server-group>
</server-groups>
</code>
and this
<code>
<socket-binding-group name="standard-sockets" default-interface="public">
<!-- Needed for server groups using the 'default' profile -->
<socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
<socket-binding name="http" port="${jboss.http.port:8080}"/>
<socket-binding name="https" port="${jboss.https.port:8443}"/>
<socket-binding name="txn-recovery-environment" port="4712"/>
<socket-binding name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost" port="25"/>
</outbound-socket-binding>
<outbound-socket-binding name="remote-war-1">
<remote-destination host="10.8.10.204" port="8380"/>
</outbound-socket-binding>
<outbound-socket-binding name="remote-war-2">
<remote-destination host="10.8.10.205" port="8380"/>
</outbound-socket-binding>
</socket-binding-group>
</code>
Ping and telnet works as expected. Any ideas?
Thanks.