skip to Main Content

We are deploying Spring Boot app to the Kubernetes.
When the firs user requests comes it takes more than 10s to response.
Subsequent requests take 200ms.
I have created a warmup procedure to run the key services in @PostConstruct. I reduces the time to process the first query to 4s.
So I wanted to simulate this first call. I know that Kubernetes rediness probe can make a POST request, but I need authorization and other things. Can I make a real HTTP call to the controller from the app itself?

2

Answers


  1. Sure, you can always make an HTTP client to localhost

    The solution isnt specific to k8s or Spring or Java, but any web server

    You could also try making your readiness probe just the tcp port or some internal script

    Login or Signup to reply.
  2. try RestTemplate , you can consume any web service

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search