OpenStack database auto-cleanup
By design, when deleting a cloud resource, for example, an instance, volume, or router, an OpenStack service does not immediately delete its data but marks it as removed so that it can later be picked up by the garbage collector.
Given that an OpenStack resource is often represented by more than one record in the database, deletion of all of them right away could affect the overall responsiveness of the cloud API. On the other hand, an OpenStack database being severely clogged with stale data is one of the most typical reasons for the cloud slowness.
To keep the OpenStack database small and performance fast, MOSK is pre-configured to automatically clean up the removed database records older than 30 days. By default, the clean up is performed for the following MOSK services every Monday according to the schedule:
To adjust the default database cleanup schedule for OpenStack services,
add the features:database:cleanup parameter block to your
OpenStackDeployment custom resource. The configuration parameter list
includes:
enabled: Toggles automatic database cleanup on (true) or off (false).schedule: Defines the cleanup frequency using a valid cron expression. You can generate and validate expressions using the Cron expression builder.age: Specifies the threshold (in days) after which stale records are deleted.batch: Specifies the maximum number of records to delete per iteration. Supported by Nova, Glance, Masakari, and Heat.
Note
The Dashboard (Horizon) service supports only enabled and schedule
parameters. Its cleanup job removes expired session records from the database.
Example configuration for OpenStack database cleanup schedule:
spec:
features:
database:
cleanup:
<OS-SERVICE-IDENTIFIER>:
enabled: true
schedule: "1 0 * * 1"
age: 30
batch: 1000