Reserve space for specific thin logical volumes
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Il 12-09-2017 21:44 matthew patton ha scritto:
Quoted 5 lines
Quoted 2 lines
Wrong: Qemu/KVM *does* honors write barrier, unless you use
"cache=unsafe".seems the default is now 'unsafe'.
http://libvirt.org/formatdomain.html#elementsDisks
The default is cache=none
Quoted 7 lines
Only if the barrier frame gets passed along by KVM and only if you're running in "directsync" (or perhaps 'none?') mode there is no guarantee any of it hit the platter. Let's assume a hypervisor I/O is ahead of VM 'A's barrier frame, and blows up the thinLV. Then yes it's possible to propagate the ENOSPACE or other error back to the VM 'A' to realize that write didn't actually succeed. The rapid failure cascade across resident VMs is not going to end well either.
fsynched writes that hits a full pool returns EIO to the upper layer
Quoted 9 lines
But if that's the only condition it works under they why bother with XFS on top of thin? You already mentioned that XFS is lousy about actually detecting underlying block layer problems until much too late. Just provision the Thin LV and map it directly to the VM. If your choice of hypervisor is broken, fix it, or choose another that doesn't have the problem. But really, using ThinLV for guest VM and asking the hypervisor to not blow up is nuts. Buy a friggin disk. Or put the onus on try/error where it belongs - inside the guest VM. Why is that so hard?
KVM is the most valid GPL hypervisor, and libvirt is the virtualization library of choice. But I can not fix/implement thin pool/volumes management alone.
Quoted 3 lines
You're a web-hosting company and you're trying to duck the laws of economics and the reality of running a business where other often clueless people trust you to keep their data intact?
Please, don't elaborate on things you don't know.
I asked a specific question on the linux-lvm list, and (as always) I learnt something. I don't see any problem in doing that.
Quoted 6 lines
Given the screwball way you're going about handling your customer data, why are you trying to be 'creative'? Storage is your MOST important and vital capability and naturally your most expensive. Get real and spend the money. Storage is where you NEVER cut corners and you NEVER attempt naive optimization efforts.
Quoted 10 lines
I'm not quibbling over XFS, you could have picked EXT4 for all I care. The point is you're trying to get jiggy with customer data to save pennies. We have a saying, picking up pennies in front of a road paver. If you're selling capacity you don't have, it's not only dishonest, but there are proven and well understood ways to do so (eg. NFS or thin-alloc iSCSI) aimed at a proper storage head that is properly managed. But ultimately you HAVE to be able to satisfy the instant demands of all users even if that means they all suddenly wake up and want to use what you supposedly sold them and entered into a contract to supply by taking their money.
Again, please don't speak about things you don't know.
I am *not* interested in thin provisioning itself at all; on the other side, I find CoW and fast snapshots very useful.
Quoted 1 line
Computing/Storage is not a ponzi scheme.
Thanks for remind me that.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8
Dne 12.9.2017 v 23:36 Gionatan Danti napsal(a):
Quoted 4 lines
Il 12-09-2017 21:44 matthew patton ha scritto:
Again, please don't speak about things you don't know.
I am *not* interested in thin provisioning itself at all; on the other side, I find CoW and fast snapshots very useful.
Not going to comment KVM storage architecture - but with this statemnet - you have VERY simple usage:
Just minimize chance for overprovisioning -
let's go by example:
you have 10 10GiB volumes and you have 20 snapshots...
to not overprovision - you need 10 GiB * 30 LV = 300GiB thin-pool.
if that sounds too-much.
you can go with 150 GiB - to always 100% cover all 'base' volumes. and have some room for snapshots.
Now the fun begins - while monitoring is running - you get callback for 50%, 55%... 95% 100% at each moment you can do whatever action you need.
So assume 100GiB is bare minimum for base volumes - you ignore any state with less then 66% occupancy of thin-pool and you start solving problems with 85% (~128GiB)- you know some snapshot is better to be dropped. You may try 'harder' actions for higher percentage.
(you need to consider how many dirty pages you leave floating your system
and other variables)
Also you pick with some logic the snapshot which you want to drop - Maybe the oldest ?
(see airplane :) URL link)....
Anyway - you have plenty of time to solve it still at this moment
without any danger of losing write operation...
All you can lose is some 'snapshot' which might have been present a bit longer... but that is supposedly fine with your model workflow...
Of course you are getting in serious problem, if you try to keep all these demo-volumes within 50GiB with massive overprovisioning ;)
There you have much hard times what should happen what should be removed and where is possibly better to STOP everything and let admin decide what is the ideal next step....
Regards
Zdenek
Il 13-09-2017 00:16 Zdenek Kabelac ha scritto:
Quoted 49 lines
Dne 12.9.2017 v 23:36 Gionatan Danti napsal(a):
Quoted 4 lines
Il 12-09-2017 21:44 matthew patton ha scritto:
Again, please don't speak about things you don't know.
I am *not* interested in thin provisioning itself at all; on the other side, I find CoW and fast snapshots very useful.Not going to comment KVM storage architecture - but with this statemnet -
you have VERY simple usage:Just minimize chance for overprovisioning -
let's go by example:
you have 10 10GiB volumes and you have 20 snapshots...
to not overprovision - you need 10 GiB * 30 LV = 300GiB thin-pool.
if that sounds too-much.
you can go with 150 GiB - to always 100% cover all 'base' volumes. and have some room for snapshots.
Now the fun begins - while monitoring is running - you get callback for 50%, 55%... 95% 100% at each moment you can do whatever action you need.
So assume 100GiB is bare minimum for base volumes - you ignore any state with less then 66% occupancy of thin-pool and you start solving problems with 85% (~128GiB)- you know some snapshot is better to be dropped.
You may try 'harder' actions for higher percentage.
(you need to consider how many dirty pages you leave floating your system and other variables)Also you pick with some logic the snapshot which you want to drop - Maybe the oldest ?
(see airplane :) URL link)....Anyway - you have plenty of time to solve it still at this moment without any danger of losing write operation...
All you can lose is some 'snapshot' which might have been present a bit longer... but that is supposedly fine with your model workflow...
Quoted 7 lines
Of course you are getting in serious problem, if you try to keep all these demo-volumes within 50GiB with massive overprovisioning ;)
There you have much hard times what should happen what should be removed and where is possibly better to STOP everything and let admin decide what is the ideal next step....
Hi Zdenek,
I fully agree with what you said above, and I sincerely thank you for taking the time to reply. However, I am not sure to understand *why* reserving space for a thin volume seems a bad idea to you.
Lets have a 100 GB thin pool, and wanting to *never* run out of space in spite of taking multiple snapshots.
To achieve that, I need to a) carefully size the original volume, b) ask the thin pool to reserve the needed space and c) counting the "live" data (REFER in ZFS terms) allocated inside the thin volume.
Step-by-step example:
- create a 40 GB thin volume and subtract its size from the thin pool (USED 40 GB, FREE 60 GB, REFER 0 GB);
- overwrite the entire volume (USED 40 GB, FREE 60 GB, REFER 40 GB);
- snapshot the volume (USED 40 GB, FREE 60 GB, REFER 40 GB);
- completely overwrite the original volume (USED 80 GB, FREE 20 GB, REFER 40 GB);
- a new snapshot creation will fails (REFER is higher then FREE).
Result: thin pool is *never allowed* to fill. You need to keep track of per-volume USED and REFER space, but thinp performance should not be impacted in any manner. This is not theoretical: it is already working in this manner with ZVOLs and refreservation, *without* involing/requiring any advanced coupling/integration between block and filesystem layers.
Don't get me wrong: I am sure that, if you choose to not implement this scheme, you have a very good reason to do that. Moreover, I understand that patches are welcome :)
But I would like to understand *why* this possibility is ruled out with such firmness.
Thanks.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8
Dne 13.9.2017 v 00:41 Gionatan Danti napsal(a):
Quoted 72 lines
Il 13-09-2017 00:16 Zdenek Kabelac ha scritto:
Quoted 48 lines
Dne 12.9.2017 v 23:36 Gionatan Danti napsal(a):
Quoted 4 lines
Il 12-09-2017 21:44 matthew patton ha scritto:
Again, please don't speak about things you don't know.
I am *not* interested in thin provisioning itself at all; on the other side, I find CoW and fast snapshots very useful.Not going to comment KVM storage architecture - but with this statemnet - you have VERY simple usage:
Just minimize chance for overprovisioning -
let's go by example:
you have� 10� 10GiB volumes� and you have 20 snapshots...
to not overprovision - you need 10 GiB * 30 LV� = 300GiB thin-pool.
if that sounds too-much.
you can go with 150 GiB - to always 100% cover all 'base' volumes. and have some room for snapshots.
Now the fun begins - while monitoring is running - you get callback for� 50%, 55%... 95% 100% at each moment� you can do whatever action you need.
So assume 100GiB is bare minimum for base volumes - you ignore any state with less then 66% occupancy of thin-pool and you start solving problems with 85% (~128GiB)- you know some snapshot is better to be dropped.
You may try 'harder' actions for higher percentage.
(you need to consider how many dirty pages you leave floating your system and other variables)Also you pick with some logic the snapshot which you want to drop - Maybe the oldest ?
(see airplane :) URL link)....Anyway - you have plenty of time to solve it still at this moment without any danger of losing write operation...
All you can lose is some 'snapshot' which might have been present a bit longer...� but that is supposedly fine with your model workflow...Quoted 7 lines
Of course you are getting in serious problem, if you try to keep all these demo-volumes within 50GiB with massive overprovisioning ;)
There you have much hard times what should happen what should be removed and where is possibly better to STOP everything and let admin decide what is the ideal next step....
Hi Zdenek,
I fully agree with what you said above, and I sincerely thank you for taking the time to reply. However, I am not sure to understand *why* reserving space for a thin volume seems a bad idea to you.Lets have a 100 GB thin pool, and wanting to *never* run out of space in spite of taking multiple snapshots.
To achieve that, I need to a) carefully size the original volume, b) ask the thin pool to reserve the needed space and c) counting the "live" data (REFER in ZFS terms) allocated inside the thin volume.Step-by-step example:
- create a 40 GB thin volume and subtract its size from the thin pool (USED 40 GB, FREE 60 GB, REFER 0 GB);
- overwrite the entire volume (USED 40 GB, FREE 60 GB, REFER 40 GB);
- snapshot the volume (USED 40 GB, FREE 60 GB, REFER 40 GB);
- completely overwrite the original volume (USED 80 GB, FREE 20 GB, REFER 40 GB);
- a new snapshot creation will fails (REFER is higher then FREE).
Quoted 6 lines
Result: thin pool is *never allowed* to fill. You need to keep track of per-volume USED and REFER space, but thinp performance should not be impacted in any manner. This is not theoretical: it is already working in this manner with ZVOLs and refreservation, *without* involing/requiring any advanced coupling/integration between block and filesystem layers.
Don't get me wrong: I am sure that, if you choose to not implement this scheme, you have a very good reason to do that. Moreover, I understand that patches are welcome :)
But I would like to understand *why* this possibility is ruled out with such firmness.
There could be a simple answer and complex one :)
I'd start with simple one - already presented here -
when you write to INDIVIDUAL thin volume target - respective dn thin target DOES manipulate with single btree set - it does NOT care there are some other snapshot and never influnces them -
You ask here to heavily 'change' thin-pool logic - so writing to THIN volume A
can remove/influence volume B - this is very problematic for meny reasons.
We can go into details of BTree updates (that should be really discussed with its authors on dm channel ;)) - but I think the key element is capturing the idea the usage of thinLV A does not change thinLV B.
----
Now to your free 'reserved' space fiction :)
There is NO way to decide WHO deserves to use the reserve :)
Every thin volume is equal - (the fact we call some thin LV snapshot is user-land fiction - in kernel all thinLV are just equal - every thinLV reference set of thin-pool chunks) -
(for late-night thinking - what would be snapshot of snapshot which is fully overwritten ;))
So when you now see that all thinLVs just maps set of chunks,
and all thinLVs can be active and running concurrently - how do you want to use reserves in thin-pool :) ? When do you decide it ? (you need to see this is total race-lend)
How do you actually orchestrate locking around this single point of failure ;) ?
You will surely come with and idea of having reserve separate for every thinLV ?
How big it should actually be ?
Are you going to 'refill' those reserves when thin-pool gets emptier ?
How you decide which thinLV deserves bigger reserves ;) ??
I assume you can start to SEE the whole point of this misery....
So instead - you can start with normal thin-pool - keep it simple in kernel, and solve complexity in user-space.
There you can decide - if you want to extend thin-pool... You may drop some snapshot...
You may fstrim mounted thinLVs...
You can kill volumes way before the situation becomes unmaintable....
All you need to accept is - you will kill them at 95% -
in your world with reserves it would be already reported as 100% full, with totally unknown size of reserves :)
Regards
Zdenek
Quoted 43 lines
There could be a simple answer and complex one :)
I'd start with simple one - already presented here -
when you write to INDIVIDUAL thin volume target - respective dn thin target DOES manipulate with single btree set - it does NOT care there are some other snapshot and never influnces them -
You ask here to heavily 'change' thin-pool logic - so writing to THIN volume A can remove/influence volume B - this is very problematic for meny reasons.
We can go into details of BTree updates (that should be really discussed with its authors on dm channel ;)) - but I think the key element is capturing the idea the usage of thinLV A does not change thinLV B.
----
Now to your free 'reserved' space fiction :)
There is NO way to decide WHO deserves to use the reserve :)Every thin volume is equal - (the fact we call some thin LV snapshot is user-land fiction - in kernel all thinLV are just equal - every thinLV reference set of thin-pool chunks) -
(for late-night thinking - what would be snapshot of snapshot which is fully overwritten ;))
So when you now see that all thinLVs just maps set of chunks,
and all thinLVs can be active and running concurrently - how do you want to use reserves in thin-pool :) ?
When do you decide it ? (you need to see this is total race-lend) How do you actually orchestrate locking around this single point of failure ;) ? You will surely come with and idea of having reserve separate for every thinLV ? How big it should actually be ?
Are you going to 'refill' those reserves when thin-pool gets emptier ? How you decide which thinLV deserves bigger reserves ;) ??I assume you can start to SEE the whole point of this misery....
Quoted 7 lines
So instead - you can start with normal thin-pool - keep it simple in kernel, and solve complexity in user-space.
There you can decide - if you want to extend thin-pool... You may drop some snapshot...
You may fstrim mounted thinLVs...
You can kill volumes way before the situation becomes unmaintable....
Ok, this is an answer I totally accept: if enable per-lv used and reserved space is so difficult in the current thinp framework, don't do it.
Thanks to taking the time to explain (on late night ;))
Quoted 3 lines
All you need to accept is - you will kill them at 95% -
in your world with reserves it would be already reported as 100% full, with totally unknown size of reserves :)
Minor nitpicking: I am not speaking about "reserves" to use when free space is low, but about "reserved space" - ie: per-volume space which can not be used by any other object.
One question: in a previous email you shown how a threshold can be set to deny new volume/snapshot creation. How can I do that? What LVM version I need?
Thanks.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8
Dne 13.9.2017 v 01:15 Gionatan Danti napsal(a):
Quoted 9 lines
Quoted 3 lines
There could be a simple answer and complex one :)
I'd start with simple one - already presented here -
There you can decide - if you want to extend thin-pool...
Quoted 3 lines
You may drop some snapshot...
You may fstrim mounted thinLVs...
You can kill volumes way before the situation becomes unmaintable....Ok, this is an answer I totally accept: if enable per-lv used and reserved space is so difficult in the current thinp framework, don't do it.
It's not just about 'complexity' in frame work. You would lose all the speed as well.
You would significantly raise-up memory requirement.
There is very good reason complex tools like 'thin_ls' are kept in user-space
outside of kernel - with 'dm' we tend to have simpler kernel logic
and complexity should stay in user-space.
And of course - as pointed out - the size of your 'reserve' is so vague :) and could potentially present major portion of you whole thin-pool size without any extra benefit (as obviously any reserve could be too small unless you 'reach' fully provisioned state :)
i.e. example:
10G thinLV with 1G chunks - single byte write may require full 1G chunk... so do you decide to keep 10 free chunks in reserves ??
Quoted 7 lines
Quoted 3 lines
All you need to accept is - you will kill them at 95% -
in your world with reserves it would be already reported as 100% full, with totally unknown size of reserves :)Minor nitpicking: I am not speaking about "reserves" to use when free space is low, but about "reserved space" - ie: per-volume space which can not be used by any other object.
One question: in a previous email you shown how a threshold can be set to deny new volume/snapshot creation. How can I do that? What LVM version I need?
Supposedly:
lvmconfig --typeconfig full --withversion
# Available since version 2.2.89.
thin_pool_autoextend_threshold=70
However there were some bugs and fixes - and validation for not allowing to create new thins - so do not try anything below 169 and if you can go with 173....
Regards
Zdenek
Il 13-09-2017 01:31 Zdenek Kabelac ha scritto:
Quoted 9 lines
It's not just about 'complexity' in frame work. You would lose all the speed as well.
You would significantly raise-up memory requirement.There is very good reason complex tools like '
thin_ls' are kept in
user-space outside of kernel - with 'dm' we tend to have simpler
kernel logic
and complexity should stay in user-space.
Quoted 8 lines
And of course - as pointed out - the size of your 'reserve' is so vague :) and could potentially present major portion of you whole thin-pool size without any extra benefit (as obviously any reserve could be too small unless you 'reach' fully provisioned state :)
i.e. example:
10G thinLV with 1G chunks - single byte write may require full 1G chunk... so do you decide to keep 10 free chunks in reserves ??
What was missing (because I thought it was implicit) is that I expect snapshot to never change - ie: they are read-only. Anyway, I was not writing about "resevers" - rather, to preassign/preallocate the required space to a specific volume. A fallocate on a otherwise thinly provisioned volume, if you like.
Quoted 4 lines
Supposedly:
lvmconfig --typeconfig full --withversion
Quoted 9 lines
# Available since version 2.2.89.
thin_pool_autoextend_threshold=70However there were some bugs and fixes - and validation for not allowing to create new thins - so do not try anything below 169 and if you can
go with 173....
Ah! I was not thinking about thin_pool_autoextend_threshold! I tried with 166 (for now) and I don't see any major problems. However, I will surely upgrade at the first opportunity!
Thanks.
Signature · 5 lines
Danti Gionatan Supporto Tecnico Assyoma S.r.l. - www.assyoma.it email: [email protected] - [email protected] GPG public key ID: FF5F32A8