vacuum

Usage

$ vars [global options] vacuum [options]

Arguments

-k | --keep=<count>
Specify the number of latest key items to keep. Keys older than the <count> value will be deleted. Can be used along with --time. Must use one or both of --keep and --time.
-t | --time=<time>
Specify the time period of latest key items to keep. Keys older than the <time> value will be deleted. Use h for hours, m for minutes and s for seconds. If the item has ttl=0 and deleted=0 then it is not deleted. Can be used along with --keep. Must use one or both of --keep and --time.

Options

Global options are detailed here.

-d | --ddb-table-name=<name>
Specify the DynamoDB table name to use. Default is fugue-vars-store.
-r | --region=<name>
Specify the target AWS region.
-f | --full
Vacuum aggressively; this will consume most available capacity. Default is false.
-h | --help
Show help message.

Definition

The vacuum command runs garbage collection, deleting expired keys and outdated versions of keys. When invoked with the -t | --time=<time> option, it deletes key items older than the specified time. When invoked with the -k | --keep=<count> option, it preserves the specified number of latest key items and deletes older key items. You may declare a target region with -r | --region=<name> and a target Vars table in DynamoDB with -d | --ddb-table-name=<name>. You may also elect to vacuum aggressively by setting the -f | --full option, which decreases the delay between vacuum deletes but also consumes more DynamoDB read/write capacity.

vacuum can be run with a cron job. The Fugue Conductor runs vacuum in this way every hour to delete expired keys and key versions that are greater than 24 hours old from the fugue-vars-store DynamoDB table.

Examples

Using the --keep and --time options together

You can use the -k | --keep option in conjunction with -t | --time. Vars prioritizes the options in a way that results in a greater number of deleted keys.

For example, if you have 100 key items in your Vars DynamoDB table, 75 of which are more than 5 minutes old, you can use -k 50 and -t 5m, and vacuum will prioritize the -t option, which results in a deletion of the 75 oldest keys:

vars -v vacuum -k 100 -t 5m

Note

The -v option in the command above enables verbosity mode, which in this case reports how many key versions are deleted for each key.

Similarly, if you have 100 key items in your Vars DynamoDB table, 75 of which are more than 5 minutes old, you can use -k 10 and -t 5m, and vacuum will prioritize the -k option, which results in a deletion of the 90 oldest keys:

vars -v vacuum -k 10 -t 5m

Use h for hours, m for minutes, and s for seconds with the -t | --time option.

Using the --full option to decrease delay between vacuum deletes

Use the -f | --full option to vacuum aggressively, which removes the delay between vacuum deletes. This consumes more of your DynamoDB read/write capacity.

For example, the following command deletes all but one key item in your Vars DynamoDB table, and deletes them immediately, rather than using a delay between deletes:

vars -v vacuum -k 1 --full

This also creates a spike in consumed capacity. You can check your DynamoDB capacity at any time by visiting the DynamoDB Dashboard in the AWS Console. Click on “Tables” in the left sidebar, select your table name from the list (default table name is fugue-vars-store), and then click on the “Capacity” tab to adjust your read/write capacity units. You can also click on the “Metrics” tab to see CloudWatch graphs of consumed read/write capacity, put latency, and other metrics.