Set de-fragmentation schedules
De-fragmentation is a required process as fragmented data can lead to performance issues. Users can schedule to run this process during periods of low workloads, avoiding any interference and improving performance.
Limitations:
- Not supported with the PX-StoreV2 backend
Set a defragmentation schedule
Users can use CLI commands to set up periodic defragmentation schedules during periods of low workloads. Multiple defragmentation schedules can be configured within a cluster; however, only one schedule is allowed per node. The --include-nodes option allows you to specify a list of nodes that the defrag schedule will run on.
Use the following command to set up a defragmentation schedule on a node:
pxctl cluster defrag schedule create \
--start-time <start-time> \
--max-duration-minutes <duration-of-defrag> \
--include-nodes <nodes-to-be-included-in-the-defrag-run>
--node-selector <label1=value1,label2=value2>
Portworx inteprets the start-time in UTC, not in the system's local time zone. Therefore, when configuring a defragmentation schedule, ensure that you convert your intended time to UTC when defining the schedule.
The following flags can be used to set up the schedule:
--start-time: Specifies the start time of the run and can be set in the following formats:daily=19:15(starts at 19:15 UTC every day)weekly=Sunday@19:15(starts at 19:15 UTC every Sunday)monthly=22@19:15(starts at 19:15 UTC on the 22nd day of every month)
--max-duration-minutes: Specifies the duration of each run (end time = start time + max duration).--include-nodesand--exclude-nodes: Specify the comma-separated UUIDs of the nodes to be included or excluded from the run (optional).--max-nodes-in-parallel: Specifies how many nodes will run the schedule concurrently. The default value is 1. For example, if set to 3, the schedule will run on 3 nodes in parallel (optional).--node-selector: Specifies the nodes with listed labels on which schedule will run on.
Configure your defrag schedules cluster-wide
You can configure all your defragmentation schedule in your cluster with two options:
- Chunk size: The step size of each defragmentation command. The default value is 32 MB.
- Pool full threshold: A percentage threshold for pool space usage. If any pool exceeds this threshold, defragmentation will be disabled for that pool. The default value is 70%.
To configure these options, use the following commands:
pxctl cluster options update --defrag-schedule-chunk-size <chunk-size>
Successfully updated cluster-wide options
pxctl cluster options update --defrag-schedule-pool-full-threshold <threshold-percentage>
Successfully updated cluster-wide options
To view the current configurations, run the following command:
pxctl cluster options list | grep Defrag
Defrag schedule chunk size (MB) : 64
Defrag schedule pool full threshold (%) : 75