Reputation: 1360
I would like to save sources (RAM and CPU) for real-time classification function and I used scale to zero in MLRun/K8s, but it did not work, see information from Grafana (I expected zero replicas after 2 minutes from last call):
I used this code with scale to zero after 2 minutes (idle-time duration):
fn.spec.replicas = 1
fn.spec.min_replicas = 0
fn.spec.max_replicas = 2
fn.set_config(key="spec.scaleToZero.scaleResources", value=[{"metricName":"nuclio_processor_handled_events_total",
"windowSize" : "2m",
"threshold" : 0}])
Did you have the same issue?
Upvotes: 0
Views: 101
Reputation: 1360
I got it. It was simple mistake on my side, I have to remove only this part of code fn.spec.replicas = 1
, see full valid code:
fn.spec.min_replicas = 0
fn.spec.max_replicas = 2
fn.set_config(key="spec.scaleToZero.scaleResources", value=[{"metricName":"nuclio_processor_handled_events_total",
"windowSize" : "2m",
"threshold" : 0}])
Upvotes: 0