Health checking
The health checking process is performed by Main Server by periodically connecting to microservices' TRANSMISSION PORT and getting information about their runtime parameters (cpu, memory, threads etc.). The following picture shows this process on the example of WebApp1
and Microservice A
microservice (it's done for all microservices controlled by Main Server).
The data collected during health check is then processed by availability script (in JavaScript) defined by checkAvailableScript
parameter, located in microservice's configuration file (to get to know more see this chapter)
The default script is as follows:
function isAvailable(checkResponseTimeInMillis, jrmcActiveThreads, jrmcMaxThreads,
queueActiveThreads, queueMaxThreads, servletActiveThreads, servletMaxThreads,
jvmMaxMemoryInBytes, jvmTotalMemoryInBytes, jvmFreeMemoryInBytes,
jvmProcessCpuLoadInPercentage, userAvailableFlag) {
var isAvailableByUser = Boolean(userAvailableFlag);
if(checkResponseTimeInMillis > 20000 || !isAvailableByUser) {
return false;
}
return true;
}
If it returns true
the microservice is set available, in case of false
the load balancer sets the microservice as unavailable. Note that this mechanism can be individually adopted to the characteristic of each microservice.
What's more, you can implement you own service performing more advanced and customized health checking tasks (for example, involving database), which aggregated result can be provided to the availability script by boolean value userAvailableFlag
parameter. The only thing you should do is set userAvailableFlag
in your service accordingly through System.setProperty
command in JAVA code.
You can also enable external health checking for edge balancer. Read more about it here.