<div dir="ltr"><div class="gmail_quote gmail_quote_container"><div dir="ltr"><p>Dear GDAL Developers,</p>
<p>I am working on optimizing the processing times for MODIS datasets (LST_1Km and QC Day tile) using <code>pymodis</code> with some modifications. Specifically, I have added flags for:</p>
<ul><li>
<p>Running on all available CPU cores (<code>ALL_CORES</code>)</p>
</li><li>
<p>Adjusting GDAL cache size (<code>GDAL_CACHEMAX</code>)</p>
</li></ul>
<p>However, I am observing unexpected performance variations. In some cases, increasing the cache size degrades performance instead of improving it. Below are my test results for two different datasets from the same tile. Tile used: MOD11A1.A2025073.h10v10.061.2025074095514.hdf</p><p>EPSG:32618, Resampled to 30m</p>
<h3><b>QC_tile.tif</b></h3>
<pre><code>ALL_CORES + 2G  
real    0m24.199s  
user    0m53.352s  
sys     0m9.998s  

STANDARD RUN (No Cache, No Multi-Threading)  
real    0m32.133s  
user    0m30.581s  
sys     0m2.299s  

ALL_CORES + 512M  
real    0m13.830s  
user    0m51.083s  
sys     0m1.911s  
</code></pre>
<p>With 512M cache, performance improves significantly, but with larger caches (1G, 2G, 4G), execution time increases.</p>
<h3><b>LST_Day_1km.tif</b></h3>
<pre><code>ALL_CORES + 512M  
real    0m42.863s  
user    0m44.105s  
sys     0m3.583s  

STANDARD RUN (No Cache, No Multi-Threading)  
real    0m45.121s  
user    0m26.477s  
sys     0m3.712s  

ALL_CORES + 2G  
real    0m37.548s  
user    0m48.302s  
sys     0m8.113s  

ALL_CORES + 4G  
real    0m51.845s  
user    0m48.213s  
sys     0m7.988s  
</code></pre>
<p>For this dataset, using a 2G cache improves performance, but increasing it to 4G makes processing slower.</p>
<h3><b>Questions:</b></h3>
<ol><li>
<p>How does GDAL’s caching mechanism impact performance in these scenarios?</p>
</li><li>
<p>Why does increasing cache size sometimes degrade performance?</p>
</li><li>
<p>Is there a recommended way to tune cache settings for MODIS HDF processing, considering that some layers (like QC) behave differently from others (like LST_1Km)?</p>
</li></ol>
<p>Any insights into how GDAL handles multi-threading and caching internally would be greatly appreciated.</p>
<p>Thanks in advance for your help!</p>
<p>Best regards,</p><p>Varisht Ghedia</p></div>
</div></div>