Hi,
writing to provide a heads up about a small api change needed to solve
http://jira.codehaus.org/browse/GEOS-4278
The core of the problem is probably better explained here:
http://jira.codehaus.org/browse/GEOT-3559
Long story short, when writing out images from WMS or WCS
many image writers need a random access container to write to.
A OutputStream is not, so a temporary container is create either
in memory or on the disk.
Unfortunately ImageIO only allows to statically decide whether
to use memory or disk as the random access container, but
either of them is suboptimal in different cases:
- memory cache is fast, but does not scale to large images (OOM
waiting and the server gets severely bogged down)
- disk cache scales but requires I/O on temp files which is slower
What we did was to create a helper class, ImageIoExt, back
in GeoTools, that can be used to create the image output streams
in a smarter way: it will check the image size and decide whether
to use memory or disk based on its size*.
This way we can use memory caches for most of WMS outputs,
but also have a WCS that can scale up without troubles too.
The changes needed are attached to:
http://jira.codehaus.org/browse/GEOS-4278
The API changes are two:
- deprecation of imageIOCache property in JAIInfo (not removed because
it would break xstream loading)
- addition of void imageIOCacheThreshold in CoverageAccessInfo
Nothing big, but still, it's core api so I thought I would give a heads
up.
What do you think? Ready for a GS that can be both fast in WMS and
scale up in WCS? :-p
I would like to also backport the changes to 2.1.x now that the 2.1.0
release is finally out.
Cheers
Andrea
*: Also tried, twice, to
create a imageio-ext stream factory plugin but it turned out
to have to replicate the existing ImageIO classes with a non
trivial amount of code, a ImageOutputStream has unfortunately
a crazy large API surface, it's at the same time a ImageInputStream,
DataInput, and DataOutput, just making a wrapper requires various hundreds
of lines of code and working with some non trivial state management...
--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
-------------------------------------------------------