-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autoscaling #749
Comments
Can we use HPA for DataGrid case? |
Last time I tried to use the default HPA memory metrics I didn't get good results, mainly because of the java memory management. |
Yeah, HPA custom metrics should support, but need to be validated |
A good starting point to design HPA/operator integration could be CPU autoscaling (#274): standard CPU load metric should work quite well to control pods scaling. |
There's also Kubernetes Event-driven Autoscaling that has integrations with PostgreSQL and Redis. |
A problem with a generic container wide approach is that it does not take into account the requirements of different cache types. Replicated and Distributed caches have very different requirements when it comes to autoscaling, therefore it's necessary for any autoscaling to be configured based upon the use-cases of the Infinispan cluster. Cache Scaling SemanticsHere we define how different cache types affect scaling. Replicated Cache
Distributed Cache
ProposalImplement automatic Horizontal Scaling and require users/admins to manually perform Vertical scaling by updating the Infinispan Automatically scaling an existing cluster vertically is tricky as it can lead to the cluster becoming unavailable due to a lack of resources. Furthermore, K8s does not provide a mechanism to vertically scale OOB. Correct autoscaling behaviour is tightly coupled to an application's Infinispan requirements and cannot be implemented in a way that is applicable to all users. This proposal is concerned with how we can expose autoscaling configuration to the user so that they can define behaviour suitable for their use-case. A big part of this effort will be creating documentation that details what type of scaling is appropriate for different workloads. ImplementationBased upon the HorizontalPodAutoscaler. We extend the Infinispan CRD to define the scale subresource. The Utilising the Below is an example
User ConfigurationThe user can define scaling in one of three ways:
|
@ryanemerson, overall I like the approach. |
Can you elaborate on the issues you encountered? I'm guessing it was the JVM not releasing committed memory once it's unused?
I think this is an area where we would benefit from using Shenandoah https://stackoverflow.com/questions/61506136/kubernetes-pod-memory-java-gc-logs/61512521#61512521 |
|
We can control this with the
We could make the scale/up down behaviour be dictated by Infinispan itself using a custom metric that indicates when more/less memory is required, with the metric taking into account a lower bound to ensure that the cluster maintains at least the minimum number of pods. Exposing a custom metric is more involved than using the basic memory usage and would require an enhancement on the server side. We could start with a basic memory based approach and then enhance the auto scale feature in the future as required. Here is a quick guide on how to use custom metrics with HPA. |
Sounds good, though I would suggest to verify early how far can we go with basic metrics, imo the choice between basic vs ad-hoc metric could have broad impact (possibly even on features design?) |
Just realized that these 2 options could require some attention, I mean both the operator and the scaler would act on the |
My understanding is that implementing the scale subresource is all that's required so that HPA modifies the Infinispan |
Hi, Our use case is that we want to use KEDA Operator's ScaledObjects to control the replicas. Is there any way we can do the same with the Infinispan Operator? Like @rigazilla mentioned, currently the operator is conflicting if we attach the |
Not at present. The Infinispan CRD needs enhancing so that we expose the scale subresource for this to be possible. |
I've added the fields to the Infinispan CRD and it seems to work with KEDA. I'll continue testing it for our use case this week to see if I encounter any bugs. Are there are any use cases that I should be aware of with this change, @ryanemerson? |
Good observation, I think that will. There are ways to Pause KEDA So we could extend |
yeah |
Infinispan server upgrades should never be automatic now. Once the initial Infinispan CR version has been created it's necessary for the user to manually update the |
if we want a specific solution for Keda, then it's fine |
For us documenting it is sufficient. I've updated the PR and included how I tested it, just waiting on this: #2134. Let me know if there's anything else I could do |
No worries @ryanemerson, I've no rush in this so take your time! |
#691 deprecates the Cache Service in favour of providing the DataGrid service as the default and removing this configuration option.
Currently only the cache-service provides memory-based autoscaling, however it relies on assumptions about the cache's storage and replication type to determine when pods schould be scaled. This approach is not possible with the
DataGrid
service as users are able to use arbritrary cache configurations. Instead, we should introduce "container level" autoscaling where the number of pods increases and decreases based upon the memory usage of the entire container exceeding the configured upper or lower bound of memory usage percentage respectively.The text was updated successfully, but these errors were encountered: