Load Balancing
Artemis Cloud supports client-side load balancing. The MATRIXX applications use the ActiveMQ drivers however, so the features of the Artemis drivers, including client-side load balancing are not available. Artemis Cloud provides server-side load balancing between the pods that make up the ActiveMQ cluster. In addition to this, you can use a Kubernetes service lo balance load with a single address on the client side.
By default, the Artemis Cloud operator creates a headless service called artemis-broker-hdls-svc
. Do not use this service if load balancing is required because it sends all
traffic to the same pod. For Artemis Cloud connections, create a new service that uses the same selector as the headless service. The following ClusterIP
service example
provides this single address:
apiVersion: v1
kind: Service
metadata:
labels:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
name: artemis-broker-exposed
spec:
ports:
- name: console-jolokia
port: 8161
protocol: TCP
targetPort: 8161
- name: basic
port: 61616
protocol: TCP
targetPort: 61616
- name: ampq
port: 5672
protocol: TCP
targetPort: 5672
selector:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
type: CluserIP
If Artemis Cloud is installed in a separate Kubernetes cluster, use a LoadBalancer
service similar to the following:
apiVersion: v1
kind: Service
metadata:
labels:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
name: artemis-broker-exposed
spec:
ports:
- name: console-jolokia
port: 8161
protocol: TCP
targetPort: 8161
- name: basic
port: 61616
protocol: TCP
targetPort: 61616
- name: ampq
port: 5672
protocol: TCP
targetPort: 5672
selector:
ActiveMQArtemis: artemis-broker
application: artemis-broker-app
type: LoadBalancer
Create the service in the same namespace as the broker.