The process of monitoring the health and performance of
individual microservices in a system.
▪ The failure of a single microservice can have cascading
effects on the rest of the system, important to identify and
address issues.
▪ What is Health Checks for microservices ?
▪ Health Checks for microservices are a way to monitor the
health and performance of individual microservices in a
system.
▪ Health checks used to determine whether a microservice is
functioning properly and is able to handle requests.
▪ There are 3 types of health checks that can be used for
microservices.
xxxxxxxxxx
@Liveness
@ApplicationScoped
public class MemoryCheck implements HealthCheck {
@Override
public HealthCheckResponse call() {
MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean();
long memUsed = memoryBean.getHeapMemoryUsage().getUsed();
long memMax = memoryBean.getHeapMemoryUsage().getMax();
HealthCheckResponse response = HealthCheckResponse.named("heap-memory")
.withData("used", memUsed)
.withData("max", memMax)
.status(memUsed < memMax * 0.9)
.build();
return response;
}
}
https://openliberty.io/docs/latest/health-check-microservices.html