UDP Cluster Settings

See the information about both UDP multicast and UDP unicast implementations.

UDP Multicast Implementation

The UDP-based cluster implementation uses cache invalidation signals sent to all other nodes of the SAP Commerce Cluster using multicast. If a SAP Commerce item is modified on one of the nodes, the node sends a UDP multicast datagram to all other nodes informing them that the cached information on the item is invalid.

Figure: Connection Schema of a UDP-based SAP Commerce Cluster

Figure: Communication Schema of a UDP-based SAP Commerce Cluster

Configuring a UDP Multicast Based Cluster

When UDP is chosen as the communication protocol, the following settings have to be configured:

  • Multicast address, on which the node listens for cluster messages:

    local.properties

    cluster.broadcast.method.udp.multicastaddress=230.0.0.1   #this ip should be the same for all nodes,
  • Port on which the node listens for cluster messages:

    local.properties

    cluster.broadcast.method.udp.port=9997  #the same for all nodes
  • If you have many enabled network interfaces, specify the address of the interface used for communication:

    local.properties

    cluster.broadcast.method.udp.networkinterface=<logical_name_of_your_network_interface>  #use the logical interface name, e.g. eth0 . To find out the name, you can run the java code below.

Testing the Cluster

Testing is done with UDP Multicast broadcast packets. To test the configurations, use the

ant udpsniff

defined in the build.xml file in the ${HYBRIS_BIN_DIR} /resources/ant directory . Remember to use this specific category for running

ant udpsniff

.

ant udpsniff

listens to the configured port for invalidations and prints them to the console.

Run the following command on one of the other cluster nodes:

c:\data\hybris\bin\platform\resources\ant\> ant udpsniff
     ...
     [java] INFO  [DefaultBroadcastService] updating cluster island ID -1->15488775967864160
     [java] INFO  [UDPSniffer] UDP Multicast Receiver (udpsniff) configured with the following parameter:
     [java] INFO  [UDPSniffer] Interface: /0.0.0.0, NetworkInterface: null
     [java] INFO  [UDPSniffer] Receiving packets from group /230.0.0.1
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-58|1|1of1 (content: 80 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-59|1|1of1 (content: 80 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-60|1|1of1 (content: 80 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-61|1|1of1 (content: 80 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-62|99|1of1 (content: 6 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-7665975202688-63|99|1of1 (content: 28 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-25258161494096-48|1|1of1 (content: 80 bytes)]
     [java] INFO  [UDPSniffer] /192.168.146.107:[?://?|ver:4010100|15488775967864160-25258161494096-49|1|1of1 (content: 80 bytes)]

If you receive these messages, the UDP multicast connection between these nodes is correctly configured. The UDP Sniffer uses the master tenant data, therefore only UDP messages from own cluster will display.

Running the SAP Commerce Server

If you have successfully tested the clustering, you can start the application server on each cluster node.

You will receive output that looks like this:

D:\data\platform>hybrisserver.bat
[...]
INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-9001
INFO  [Http11Protocol] Initializing Coyote HTTP/1.1 on http-9002
[...]
INFO  [hybrisserver] *******************************************
INFO  [hybrisserver]
INFO  [hybrisserver] Starting up hybris Server 4.0.1.0...
INFO  [hybrisserver]
INFO  [hybrisserver] Configuration:
INFO  [hybrisserver]
INFO  [hybrisserver] Cluster:  0 (master)
[...]
INFO  [Catalina] Server startup in 12265 ms

You can see that the cluster.id is set to 0.

Troubleshooting

  • Double check that you have the same configuration for cluster.port and cluster.multicastaddress on both machines.

  • If no packets are received, for testing purposes start the UDP sniffer on the same machine on which the pings are generated. Use another command prompt window to do this.

  • If you do not get any output from using

    ant udpsniff

    , try to run this command with root privileges (on linux machines), change the log level of the rootlogger to debug. Bear in mind that this will result in massive amounts of log output, so use it only in a testing environment and only for testing purposes.

  • If you receive packets on the local machine but not on the remote one, it is possible that they are sent out using wrong network interfaces. You can change the network interface by configuring cluster.interface.

  • Check the default time-to-live (TTL) value of the packets

    The Platform does not specify a TTL and so uses the default value of the operating system. If this is set to 0, UDP packages are only processed on the local machine and are not sent to the network. TTL = 1 means that UDP packages are forwarded only in the LAN.

  • Make sure that your network interface card fully supports multicasts, both sending and receiving

  • Make sure that there is no IPv4/IPv6 issue. Try deactivating IPv6 or pinnning the tomcat process to use a specific IP stack version

    local.properties

    tomcat.javaoptions=-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false
  • If you have set up the cluster correctly and started each instance but the cache invalidation still won't work, you can enable logging of the UDP packets. Add the following line to your local.properties file:

    local.properties

    log4j.logger.de.hybris.platform.cache.udp=debug

    and restart the SAP Commerce Server.

UDP Unicast - Based Cluster Implementation

As an alternative to JGroups, it is also possible to use UDP Unicast only to send invalidation messages.

Figure: Unicast Traffic

Configuring UDP Unicast

Add the following configuration to the local.properties file:

local.properties

# define server host name or ip ( use a public ip here)
cluster.broadcast.method.unicast.serveraddress=myHostName

# define the server port
cluster.broadcast.method.unicast.port=myPort

# define all known nodes as hostnameOrIp:port 
cluster.broadcast.method.unicast.clusternodes=node1HostName:node1Port ; node2HostName:node2Port ; node3HostName:node3Port

# if the interval value is higher than 0 , the platform synchronizes its list of known nodes with all the cluster members, negative values mean that the service is disabled
cluster.broadcast.method.unicast.sync.nodes.interval=-1

If more detailed logging is necessary, add the following configuration to the local.properties file.

local.properties

log4j.logger.de.hybris.platform.cluster.PingBroadcastHandler=DEBUG
log4j.logger.de.hybris.platform.cluster.udp.UnicastBroadcastMethod=DEBUG