Skip to content

Commit 9a5dae6

Browse files
author
rouault
committedFeb 11, 2015
gdal_translate and gdalwarp: increase GDAL_MAX_DATASET_POOL_SIZE default value to 450. VRT format documentation: document GDAL_MAX_DATASET_POOL_SIZE (#5828)
git-svn-id: https://svn.osgeo.org/gdal/trunk/gdal@28454 f0d54148-0727-0410-94bb-9a71ac55c965
1 parent 2d5ab11 commit 9a5dae6

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
 

‎apps/gdal_translate.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,19 @@ static int ProxyMain( int argc, char ** argv )
347347
if( argc < 1 )
348348
exit( -argc );
349349

350+
/* -------------------------------------------------------------------- */
351+
/* Set optimal setting for best performance with huge input VRT. */
352+
/* The rationale for 450 is that typical Linux process allow */
353+
/* only 1024 file descriptors per process and we need to keep some */
354+
/* spare for shared libraries, etc. so let's go down to 900. */
355+
/* And some datasets may need 2 file descriptors, so divide by 2 */
356+
/* for security. */
357+
/* -------------------------------------------------------------------- */
358+
if( CPLGetConfigOption("GDAL_MAX_DATASET_POOL_SIZE", NULL) == NULL )
359+
{
360+
CPLSetConfigOption("GDAL_MAX_DATASET_POOL_SIZE", "450");
361+
}
362+
350363
/* -------------------------------------------------------------------- */
351364
/* Handle command line arguments. */
352365
/* -------------------------------------------------------------------- */

‎apps/gdalwarp.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,19 @@ int main( int argc, char ** argv )
410410
if( argc < 1 )
411411
GDALExit( -argc );
412412

413+
/* -------------------------------------------------------------------- */
414+
/* Set optimal setting for best performance with huge input VRT. */
415+
/* The rationale for 450 is that typical Linux process allow */
416+
/* only 1024 file descriptors per process and we need to keep some */
417+
/* spare for shared libraries, etc. so let's go down to 900. */
418+
/* And some datasets may need 2 file descriptors, so divide by 2 */
419+
/* for security. */
420+
/* -------------------------------------------------------------------- */
421+
if( CPLGetConfigOption("GDAL_MAX_DATASET_POOL_SIZE", NULL) == NULL )
422+
{
423+
CPLSetConfigOption("GDAL_MAX_DATASET_POOL_SIZE", "450");
424+
}
425+
413426
/* -------------------------------------------------------------------- */
414427
/* Parse arguments. */
415428
/* -------------------------------------------------------------------- */

‎frmts/vrt/vrt_tutorial.dox

+16
Original file line numberDiff line numberDiff line change
@@ -866,4 +866,20 @@ underlying datasets. So, if you open twice the same VRT dataset by the same
866866
thread, both VRT datasets will share the same handles to the underlying
867867
datasets.
868868

869+
\section gdal_vrttut_perf Performance considerations
870+
871+
A VRT can reference many (hundreds, thousands, or more) datasets. Due to
872+
operating system limitations, and for performance at opening time, it is
873+
not reasonable/possible to open them all at the same time. GDAL has a "pool"
874+
of datasets opened by VRT files whose maximum limit is 100 by default. When it
875+
needs to access a dataset referenced by a VRT, it checks if it is already in
876+
the pool of open datasets. If not, when the pool has reached its limit, it closes
877+
the least recently used dataset to be able to open the new one. This maximum
878+
limit of the pool can be increased by setting the GDAL_MAX_DATASET_POOL_SIZE
879+
configuration option to a bigger value. Note that a typical user process on
880+
Linux is limited to 1024 simultaneously opened files, and you should let some
881+
margin for shared libraries, etc...
882+
As of GDAL 2.0, gdal_translate and gdalwarp, by default, increase the pool size
883+
to 450.
884+
869885
*/

0 commit comments

Comments
 (0)
Please sign in to comment.