i have multiple spring boot apps running, and I'm creating a load balancing controller of some sort,
is there a way to find out which nodes are loaded more than others,
loaded meaning with running sessions, or requests.
CodePudding user response:
You can use metric based monitoring for that. Depending on your context you can use the provided infrastructure of your cloud provider or hosting provider.
if you operate the nodes yourself you can use the opensource solution https://prometheus.io/ with node_exporter
for machine metrics. Spring actuator provides prometheus metrics export with https://micrometer.io/ and if a metric, like number of sessions, is missing, you can easily extend it with your own metrics.
CodePudding user response:
The Spring Boot Production Ready Features, aka Actuator, provides various metrics such as CPU usage, JVM stats, latencies, sessions, Spring MVC and WebFlux metrics, etc that are backed by Micrometer. The metrics can then be further integrated with various metrics systems such as JMX, DataDog, Prometheus, New Relic to name a few.
Please read the Micrometer: Spring Boot 2's new application metrics collector blog post and the Spring Boot Actuator Web API Documentation for more information.