autoscaler icon indicating copy to clipboard operation
autoscaler copied to clipboard

Bug: Take Database Count Into Consideration

Open alexlo03 opened this issue 9 months ago • 2 comments

Hello and thank you 🙏

Error we are experiencing:

Last scaling request for {"processingUnits":100} FAILED: Too many databases to decrease instance size. Current: 74, limit: 10. Please reduce the number of databases first. The minimum number of processing units that this instance currently requires is 800.

From https://cloud.google.com/spanner/quotas#database-limits

Databases per instance For instances of 1 node (1000 processing units) and larger: 100 databases For instances smaller than 1 node: 10 databases per 100 processing units

Possible solutions:

  1. The error returns the floor PU count, so it could handle that specific error and set that as desired state. That would be around here - https://github.com/cloudspannerecosystem/autoscaler/blob/main/src/scaler/scaler-core/index.js#L681 - the issue here is that it would continuously trigger that it wants to be smaller and then get the error from spanner.
  2. Read database count as part of the metrics and take it into account in computing desired state. (Probably superior). One issue here is that the database count is not exposed as a metric, it would maybe be added to GetSpannerMetadata https://github.com/cloudspannerecosystem/autoscaler/blob/main/src/poller/poller-core/index.js#L260

alexlo03 avatar May 08 '24 14:05 alexlo03