2

We have some Wildfly servers running in standalone mode. Every single instance provides a bunch of stateless services that can be accessed through ejb remote calls (http-remoting) from some webapplications.

The outbound connection of the webapplication points to a http loadbalancer using round robin, no stickiness. This balancers checks the availability of the service applications before connecting.

This work so far, failover also.

The problem:

The number of standalone servers could vary. Once an outbound connection is established from one of the webapps it will never be closed. So always the same standalone server is reached until it would die.

The purpose that under heavy load we just start another VM running a standalone server that would also be used by the loadbalancer does not work, because no new connection is established from the webapps.

Question:

Is this a scenario that could work, and if, is it possible to configure the webapps to start a new connection after some time, requests counts, or whatever?

I tried no keep alives for tcp or http header in undertow and request idle time, but no success so far.

Kind regards

Marcus

Marcus Schulz
  • 123
  • 1
  • 6

2 Answers2

0

There is no easy way to dynamically load balance ejb remote calls due to their binary nature. The JBoss EJB client enables specifications of multiple remote connections, that are invoked in round-robin fashion, but the list is still hardcoded in your client config.

Example jboss client config jboss-ejb-client.properties:

endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=node1,node2
remote.connection.node1.host=192.168.1.105
remote.connection.node1.port = 4447
remote.connection.node1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node1.username=appuser
remote.connection.node1.password=apppassword
remote.connection.node2.host=192.168.1.106
remote.connection.node2.port = 4447
remote.connection.node2.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.node2.username=appuser
remote.connection.node2.password=apppassword

I understand, that your web application is also java based. Is there any reason why not run both the EJB layer and Web on the same server within a single .ear deployment? That way you could use local access, or even inject @EJB beans directly into your web controllers without the need to serialize all calls into binary form for remote EJB with the benefit of much simpler configuration and better performance.

If your application is actually a separate deployment then the preferred way is to expose your backend functionality via REST API(JAX-RS). This way it would be accessible via HTTP, that you could simply access from your web app and you can load balance it just like you did with your web UI(you can choose to keep your API http context private - visible only locally for the services on the same network, or make it public e.g. for mobile apps) .
Hope that helps

yntelectual
  • 3,028
  • 18
  • 24
  • Yes, thank you very much. Both approaches will be useful. The EJB backend ist shared along with Webapps, and also fat client applications. But in some points REST would be a way in mind for future refactorings. – Marcus Schulz May 08 '17 at 18:51
0

You should be using the standalone-ha.xml or standalone-full-ha.xml profile. While you might not need the ha part to manage the state of stateful beans across your cluster, you need it for the ejbclient to discover the other nodes in your cluster automatically

In effect, the load balancing is done by the ejbclient, not a separate dedicated load balancer

Will Tatam
  • 566
  • 3
  • 10
  • How would HA help in case of remote fat client? There is no way how to do automatic discovery for remote EJB hosts, therefore you still need to hardcode your connection info into your application code. HA in jBoss only adds modcluster and distributed cache for state management(Statefull session beans, http session..) - which is bad practice anyhow, if you want your app to scale. If you really want HA and scaling then API and Loadbalancer is the only way to go. – yntelectual May 09 '17 at 07:20
  • There is no way to do fully automated discovery, but once an ejbclient connects to one of the listed servers, it automatically discovers all other nodes in the cluster, including as extras are added or nodes removed. So if you say always have a server on 192.168.1.1 but sometimes scale up to 5, then you would list .1 in the properties and .2 as the second, just in case the first was down – Will Tatam May 09 '17 at 08:04