There are two mechanisms for deleting a key in the open-source Redis:
l Lazy deletion: Before a read/write command is executed, the key to be accessed is checked for whether it has expired. If it has expired, it will be deleted. If the key has not expired, the command execution resumes.
l Scheduled deletion: Implemented by a Redis scheduled task. Each time the task is executed, a certain number of keys are randomly collected from the keyspace for inspection and expired keys are deleted.
DCS provides expired key scanning capabilities. Scanning expired keys will perform a Redis scan on the keyspace to release the memory space that has expired but has not been released due to the lazy deletion mechanism.
Note:
Expired key scanning supports manual triggering and scheduled triggering.
This scan is performed on the leader and will affect instance performance.
Expired key scanning consumes CPU resources and is recommended to be performed during off-peak hours.
Before You Begin
A DCS Redis cluster version instance that has been successfully created and is running.
Procedure
1. Log in to the Redis management console.
2. In the upper left corner of the management console, select the region where the instance is located.
3. On the instance list page, click the target instance name to go to the instance details page.
4. On the instance details page, click metric monitoring on the main menu, and then select scan expired keys. You can choose to scan immediately or automatically:
l Scan now: Click Scan Now to scan expired keys. After the scan is completed, the scan record will be displayed on the page.
l Automatic scan: Check Automatic Scan. On the automatic scan settings page, set the time for the first scan, scan interval, scan timeout, and number of keys to iterate, and then click save to trigger the automatic scan task.