What is the recommended way to scale spring boot service running in a kubernetes cluster?

3/10/2018

Spring boot has option to increase number of threads of underlying embedded server (server.tomcat.max-threads).

When its deployed through kubernetes there is also an option to increase number of replicas (kubectl scale).

If the kubernetes cluster is deployed on a cloud (say gcp) there is also an option to increase number of nodes (gcloud container clusters resize )

To add to this there are auto scaling options as well (both at pod and node level).

So what is the recommended way to scale a spring boot service?

-- Prashant Bhate
google-cloud-platform
horizontal-scaling
kubernetes
spring-boot

2 Answers

3/10/2018

Better is a kubernetes scale, because kubernetes make additional replicas and controll it(like health check). I recomend to use horizontal autoscaler. Horizontal autoscaler will self desired when you need more replicas.Docs about horizontal autoscaler https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/

-- trigun117
Source: StackOverflow

3/12/2018

For kubernetes, it is better to have your pod work at a consistent level, so increasing number of threads may not be the best option.

Using replica sets and Horizontal Pod Autoscaler is your best bet to make sure your deployment scales up. Make sure to configure resource requests and limits on your deployment (which is why consistent pod resource consumption is useful).

Finally, it is recommended to enable node autoscaling so that your cluster will always have enough resources to accommodate your scaling pod deployment.

-- Patrick W
Source: StackOverflow