Reputation: 35
So In our organization we use GKE(GCP) to configure and deploy everything. Most of our apps are java based apps. Hence by defining normal HPA, we face 2 issues.
So to sum it up, I'm looking for a good solution/strategy using which I can scale Java apps in Kubernetes with/without using HPA feature.
I'm pretty sure I can't be the only one facing this problem. Feel free to discuss and share ideas. Thanks!
Upvotes: 0
Views: 926
Reputation: 1543
There are many ways to reduce these issues. Firstly you need to get a better understanding of your application and perform load tests along with the security tests and other tests you perform on your application.
To do this you need to have various environments like testing, non-prod and production. Let’s say three projects one for a running test environment, one for non-prod and the final one for your production. You might think having multiple environments on cloud will cost you more but cloud providers like GCP will only charge you for the resources that you have used. You might be thinking of using on-prem solutions in your laptop or desktop but the way they scale and the way scaling works in cloud providers varies and here when using cloud you have more options than the on-prem where you need to create everything from scratch.
So now the workflow is like creating three accounts in GCP or some other cloud provider to test your application performance on single node and multi node deployments or by changing the machine sizes and by using various load test simulators. Configure monitoring metrics to your application using the google stack driver/cloud monitoring(since you mentioned GCP) and analyze the resource utilization graph for a particular time period now based on this configure your HPA based on the analysis done and this will definitely optimize your billing. In general you should have done this before deploying your application, it’s still not too late to create a checklist and validate your application performance at various sizes and implement it in your production accordingly, go through this best practices document by GCP on scalability for more detailed information.
Upvotes: 1
Reputation: 13
One suggestion is using the Kubernetes API. It defines an interface through which you can modify kubernetes resources, such as defining the number of pods on a Deployment.
You can then have a service that monitors your pods’ performance, and then triggers the scaling of your application based on your metrics.
I would suggest you try it out in a local environment using minikube, and then attempt to use it in the GKE cluster.
For more info, here is the Kubernetes API for deployments: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#deployment-v1-apps
Upvotes: 0