Copy on Read
Good day, Device Mapper Folks.
In the format of an X Y Problem:
[Almost] Real goal (X): I would like to read storage-blocks locally from a far-away (remote, high latency) source and keep costs (for local storage, for network-traffic) to a minimum. 95% of the remote source will never be read and 5% will be read frequently. If I read a storage-block 1,000,000 times over 10 years, ideally it should only traverse the network once during that time.
There is no mention of writes, so far.
Sub-goal (Y): Identify whether or not there is a device-mapper target with copy-on-read, read-only behaviour. This seems like it could be useful in certain forensic situations in which "accesses" ought to be recorded. "We" (device-mapper users) have the "write half" of "accesses" covered, already, with snapshots.
dm-cache might work out, except that it appears to've been designed with considerations for writes, which are irrelevant to the goal(s).
dm-snapshot might work out, except that I'd like to copy-on-read, instead of copy-on-write.
dm-thin appears to pass reads to the source, so doesn't seem to be appropriate.
dm-clone doesn't keep costs low because it copies the 95% unused storage-blocks. dm-clone without any writes happening and with "hydration" disabled might work out, except that it appears to pass reads to the source, with "hydration" disabled.
Mirroring doesn't keep costs low because it copies the 95% unused storage-blocks.
Please forgive my ignorance/forgetfulness: is there already a device-mapper target or a stack of targets which seem(s) appropriate for the goal(s)? The idea is pretty much read-caching, which might be argued is also available at filesystem layers, but files aren't mentioned in the goal(s).
Thank you for your generous device-mapper efforts.
- Shao Miller
Synthetel Corporation
Dne 12. 11. 24 v 20:40 Shao Miller napsal(a):
Quoted 4 lines
Good day, Device Mapper Folks.
In the format of an X Y Problem:
Quoted 8 lines
[Almost] Real goal (X): I would like to read storage-blocks locally from a far-away (remote, high latency) source and keep costs (for local storage, for network-traffic) to a minimum. 95% of the remote source will never be read and 5% will be read frequently. If I read a storage-block 1,000,000 times over 10 years, ideally it should only traverse the network once during that time.
There is no mention of writes, so far.
Sub-goal (Y): Identify whether or not there is a device-mapper target with copy-on-read, read-only behaviour. This seems like it could be useful in certain forensic situations in which "accesses" ought to be recorded. "We" (device-mapper users) have the "write half" of "accesses" covered, already, with snapshots.
dm-cache might work out, except that it appears to've been designed with considerations for writes, which are irrelevant to the goal(s).
Hi
dm-cache should be likely your 'favorite' since it's designed to handle different policies - for some reason not too many policies were ever written (maybe existing one is good enough for most to bother), but the idea behind was to be modular and handle different need of users - if they simply 'know more' upfront then the current 'heuristic' smq policy might ever learn from observing IO traffic within cached device.
So I'd highly recommend to read about those policies and eventually write a better one for you specific case (like instantly promote any blocks until cache is 100% full)
Although you should probably try to use the existing one first -and you might be surprised how good it will get over the time in picking your hot spots of your disks - although there might be some 'extra' reads from your origin device before the cache considers a block to be 'promoted' to cache.
As for your 'write' concerns - they are actually irrelevant itself - since if there is no write - there is no need to maintain the place for it....
Regards
Zdenek
Quoted 34 lines · Zdenek Kabelac
Dne 12. 11. 24 v 20:40 Shao Miller napsal(a):
Quoted 4 lines
Good day, Device Mapper Folks.
In the format of an X Y Problem:
Quoted 8 lines
[Almost] Real goal (X): I would like to read storage-blocks locally from a far-away (remote, high latency) source and keep costs (for local storage, for network-traffic) to a minimum. 95% of the remote source will never be read and 5% will be read frequently. If I read a storage-block 1,000,000 times over 10 years, ideally it should only traverse the network once during that time.
There is no mention of writes, so far.
Sub-goal (Y): Identify whether or not there is a device-mapper target with copy-on-read, read-only behaviour. This seems like it could be useful in certain forensic situations in which "accesses" ought to be recorded. "We" (device-mapper users) have the "write half" of "accesses" covered, already, with snapshots.
dm-cache might work out, except that it appears to've been designed with considerations for writes, which are irrelevant to the goal(s).
[...]
dm-cache should be likely your 'favorite' since it's designed to handle different policies - for some reason not too many policies were ever written (maybe existing one is good enough for most to bother), but the idea behind was to be modular and handle different need of users - if they simply 'know more' upfront then the current 'heuristic' smq policy might ever learn from observing IO traffic within cached device.
So I'd highly recommend to read about those policies and eventually write a better one for you specific case (like instantly promote any blocks until cache is 100% full)
Although you should probably try to use the existing one first -and you might be surprised how good it will get over the time in picking your hot spots of your disks - although there might be some 'extra' reads from your origin device before the cache considers a block to be 'promoted' to cache.
Quoted 5 lines
As for your 'write' concerns - they are actually irrelevant itself - since if there is no write - there is no need to maintain the place for it....
[...]
OK, thanks. I guess dm-cache "writeback" could work: reads will hopefully populate the cache and since no writes will ever happen, the details about writes are irrelevant. That didn't seem to occur to me, the first time I read about it:
- https://www.kernel.org/doc/Documentation/device-mapper/cache.txt
- Shao Miller
Synthetel Corporation