<html xmlns:v="urn:schemas-microsoft-com:vml" 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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">I’ve been working in the gdal-dev-env (version 3.1.0, installed around mid-December)
 on OSGeo4w (mostly because it’s faster than making COGs using the GTIFF driver) on large (e.g. 102600x91100) orthophoto rasters, generating VRTs, TIFFs and COGs.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">While I can do LZW, DEFLATE, and uncompressed just fine (2 minutes with all cores to
 make a lzw COG from a VRT), I’m struggling to make JPEG COGs. If I run a loop, I can’t make it through more than one image without gdal_translate hanging at the finish for sometimes tens of hours. If I kill the process (CTRL-C doesn’t always work, but task
 mgr does) then the resulting COG is fine (same size as if I wait n hours and the process finishes). Over the last few years I’ve had this issue (gdal_translate hanging at “100 – done.”) on many large rasters even when building as TIFF. Also maybe worth noting,
 even on smaller rasters I often see GDAL hang for minutes to tens of minutes at the end of a raster build. In the past I was only been building single rasters though, so it’s not that big of a deal – I can just kill the process. Not any more. I frequently
 build several at a time and hope to scale up.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">I’m running on a threadripper 3960x with 256GB RAM that I built. All processing is on
 a NVMe drive. The LZW compressed tiffs (COGs) are around 1.5 - 3GB (8-bit,RGB with mask band). If I build with CPL_DEBUG=ON, depending on cachemax size, I see “potential thrashing on band one of .” at around 10-20% (even with GDAL_CACHEMAX at 80%), and if
 not set high enough I’m stuck at 20% for hours and hours. Then gdal hangs at “100 – done.” for anywhere from 2 - 12+ hours unless I kill it. If I kill the process, the final raster builds out and appears to work fine, and is the same as if I wait X hours for
 it to exit. For a test with debug on I just finished, after 2.5h hung at “done” I got this line:<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">GDAL: GDALClose(<outfile.tif.ovr.tmp, this=000001FDC5531C50)<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">And another 45 minutes later the input and output tiffs closed and shared library unloaded
 after the RAM slowly emptied from ~30 gig over that time.<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">My overall command at the moment is:<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">gdal_translate .\<infile.tif> <outfile.tif> -of COG -co COMPRESS=JPEG -co QUALITY=90
 –config GDAL_CACHEMAX “80%” –config GDAL_SWATH_SIZE “80%” –config GDAL_FORCE_CACHING YES –config GDAL_MAX_DATASET_POOL_SIZE 2048<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white;vertical-align:baseline"><span style="font-size:11.5pt;color:#201F1E;border:none windowtext 1.0pt;padding:0in;background:white">And with lower values (and possibly if I get rid of the GDAL_FORCE_CACHING YES variable
 – I just added that) I have the same “hang” at 100% lasting for even longer. Again, the same COG builds in 2 minutes with LZW, but with JPEG and all the cachemax settings ramped up, it takes maybe 6 hours.</span><span style="font-size:11.5pt;color:#201F1E"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>