1

We have a Spring Boot microservice which should get some data from old / legacy system. This microservice exposes external modern REST API. Sometimes we have to issue 7-10 requests to the legacy system in order to get all the data we need for single API call. Unfortunately we can't use Reactor / WebClient and have to stick with WebServiceTemplate to issue those "legacy" calls. We can't also use Reactive Spring WebClient - Making a SOAP call

What is the best way to scale such a miroservice in Kubernetes? We have very big concerns that Thread Pool used for parallel WebServiceTemplate invocation will be depleted very fast, but I'm not sure that creating and exposing custom metric based on active threads count / thread pool size is a good idea.

Any advice will be helpful.

tillias
  • 1,035
  • 2
  • 12
  • 30
  • I am not sure if I understand what you are looking for. Do you have any metrics in your hand to understand what will be the load etc.? If so then you would know what would be the necessary max number of connection/thread and you can scale it in 2 different ways: scale by increasing the number of threads in the pool and the other one is increasing the number of instances. – cool Sep 14 '20 at 07:50

1 Answers1

1
  1. Enable Prometheus exporter in Spring

  2. Make sure metrics are scraped. You're going to watch for a threadpool_size metric. Refer your k8s/prometheus distro docs to get prometheus service discovery working for you.

  3. Write a horizontal pod autoscaler (HPA) based on a Prometheus metric:

Depending on what k8s distro you are using, you might have different ways to get the Prometheus and prometheus discovery:

Max Lobur
  • 5,662
  • 22
  • 35