This is a JGroups protocol implementation based on HTTP/2.
JGroups is a messaging toolkit to form clusters. Nodes can discover each other, reliably send messages to other nodes or to the whole cluster and detect failure of other nodes.
JGroups is often used on a UDP-based node communication protocol, which has the advantage of being really fast, but still reliable. Using JGroups over HTTP/2 may look like a strange idea, but it has enormous advantages:
-
A bullet proof web server (like Tomcat or Jetty) can be used to handle incoming messages
-
Transport encryption over HTTPS is secure, not too hard to do right and used everywhere today.
-
Cloud applications that listen to a HTTPS port anyway, don’t need another open port to handle cluster messages
-
All authorization and authentication methods provided by the Servlet web server of your choice or by third party frameworks can be used for cluster messaging. This includes client certificates for authentication and Spring Security for authentication and authorization.
-
The HTTP/2 protocol is size optimized, compared to earlier HTTP versions.
-
With HTTP/2, there is only one open socket connection when communicating with another node. Connections are re-used by default and there is no connection pool. One connection can be used pseudo-concurrently, thanks to HTTP/2 frames.
This projects is licensed under Apache License 2.0.
Maven dependency:
<dependency>
<groupId>de.mklinger.jgroups</groupId>
<artifactId>jgroups-http2</artifactId>
<version>2.1</version>
</dependency>
Deploy JGroupsServlet
into your Jetty, Tomcat or similar web server.
HTTP/2 should be enabled on the web server to get best performance.
Configure the servlet using servlet init parameters or system properties.
In the tables below, names of servlet init parameters are given. System
properties have the same name prefixed with "de.mklinger.jgroups.http."
.
Init Parameter | Description | Default Value |
---|---|---|
|
The JGroups cluster name to use when connecting |
|
|
The JGroups channel name, i.e. the name for the local node in the cluster |
Generated by JGroups using the hostname and a random number, e.g. "linux-3442" |
|
Connect to the cluster on servlet startup. If set to |
|
|
Maximum size for JGroups messages. |
|
|
JGroups config file. |
|
Init Parameter | Description | Default Value |
---|---|---|
|
External address where other nodes can reach this node. Must match server certificate’s name (or SAN) for HTTPS hostname verification. |
|
|
External port where other nodes can reach this node. |
|
|
HTTP client settings. Comma separated key=value pairs. See below. |
Init Parameter | Description | Default Value |
---|---|---|
|
Comma separated list of host:port addresses used for node discovery,
e.g. |
Client settings go to the servlet init parameter protocol.mklinger.HTTP.client_props
as a comma separated list of key=value pairs.
Client setting | Description | Default Value |
---|---|---|
|
Client certificate with private key. Used when connecting other nodes. |
|
|
The key store password |
|
|
The key password |
|
|
Server certificates and/or CAs to trust when connecting other nodes |
|
|
Trust store password |