line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.78k stars 906 forks source link

More `HealthChecker` implementations #1854

Open trustin opened 5 years ago

trustin commented 5 years ago
huydx commented 5 years ago

@trustin any idea about how upstream server could propagate its state (like memory/disk..) to client side?

trustin commented 5 years ago

You can add more than one health checker when you build a HealthCheckService, then a load balancer or HealthCheckedEndpointGroup will notice when any of the HealthCheckers becomes unhealthy.

huydx commented 5 years ago

ah, seems I mistaken that you mean client side HealthChecker but seems that you talk about server side HealthCheck service, that should make sense

4whomtbts commented 4 years ago

@trustin When I was working on healthChecker for my project and I thought that It would be good If Armeria has those healthChecker implementations as default :) !

Could I work on this issue?

trustin commented 4 years ago

Sure. Please tell us what kind of health checkers you'd like to implement first, though. :-)

4whomtbts commented 4 years ago

Sure. Please tell us what kind of health checkers you'd like to implement first, though. :-)

@trustin

  1. Memory based healthChecker Q : Do you want to the healthiness is determined by server's heap memory usage or system's memory usage? Either that or, provide both of them?

  2. disk usage rate based healthChecker

Plus, what I want to suggest to implement is CPU based healthChecker that the healthiness is determined by average CPU usage which is a result of calculation of average during certain period of time(given by programmer) not by CPU rate at the moment It's asked.

In example,


public final class CpuBasedHealthChecker implements ListenableHealthChecker { 
  ... abbreviate .. 

 public CpuBasedHealthChecker(TimeUnit unit, long interval, double threshold) {}

 @Override
 public isHealthy() {
      return true when average of CPU usage rate in given interval is less than threshold
      return false otherwise.
 }
} 

HealthChecker cpuBasedHealthChecker

           = new CpuHealthChecker(TimeUnit.MINIUTES, 10, 0.8); 

My reservations are that It could be a little bit ridiculous, because It should memorize and calculate periodically to determine whether It's healthy or because It's practically not usable.

What do you think about that?

Is it little bit ridiculous idea for healthChecker or inappropriate to be provided as default implementation?

Bue-von-hon commented 1 year ago

could i continuing this issue?

ikhoon commented 1 year ago

Sure, it's all yours.

Bue-von-hon commented 1 year ago

@ikhoon i sent out PR #4673 please take a look 🙏

lazmond3 commented 1 year ago

@minwoox I also submitted a draft Pull request #4711 about this issue. Please take a look at it when you have a moment.

Bue-von-hon commented 3 months ago

Looks like there was a follow-up. I'll add more health checkers, such as disk usage based. If there's still work to do on the memory health checker by the time I merge this, I'll follow up on that as well, @lazmond3. 🙇🏻‍♂️ Thanks.

Bue-von-hon commented 3 months ago

My friend @AnneMayor wants to join, so I recommended this issue. @AnneMayor will implement a disk usage-based health checker. Please refer to the link below and implement a health checker based on disk usage.

link: https://github.com/micrometer-metrics/micrometer/blob/8339d57bef8689beb8d7a18b429a166f6595f2af/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/system/DiskSpaceMetrics.java

P.S. There are several options, but this seems like a good place to start.

AnneMayor commented 3 months ago

Thanks @Bue-von-hon :) I will look into the issue. I am going to open PR until June 18

AnneMayor commented 2 months ago

It might be a little long to open PR. I need more time to review. I will let you know today when I could complete it.