<p>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.</p>
<ol>
<li>Say we scale up when we reach 70% of the total capacity for that app. Many times, the time delay provided for scale up is not sufficient for new pods to come up and start running. And its not standardized because we deal with many apps.</li>
<li>The obvious choice seems like &quot;then just do a scaling at 50%&quot;. Not as simple as it sounds. By decreasing the threshold which can now be easily met, We observed there were very large number of pods spawning and being removed which is difficult to deal with as it also frequently fluctuates the number of nodes in our cluster(unnecessarily).</li>
</ol>
<p>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.</p>
<p>I'm pretty sure I can't be the only one facing this problem. Feel free to discuss and share ideas. Thanks!</p>

Sam M.
<p>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.</p>
<p>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.</p>
<p>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 <a href="https://cloud.google.com/kubernetes-engine/docs/best-practices/scalability" rel="nofollow noreferrer">best practices document</a> by GCP on scalability for more detailed information.</p>
