Using a Load balancer for remote EJB invocations in EAP 7 / EAP 6

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.2+
    • 7.1
    • 7.0
    • 6.x

Issue

  • With EAP 7.0, the docs say that it is possible to setup EAP 7.0 as a load balancer. Since EJB remoting uses http/websockets, can we front a load balancer for my EJBs exposed for remote invocation and use it to load balance ?
  • Is it possible to use a load balancer in front of an EJB invocation in EAP 7.2?

Resolution

JBoss EAP 7.2+

Starting in EAP 7.2, there was a feature added to do EJB over HTTP which can be used through a load balancer.

The recommendation, however, is to use this feature with homogeneous clusters, meaning clusters where its nodes do not have different sets of deployments, due to inherent limitations of the design of EJB over HTTP. This will avoid not finding the EJB ( i.e. returning 404) when the EJB's are balanced using the http-invoker (default context path: /wildfly-services).

Finally, it can be normal behavior for a load balancer to send all invocations to the same backend node in a cluster if there are no concurrent invocations on the load balancer.

Note: When using HTTP to load balance EJB using Apache Httpd, use ProxyPreserveHost to pass Host: line from the incoming request to the proxied host, instead of the hostname specified in the ProxyPass line.

EAP 7.2 Release notes - CHAPTER 2. NEW FEATURES AND ENHANCEMENTS

EAP 7.2 documentation - 5.7. EJB Invocation Over HTTP

Invoking EJBs / JNDI / JMS over HTTP in JBoss EAP 7.2 / 7.1 with or without a Load Balancer

JBoss EAP 7.1

EAP 7.1 had the EJB over HTTP feature as Technology Preview

JBoss EAP 7.0

NO, although it does use the HTTP port, it switches the protocol (so it's not actually HTTP), and therefore wouldn't work through a load balancer. And all of the load balancing/failover is done in the EJB client. Remoting runs over the http port 8080, but is uses http-upgrade, so remoting will use http initially to connect, but then it uses http-upgrade and switches to the remoting protocol and it uses a persistent connection. So the load balancer might route the connection to a node, but remoting is going to keep that connection open and the load balancer has no concept of the remoting protocol. It is not recommended to put a load balancer in between as unexpected behavior could occur.

JBoss EAP 6.x

Remote EJBs use the remoting protocol over port 4447. Remoting uses a persistent connection, so if it is routed through a load balancer, remoting will connect to the host it is routed to and keep that connection open, so the load balancer has no effect and is not recommended as it could cause other unexpected behaviors.

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.