[gdal-dev] Best practices for concurrent writes with GDAL (was RasterIO in paralel)

Frank Warmerdam warmerdam at pobox.com
Tue Feb 8 20:29:50 EST 2011


On 11-02-08 08:04 PM, Francis Markham wrote:
> Is there any way to disable the block cache altogether?

Francis,

No, there is no way to disable the block cache altogether.  For
specific drivers you could skip past the block cache by calling
GDALRasterBand::WriteBlock() but this may not work well for all
drivers.

> Does setting the cache size to zero work?

In theory that might trigger an immediate flush as soon
as the block is pushed into the cache, but I wouldn't trust
it.

 > And is there a way to do this from a python script?

You can set the block cache max with gdal.SetCacheMax().  I
think the argument is a size in bytes.

GDALRasterBand::WriteBlock() is likely not accessable from
Python.

My suggestion is just to set the block cache very large, try
to only keep a few datasets open at a time, and make sure
they get closed before the block cache comes near to being
full.

But the real solution is to fix the issue in the core.
Providing some logic to ensure that blocks are only flushed
in the thread to which they belong or something like that.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list