How do you set MAX_INBOUND_MESSAGES and MAX_OUTBOUND_MESSAGES for a remote EJB call?

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Issue

  • I put those remoting channel options in the ejb3 subsystem of my EJB server's standalone.xml. But those values seem to be not applied.
<remote connector-ref="remoting-connector" thread-pool-name="default">
    <channel-creation-options>
        <option name="MAX_INBOUND_MESSAGES" value="130" type="remoting"/>
        <option name="MAX_OUTBOUND_MESSAGES" value="130" type="remoting"/>
    </channel-creation-options>
</remote>
  • Should I try to adjust MAX_INBOUND_MESSAGES / MAX_OUTBOUND_MESSAGES settings when I get this error:
java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:TestRemote, moduleName:ejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@50e354aa

Resolution

  • If you want to set those values to be greater than 80, which is the default value, you need to set those options on the EJB client side too.

    • If your client is a standalone EJB client (Content from docs.jboss.org is not included.EJB invocations from a remote client using JNDI)
      Edit your jboss-ejb-client.properties as follows.

      remote.connections=default
      ...
      remote.connection.default.connect.options.org.jboss.remoting3.RemotingOptions.MAX_INBOUND_MESSAGES=130
      remote.connection.default.connect.options.org.jboss.remoting3.RemotingOptions.MAX_OUTBOUND_MESSAGES=130
      
    • If your client is another EAP instance that calls the EJB server (Content from docs.jboss.org is not included.EJB invocations from a remote server instance)
      Edit your remoting subsystem setting in the standalone.xml as follows.

      <remote-outbound-connection name="remote-ejb-connection" outbound-socket-binding-ref="remote-ejb" username="ejb" security-realm="ejb-security-realm">
          <properties>
              ...
              <property name="org.jboss.remoting3.RemotingOptions.MAX_INBOUND_MESSAGES" value="130"/>
              <property name="org.jboss.remoting3.RemotingOptions.MAX_OUTBOUND_MESSAGES" value="130"/>
          </properties>
      </remote-outbound-connection>
      
  • You are expected to see org.jboss.remoting3.ChannelBusyException if MAX_INBOUND_MESSAGES or MAX_OUTBOUND_MESSAGES are not large enough. Other exceptions such as "EJBCLIENT000025: No EJB receiver ***" are not related.

Root Cause

  • In EAP 6, a remote EJB call is done by the JBoss Remoting library. And JBoss Remoting negotiates those option values between a client and a server. To avoid an overflow, a smaller value between the client and the server is used. When you don't set any specific values in the client side, the default value, 80, is sent to the server side and compared to the server side value, 130 in the above example, and 80 is chosen.
  • The ChannelBusyException will happen immediately if the maximum is reached, there is no blocking behaviour as there is for thread/bean pool's

Note:

  • The MAX_INBOUND_MESSAGES / MAX_OUTBOUND_MESSAGES are the maximum number of messages that will be sent over a server connection, you could have many more clients waiting to send an EJB request/response which just wait in line to send their message. They would only timeout if an EJB invocation timeout was specified or it was an async invocation and the client cancelled the request.
  • If you set the max messages, this applies to each connection, so if you connected several remote servers or were the server being connected to from several clients, each of these connections would have the max messages that could be sent over each connection. For example if I specified a maximum of 100 and I had three clients connect to the server, then there is a maximum of 100 for each client which is a total of 300, it is NOT a global limit.
  • If a multi threaded client is used it will be ideal to run with one connection and set the MAX_*_CONNECTIONS to a higher value. There is no need to add more physical connections.
  • Consider that there are other limitations like server side thread-pool and EJB bean pools which can be the bottleneck. See tune ejb3 subsystem

Diagnostic Steps

  • As a typical tuning, EJB's max-threads, max-pool-size, and MAX_INBOUND_MESSAGES/MAX_OUTBOUND_MESSAGES are set to the same value. You may encounter org.jboss.remoting3.ChannelBusyException if MAX_INBOUND_MESSAGES or MAX_OUTBOUND_MESSAGES is not large enough.
  • IN and OUT are exchanged between a client and a server sides. That is, MAX_INBOUND_MESSAGES in the client side corresponds to MAX_OUTBOUND_MESSAGES in the server side, and vice versa.
Components
Category
Tags

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.