On Wed, Jul 11, 2012 at 7:13 AM, Rob Marianski <[email protected]> wrote:
> A user running geoserver on windows noticed that when using a
> cascading wms layer, temporary files were being written out to disk
> for each request. We investigated, and stumbled across this
> explanation:
>
> http://frequal.com/java/PreventUnexpectedImageIODiskWrites.html
>
> It turns out that it actually resolved the issue. To verify, we
> created a GeoServerInitializer in a separate module, and the jar was
> added to geoserver. There were no more writes on the requests.
>
> Are there any possible consequences here? If not, can this be set on
> geoserver startup in general? And if this isn't something that should
> be set globally for everybody, is it reasonable to create a
> GeoServerInitializer and put the call in there?

The are consequences, such move can undermine the server
stability in a severe way and make it go OOM very often under the
right kind of load.

When reading and writing images to or from generic I/O streams
ImageIO has to wrap the stream into a memory buffer or file
buffer image stream, which is not really a stream anymore, but
a full random access structure.

This is required because both when reading and writing images
it happens that one has to jump back and forth.
If one forces the usage of memory buffers (disabling the cache usage
fully) the consequences is that the png you are trying to read from
the remote WMS is fully read in memory,
and that 200GB geotiff that someone might be trying to
get out of WCS is also fully written in memory before being
streamed out: you basically give up control on the amount of
heap memory each request is using, leaving GeoServer at
the mercy of the users and the events.

If you look into the settings you'll find a threshold at which
the current system decides whether to use a memory or a
file based imageinputstream (and the same goes for the output).

The above system requires image reading/writing code to use
the GeoTools ImageIOExt class to get the image input streams,
something that the WMSCoverageReader is indeed not doing.
That indeed needs fixing, jira + patch welcomed

Cheers
Andrea

-- 
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
mob:    +39 339 8844549

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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to