admin管理员组

文章数量:1289542

We recently migrated our applications from Java 17 to Java 21 to leverage VirtualThreads. We used to scale our applications based on tomcat blocked threads count

Now since we started leveraging VirtualThreads,is there anyway we can emit VirtualThread metrics so that we can autoscale based on the metrics? Or any other best practices

We recently migrated our applications from Java 17 to Java 21 to leverage VirtualThreads. We used to scale our applications based on tomcat blocked threads count

Now since we started leveraging VirtualThreads,is there anyway we can emit VirtualThread metrics so that we can autoscale based on the metrics? Or any other best practices

Share Improve this question edited Feb 20 at 11:03 user29725406 asked Feb 20 at 10:38 user29725406user29725406 11 bronze badge 2
  • Good question! Since Virtual Threads work differently from platform threads, traditional blocked thread metrics may not be as useful. Are you using a specific autoscaling mechanism (e.g., Kubernetes HPA, AWS Auto Scaling) or a monitoring tool like Micrometer, Prometheus, or JFR? Knowing this could help suggest the best way to collect and expose Virtual Thread metrics for scaling. – Natan Cox Commented Feb 21 at 8:26
  • Thanks @NatanCox We are leveraging Kubernetes HPA which scales based on external prometheus metrics (Keda is being used) – user29725406 Commented Feb 21 at 10:38
Add a comment  | 

1 Answer 1

Reset to default 0

It seems that Micrometer supports virtual thread metrics, cfr https://docs.micrometer.io/micrometer/reference/reference/jvm.html#_java_21_metrics.

As mentioned in the documentation, you need the io.micrometer:micrometer-java21 dependency.

本文标签: spring bootAutoscale based on Virtual ThreadsStack Overflow