Storage Tiering
May 30, 2018
Great Plains Network 2018
Kansas City, MO
Jason Coposky
@jason_coposky
Executive Director, iRODS Consortium
Storage Tiering
iRODS Capabilities
- Packaged and supported solutions
- Require configuration not code
- Derived from the majority of use cases observed in the user community
Storage Tiering Overview
Data Object Access Time
The default policy for tiering is based on the last time of access for a given data object which is applied as metadata
pep_api_data_obj_close_post
pep_api_data_obj_put_post
pep_api_data_obj_get_post
pep_api_phy_path_reg_post
irods::access_time <unix timestamp>
Dynamic Policy Enforcement Points for RPC API are used to apply the metadata
Configuring a Tier Group
imeta set -R <resc0> irods::storage_tiering::group example_group 0
imeta set -R <resc1> irods::storage_tiering::group example_group 1
imeta set -R <resc2> irods::storage_tiering::group example_group 2
Tier groups are entirely driven by metadata
- The attribute identifies a group participant
- The value defines group name
- The unit defines the position within the group
- Tier index can be any value, order will be preserved
- Configuration must be performed at the root of a resource composition
- A resource may belong to many tiering groups
Configuring Tiering Time Constraints
Tiering violation time is configured in seconds
imeta set -R <resc> irods::storage_tiering::time 2592000
The final tier does not have a storage tiering time as it will hold data indefinitely
imeta set -R <resc> irods::storage_tiering::time 30
Configure a tier to hold data for 30 seconds
Configure a tier to hold data for 30 days
Verification of Data Migration
When data is found to be in violation
imeta set -R <resc> irods::storage_tiering::verification catalog
'catalog' is the default verificaiton for all resources
For verification, this setting will determine if the replica is properly registered within the catalog after replication.
- Data is replicated to the next tier
- The integrity is verified
- Source replica is trimmed
Verification of Data Migration
imeta add -R <resc> irods::storage_tiering::verification filesystem
This option will stat the remote replica on disk and compare the file size with that of the catalog.
Filesystem verification is more expensive as it involves a potentially remote file system stat.
Verification of Data Migration
imeta add -R <resc> irods::storage_tiering::verification checksum
Checksum verification is the most expensive as file sizes may be large
Compute a checksum of the data once it is at rest, and compare with the value in the catalog.
Should the source replica not have a checksum one will be computed before the replication is performed
Configuring the restage resource
imeta add -R <resc> irods::storage_tiering::minimum_restage_tier true
When data is in a tier other than the lowest tier, upon access the data is restaged back to the lowest tier.
This flag identifies the tier for restage
Users may not want data restaged back to the lowest tier, should that tier be very remote or not appropriate for analysis.
Consider a storage resource at the edge serving as a landing zone for instrument data
Preserving Replicas
Some users may not wish to trim a replica from a tier when data is migrated, such as to allow data to be archived and also still available on fast storage. To preserve a replica on any given tier, attach the following metadata flag to the root resource.
imeta set -R <resc> irods::storage_tiering::preserve_replicas true
Custom Violation Query
Admins may specify a custom query which identifies violating data objects
imeta set -R <resc> irods::storage_tiering::query "SELECT DATA_NAME, COLL_NAME, DATA_RESC_ID WHERE META_DATA_ATTR_NAME = 'irods::access_time' AND META_DATA_ATTR_VALUE < 'TIME_CHECK_STRING' AND DATA_RESC_ID IN ('10021', '10022')"
Any number of queries may be attached in order provide a range of criteria by which violating data may be identified, such as user applied metadata
Custom Violating Specific Query
More complex SQL may be required to identify violating objects. Users may configure Specific Queries and attach those to a given tier within a group.
Create a specific query in SQL
imeta set -R <resc> irods::storage_tiering::query archive_query specific
Configure the specific query
iadmin asq "select distinct R_DATA_MAIN.data_name, R_COLL_MAIN.coll_name, R_DATA_MAIN.resc_id from R_DATA_MAIN, R_COLL_MAIN, R_OBJT_METAMAP r_data_metamap, R_META_MAIN r_data_meta_main where R_DATA_MAIN.resc_id IN (10021, 10022) AND r_data_meta_main.meta_attr_name = 'archive_object' AND r_data_meta_main.meta_attr_value = 'true' AND R_COLL_MAIN.coll_id = R_DATA_MAIN.coll_id AND R_DATA_MAIN.data_id = r_data_metamap.object_id AND r_data_metamap.meta_id = r_data_meta_main.meta_id order by R_COLL_MAIN.coll_name, R_DATA_MAIN.data_name" archive_query
Limiting violating query results
When working with large sets of data, throttling the amount of data migrated at one time can be helpful. In order to limit the results of the violating queries attach the following metadata attribute with the value set as the query limit.
imeta set -R <resc> irods::storage_tiering::object_limit LIMIT_VALUE
Logging data transfer
In order to record the transfer of data objects from one tier to the next, the storage tiering plugin on the ICAT server can be configured by setting "data_transfer_log_level" : "LOG_NOTICE" in the plugin_specific_configuration.
In /etc/irods/server_config.json add the configuration to the plugin instance
{
"instance_name": "irods_rule_engine_plugin-storage_tiering-instance",
"plugin_name": "irods_rule_engine_plugin-storage_tiering",
"plugin_specific_configuration": {
"data_transfer_log_level" : "LOG_NOTICE"
}
},
Storage Tiering Metadata Vocabulary
"plugin_specific_configuration": {
"access_time_attribute" : "irods::access_time",
"storage_tiering_group_attribute" : "irods::storage_tiering::group",
"storage_tiering_time_attribute" : "irods::storage_tiering::time",
"storage_tiering_query_attribute" : "irods::storage_tiering::query",
"storage_tiering_verification_attribute" : "irods::storage_tiering::verification",
"storage_tiering_restage_delay_attribute" : "irods::storage_tiering::restage_delay",
"default_restage_delay_parameters" : "<PLUSET>1s</PLUSET><EF>1h DOUBLE UNTIL SUCCESS OR 6 TIMES</EF>",
"time_check_string" : "TIME_CHECK_STRING"
}
All default metadata attributes are configurable
Should there be a preexisting vocabulary, it can be leveraged
Example Implementation
Getting Started
Installing Tiered Storage Plugin
wget -qO - https://packages.irods.org/irods-signing-key.asc | sudo apt-key add -
echo "deb [arch=amd64] https://packages.irods.org/apt/ $(lsb_release -sc) main" | \
sudo tee /etc/apt/sources.list.d/renci-irods.list
sudo apt-get update
As the ubuntu user
Install the package repository
ubuntu@hostname:~$ sudo apt-get install irods-rule-engine-plugin-storage-tiering
Install the storage tiering package
Configuring the rule engine plugin
"rule_engines": [
{
"instance_name": "irods_rule_engine_plugin-storage_tiering-instance",
"plugin_name": "irods_rule_engine_plugin-storage_tiering",
"plugin_specific_configuration": {
}
},
{
"instance_name": "irods_rule_engine_plugin-irods_rule_language-instance",
"plugin_name": "irods_rule_engine_plugin-irods_rule_language",
"plugin_specific_configuration": {
<snip>
},
"shared_memory_instance": "irods_rule_language_rule_engine"
},
]
As the irods user
Edit /etc/irods/server_config.json
Example Implementation
Three Tier Group with Random Resources
Make some resources
iadmin mkresc rnd0 random
iadmin mkresc rnd1 random
iadmin mkresc rnd2 random
iadmin mkresc ufs0 unixfilesystem `hostname`:/tmp/irods/ufs0
iadmin mkresc ufs1 unixfilesystem `hostname`:/tmp/irods/ufs1
iadmin mkresc ufs2 unixfilesystem `hostname`:/tmp/irods/ufs2
iadmin mkresc ufs3 unixfilesystem `hostname`:/tmp/irods/ufs3
iadmin mkresc ufs4 unixfilesystem `hostname`:/tmp/irods/ufs4
iadmin mkresc ufs5 unixfilesystem `hostname`:/tmp/irods/ufs5
iadmin addchildtoresc rnd0 ufs0
iadmin addchildtoresc rnd0 ufs1
iadmin addchildtoresc rnd1 ufs2
iadmin addchildtoresc rnd1 ufs3
iadmin addchildtoresc rnd2 ufs4
iadmin addchildtoresc rnd2 ufs5
As the irods user
Make some resources
irods@hostname:~$ ilsresc
demoResc:unixfilesystem
rnd0:random
├── ufs0:unixfilesystem
└── ufs1:unixfilesystem
rnd1:random
├── ufs2:unixfilesystem
└── ufs3:unixfilesystem
rnd2:random
├── ufs4:unixfilesystem
└── ufs5:unixfilesystem
Check our results
Create a Tier Group
imeta set -R rnd0 irods::storage_tiering::group example_group 0
imeta set -R rnd1 irods::storage_tiering::group example_group 1
imeta set -R rnd2 irods::storage_tiering::group example_group 2
Create a tier group named example_group, adding the metadata to the root resources
Set the Tiering Time Constraints
imeta set -R rnd1 irods::storage_tiering::time 60
Tier 2 does not have a storage tiering time as it will hold data indefinitely
imeta set -R rnd0 irods::storage_tiering::time 30
Configure tier 0 to hold data for 30 seconds
Configure tier 1 to hold data for 60 seconds
Stage some data into storage tier 0
iput -R rnd0 /tmp/stickers.jpg
Check our results
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 0 rnd0;ufs0 2157087 2018-05-11.11:51 & stickers.jpg
irods@hostname:~$ imeta ls -d stickers.jpg AVUs defined for dataObj stickers.jpg: attribute: irods::access_time value: 1526134799 units:
Testing the tiering
Sample Tiering rule
{ "rule-engine-instance-name": "irods_rule_engine_plugin-tiered_storage-instance", "rule-engine-operation": "apply_storage_tiering_policy", "delay-parameters": "<PLUSET>1s</PLUSET><EF>1h DOUBLE UNTIL SUCCESS OR 6 TIMES</EF>", "storage-tier-groups": [ "example_group_g2", "example_group" ] } INPUT null OUTPUT ruleExecOut
JSON ingested by the Tiering Plugin - run once until success or six failures
In production this would be persistently on the delay queue
Launching the sample Tiering rule
irods@hostname:~$ iqstat id name 10038 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["example_group_g2","example_group"]}
irule -r irods_rule_engine_plugin-storage_tiering-instance -F example_tiering_invocation.r
Check the delay queue
Run the rule from the bench
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 2 rnd1;ufs2 2157087 2018-05-12.10:22 & stickers.jpg
Wait for the delay execution engine to fire...
Check the resource for stickers.jpg
Launching the Tiering rule once more
irods@hostname:~$ iqstat id name 10038 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["example_group_g2","example_group"]}
irule -r irods_rule_engine_plugin-storage_tiering-instance -F example_tiering_invocation.r
Check the delay queue
The time for violation is 2 minutes for rnd1
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 2 rnd2;ufs4 2157087 2018-05-12.10:22 & stickers.jpg
Wait for the delay execution engine to fire...
Check the resource for stickers.jpg
Restaging Data
irods@hostname:~$iget -f stickers.jpg
irods@hostname:~$iqstat id name 10035 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["example_group_g2","example_group"]}
Fetching data when it is not in the lowest tier will automatically trigger a restaging of the data
The object will be replicated back to the lowest tier, honoring the verification policy
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 2 rnd0;ufs1 2157087 2018-05-12.10:22 & stickers.jpg
Setting a Minimum Restage Tier
imeta set -R rnd1 irods::storage_tiering::minimum_restage_tier true
In order to flag a resource as the target resource for restaging data we add metadata
The object will be replicated to this tier instead of the lowest tier
irods@hostname:~$ !irule
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 6 rnd2;ufs5 2157087 2018-05-15.15:10 & stickers.jpg
irods@hostname:~$ iget -f file0
irods@hostname:~$ iqstat
id name
10044 {"destination-resource":"rnd1","object-path":"/tempZone/home/rods/file0","preserve-replicas":false,"rule-engine-operation":"migrate_object_to_resource","source-resource":"rnd2","verification-type":"catalog"}
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 6 rnd1;ufs2 2157087 2018-05-15.15:10 & stickers.jpg
Preserving replicas on a given storage tier
imeta set -R rnd1 irods::storage_tiering::preserve_replicas true
Were we to want to preserve replicas on a tier we can set a metadata flag
irods@hostname:~$ !irule irule -r irods_rule_engine_plugin-storage_tiering-instance -F example_tiering_invocation.r irods@hostname:~$ ils -l /tempZone/home/rods: rods 1 rnd1;ufs2 2157087 2018-05-15.15:28 & stickers.jpg rods 2 rnd2;ufs5 2157087 2018-05-15.15:28 & stickers.jpg
When the staging rule is invoked the replica on the rnd1 tier will not be trimmed after replication
A replica is preserved for analysis while another is safe in the archive tier
Custom violation queries
Any number of queries may be attached to a tier to identify violating objects.
The resource id's of the leaf resources are necessary for the query, not the root.
irods@hostname:~$ ilsresc -l ufs0 resource name: ufs0 id: 10019 ... irods@hostname:~$ ilsresc -l ufs1 resource name: ufs1 id: 10020 ....
Custom violation queries
Craft a query that replicates the default behavior
imeta set -R rnd0 irods::storage_tiering::query "SELECT DATA_NAME, COLL_NAME, DATA_RESC_ID WHERE META_DATA_ATTR_NAME = 'irods::access_time' AND META_DATA_ATTR_VALUE < 'TIME_CHECK_STRING' AND DATA_RESC_ID IN ('10019', '10020')" [general]
Compare data object access time against TIME_CHECK_STRING
TIME_CHECK_STRING macro is replaced with the current time by the plugin before the query is submitted
Check DATA_RESC_ID against the list of child resource ids
Columns DATA_NAME, COLL_NAME, DATA_RESC_ID must be queried in that order
By default all queries are of the type general, which is optional
Custom violation queries
Identify the leaf resource ids for the middle tier
irods@jasonc-VirtualBox:~$ ilsresc -l ufs2 resource name: ufs2 id: 10021 ... irods@jasonc-VirtualBox:~$ ilsresc -l ufs3 resource name: ufs3 id: 10022 ....
Custom violation queries
Craft a query that uses metadata to identify violating objects
Add a Specific Query to iRODS, using new resource ids
iadmin asq "select distinct R_DATA_MAIN.data_name, R_COLL_MAIN.coll_name, R_DATA_MAIN.resc_id from R_DATA_MAIN, R_COLL_MAIN, R_OBJT_METAMAP r_data_metamap, R_META_MAIN r_data_meta_main where R_DATA_MAIN.resc_id IN (10021, 10022) AND r_data_meta_main.meta_attr_name = 'archive_object' AND r_data_meta_main.meta_attr_value = 'true' AND R_COLL_MAIN.coll_id = R_DATA_MAIN.coll_id AND R_DATA_MAIN.data_id = r_data_metamap.object_id AND r_data_metamap.meta_id = r_data_meta_main.meta_id order by R_COLL_MAIN.coll_name, R_DATA_MAIN.data_name" archive_query
imeta set -R rnd1 irods::storage_tiering::query archive_query specific
Attach the query to the middle tier
This query must be labeled specific via the units
Testing the queries
irods@hostname:~$ irm -f stickers.jpg
irods@hostname:~$ iput -R rnd0 /tmp/stickers.jpg
Starting over with stickers.jpg
Wait for it...
irods@hostname:~$ irule -r irods_rule_engine_plugin-storage_tiering-instance -F example_tiering_invocation.r
irods@hostname:~$ iqstat
id name
10065 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["example_group_g2","example_group"]}
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg
Testing the queries
irods@hostname:~$ ils -l /tempZone/home/rods: rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg
The file stopped at rnd1 as the time-based default query is now overridden
Now set the metadata flag to archive the data object
irods@hostname:~$ imeta set -d /tempZone/home/rods/stickers.jpg archive_object true
Testing the queries
irods@hostname:~$ irule -r irods_rule_engine_plugin-storage_tiering-instance -F example_tiering_invocation.r
irods@hostname:~$ iqstat
id name
10065 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["example_group_g2","example_group"]}
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg
rods 2 rnd2;ufs4 2157087 2018-05-18.14:16 & stickers.jpg
The metadata is set, run the tiering rule
The preservation flag is still set so we have two replicas
Another example
Three Tier Groups with Common Archive
We will create data flow from instrument to archive
Create some more resources
iadmin mkresc tier2 unixfilesystem `hostname`:/tmp/irods/tier2
iadmin mkresc tier0_A unixfilesystem `hostname`:/tmp/irods/tier0_A
iadmin mkresc tier1_A unixfilesystem `hostname`:/tmp/irods/tier1_A
iadmin mkresc tier0_B unixfilesystem `hostname`:/tmp/irods/tier0_B
iadmin mkresc tier1_B unixfilesystem `hostname`:/tmp/irods/tier1_B
iadmin mkresc tier0_C unixfilesystem `hostname`:/tmp/irods/tier2_C
iadmin mkresc tier1_C unixfilesystem `hostname`:/tmp/irods/tier1_C
Create Tier Groups
imeta set -R tier0_A irods::storage_tiering::group tier_group_A 0
imeta set -R tier1_A irods::storage_tiering::group tier_group_A 1
imeta add -R tier2 irods::storage_tiering::group tier_group_A 2
imeta set -R tier0_B irods::storage_tiering::group tier_group_B 0
imeta set -R tier1_B irods::storage_tiering::group tier_group_B 1
imeta add -R tier2 irods::storage_tiering::group tier_group_B 2
Tier Group A
Tier Group B
imeta set -R tier0_C irods::storage_tiering::group tier_group_C 0
imeta set -R tier1_C irods::storage_tiering::group tier_group_C 1
imeta add -R tier2 irods::storage_tiering::group tier_group_C 2
Tier Group C
Set Tier Time Constraints
imeta set -R tier0_A irods::storage_tiering::time 30 imeta set -R tier0_B irods::storage_tiering::time 45 imeta set -R tier0_C irods::storage_tiering::time 15
Tier 0
imeta set -R tier1_A irods::storage_tiering::time 60 imeta set -R tier1_B irods::storage_tiering::time 120 imeta set -R tier1_C irods::storage_tiering::time 180
Tier 1
Tier 2 has no time constraints
Creating an automated periodic rule
{ "rule-engine-instance-name": "irods_rule_engine_plugin-storage_tiering-instance", "rule-engine-operation": "apply_storage_tiering_policy", "delay-parameters": "<PLUSET>1s</PLUSET><EF>REPEAT FOR EVER</EF>", "storage-tier-groups": [ "tier_group_A", "tier_group_B", "tier_group_C" ] } INPUT null OUTPUT ruleExecOut
Create a new rule file to periodically apply the storage tiering policy - foo.r
Launch the new rule
irods@hostname:~$ irule -r irods_rule_engine_plugin-storage_tiering-instance -F foo.r irods@hostname:~$ iqstat id name 10096 {"rule-engine-operation":"apply_storage_tiering_policy","storage-tier-groups":["tier_group_A","tier_group_B","tier_group_C"]}
Stage data in all three tiers and watch
irods@hostname:~$ iput -R tier0_A /tmp/stickers.jpg stickers_A.jpg
irods@hostname:~$ iput -R tier0_B /tmp/stickers.jpg stickers_B.jpg
irods@hostname:~$ iput -R tier0_C /tmp/stickers.jpg stickers_C.jpg
irods@hostname:~$ ils -l /tempZone/home/rods: rods 2 tier0_A 2157087 2018-05-18.21:03 & stickers_A.jpg rods 2 tier0_B 2157087 2018-05-18.21:03 & stickers_B.jpg rods 2 tier0_C 2157087 2018-05-18.20:45 & stickers_C.jpg rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg rods 2 rnd2;ufs4 2157087 2018-05-18.14:16 & stickers.jpg
Wait for it...
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 2 tier1_A 2157087 2018-05-18.21:03 & stickers_A.jpg
rods 2 tier1_B 2157087 2018-05-18.21:03 & stickers_B.jpg
rods 2 tier2 2157087 2018-05-18.20:45 & stickers_C.jpg
rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg
rods 2 rnd2;ufs4 2157087 2018-05-18.14:16 & stickers.jpg
And then again...
irods@hostname:~$ ils -l
/tempZone/home/rods:
rods 2 tier2 2157087 2018-05-18.21:03 & stickers_A.jpg
rods 2 tier2 2157087 2018-05-18.21:03 & stickers_B.jpg
rods 2 tier2 2157087 2018-05-18.20:45 & stickers_C.jpg
rods 1 rnd1;ufs3 2157087 2018-05-18.13:38 & stickers.jpg
rods 2 rnd2;ufs4 2157087 2018-05-18.14:16 & stickers.jpg
Questions?
Storage Tiering - GPN 2018
By jason coposky
Storage Tiering - GPN 2018
An overview of the first packaged iRODS Capability, the storage tiering rule engine plugin.
- 1,779