<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Zdenek Kabelac,<br>
          Thanks for your quick reply and suggestions.<br>
<br>
</p>
<p class="MsoNormal">We conducted couple of tests on Ubuntu 22.04 and observed similar performance behavior post thin snapshot deletion without writing any data anywhere.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>Commands used to create Thin LVM volume</b>:<br>
<span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">- lvcreate  -L 480G --poolmetadataspare n --poolmetadatasize 16G --chunksize=64K --thinpool  ThinDataLV ThinVolGrp</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424"><br>
<span style="background:white">- lvcreate -n ext4.ThinLV -V 100G --thinpool ThinDataLV ThinVolGrp<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinLV display</span></b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">:<br>
 --- Logical volume ---</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424"><br>
<span style="background:white">  LV Path                /dev/ThinVolGrp/ext4.ThinLV</span><br>
<span style="background:white">  LV Name                ext4.ThinLV</span><br>
<span style="background:white">  VG Name                ThinVolGrp</span><br>
<span style="background:white">  LV UUID                sRcj9L-Ili4-dR3I-MeJI-3KLv-xPUP-VMd1LC</span><br>
<span style="background:white">  LV Write Access        read/write</span><br>
<span style="background:white">  LV Creation host, time kapil-upstream, 2022-10-14 18:05:22 +0000</span><br>
<span style="background:white">  LV Pool name           ThinDataLV</span><br>
<span style="background:white">  LV Status              available</span><br>
<span style="background:white">  # open                 1</span><br>
<span style="background:white">  LV Size                100.00 GiB</span><br>
<span style="background:white">  Mapped size            21.51%</span><br>
<span style="background:white">  Current LE             25600</span><br>
<span style="background:white">  Segments               1</span><br>
<span style="background:white">  Allocation             inherit</span><br>
<span style="background:white">  Read ahead sectors     auto</span><br>
<span style="background:white">  - currently set to     256</span><br>
<span style="background:white">  Block device           253:4<o:p></o:p></span></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">dmsetup table output after creation of thin lvm volume</span></b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV: 0 1006632960 linear 253:2 0<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV-tpool: 0 1006632960 thin-pool 253:0 253:1 128 0 0
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV_tdata: 0 1006632960 linear 8:32 2048<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV_tmeta: 0 33161216 linear 8:32 1006635008<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ext4.ThinLV: 0 209715200 thin 253:2 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">dmsetup status after creation of thin lvm volume</span></b><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">     ThinVolGrp-ThinDataLV: 0 1006632960 linear
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV-tpool: 0 1006632960 thin-pool 1 4878/4145152 8325/7864320 - rw discard_passdown queue_if_no_space
 - 1024 <o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV_tdata: 0 1006632960 linear
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ThinDataLV_tmeta: 0 33161216 linear
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">ThinVolGrp-ext4.ThinLV: 0 209715200 thin 1065600 209715199  
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b>FIO Command to dump some data</b>:</p>
<p class="MsoNormal" style="text-indent:.5in"><i><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">fio --filename=/dev/ThinVolGrp/ext4.ThinLV --name=<name> --time_based --group_reporting --ioengine=libaio --direct=1
 --size=20G  --runtime=120 --rw=randrw --rwmixread=50 --bs=16K --iodepth=8 --numjobs=3 --randrepeat=0  --randseed=$(date +%s)</span></i>
</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">For detailed information of fio and dmsetup results click <a href="https://gist.github.com/mittachaitu/17006a1e3f08ad0c17add7ea007e63b6#file-lvm_snapshot_performance">
here</a>.</p>
<p class="MsoNormal"><b>Note</b>: All the tests are conducted using <i>thin lvm volume</i> and
<i>thin snapshot</i></p>
<p class="MsoNormal"><br>
<b>Environment details</b>:</p>
<div>
<p style="margin:0in">        Kernel Version: <span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif">
5.15.0-1021-azure<o:p></o:p></span></p>
<p style="margin:0in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif">        LVM Version: 
</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">  LVM version:     2.03.11(2) (2021-01-08)</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424"><br>
<span style="background:white">                                 Library version: 1.02.175 (2021-01-08)</span><br>
<span style="background:white">                                 Driver version:  4.45.0<o:p></o:p></span></span></p>
<p style="margin:0in"><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif;color:#242424;background:white">        FIO Version:      3.28</span><span style="font-size:10.5pt;font-family:"Segoe UI",sans-serif"><o:p></o:p></span></p>
<p>Please let us know if you required more information and tests that needs to be run.</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks & Regards<br>
mittachaitu (Sai)</p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:zdenek.kabelac@gmail.com">Zdenek Kabelac</a><br>
<b>Sent: </b>Thursday, October 13, 2022 4:20 PM<br>
<b>To: </b><a href="mailto:lvm-devel@redhat.com">LVM2 development</a>; <a href="mailto:sharmapawan@microsoft.com">
Pawan Sharma</a>; <a href="mailto:linux-lvm@redhat.com">linux-lvm@redhat.com</a><br>
<b>Cc: </b><a href="mailto:kupadhayay@microsoft.com">Kapil Upadhayay</a>; <a href="mailto:mittas@microsoft.com">
Mitta Sai Chaithanya</a><br>
<b>Subject: </b>[EXTERNAL] Re: LVM2 : performance drop even after deleting the snapshot</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">[Some people who received this message don't often get email from zdenek.kabelac@gmail.com. Learn why this is important at
<a href="https://aka.ms/LearnAboutSenderIdentification">https://aka.ms/LearnAboutSenderIdentification</a> ]<br>
<br>
Dne 13. 10. 22 v 8:53 Pawan Sharma napsal(a):<br>
> adding this to lvm-devel mailing list also.<br>
><br>
> Regards,<br>
> Pawan<br>
> ------------------------------------------------------------------------------<br>
> *From:* Pawan Sharma<br>
> *Sent:* Wednesday, October 12, 2022 10:42 PM<br>
> *To:* linux-lvm@redhat.com <linux-lvm@redhat.com><br>
> *Cc:* Mitta Sai Chaithanya <mittas@microsoft.com>; Kapil Upadhayay<br>
> <kupadhayay@microsoft.com><br>
> *Subject:* LVM2 : performance drop even after deleting the snapshot<br>
> Hi Everyone,<br>
><br>
><br>
> We are evaluating lvm2 snapshots and doing performance testing on it. This is<br>
> what we are doing :<br>
><br>
>  1. dump some data to lvm2 volume (using fio)<br>
>  2. take the snapshot<br>
>  3. delete the snapshot (no IOs anywhere after creating the snapshot)<br>
>  4. run the fio on lvm2 volume<br>
><br>
> Here as you can see, we are just creating the snapshot and immediately<br>
> deleting it. There are no IOs to the main volume or anywhere. When we run the<br>
> fio after this (step 4) and we see around 50% drop in performance with<br>
> reference to the number we get in step 1.<br>
><br>
> It is expected to see a performance drop if there is a snapshot because of the<br>
> COW. But here we deleted the snapshot, and it is not referring to any data<br>
> also. We should not see any performance drop here.<br>
><br>
> Could someone please help me understand this behavior. Why are we seeing the<br>
> performance drop in this case? It seems like we deleted the snapshot but still<br>
> it is not deleted, and we are paying the COW penalty.<br>
><br>
> System Info:<br>
><br>
> OS : ubuntu 18.04<br>
> Kernel : 5.4.0<br>
><br>
> # lvm version<br>
> LVM version:2.02.176(2) (2017-11-03)<br>
> Library version: 1.02.145 (2017-11-03)<br>
> Driver version:4.41.0<br>
><br>
> We also tried on latest ubuntu with newer version of LVM. We got the same<br>
> behavior.<br>
><br>
><br>
<br>
Hi<br>
<br>
Debugging  5 year old software is likely not going to get lot of attention<br>
from upstream.<br>
<br>
So please:<br>
<br>
a) reproduce the issue with some recent  kernel & lvm2<br>
b) take   'dmsetup table && dmsetup status'  before you run every 'fio' test<br>
and present here your result in some form - otherwise we can hardly see what<br>
is the problem.<br>
<br>
<br>
What should be expected - if you use old/thick snapshots - when you 'drop'<br>
snapshot - you have your original intact LV - so results should mostly match<br>
results before you take the snapshot - but you clearly have to take into<br>
account if you use some 'SSD/NVMe' discarding and other things - so always run<br>
series of tests and average your results.<br>
<br>
If you use  thin snapshot - that you can get various results depending on your<br>
settings of thin chunks, discard usage.<br>
<br>
Also maybe try your benchmark with different filesystems...<br>
<br>
Regards<br>
<br>
Zdenek<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>