On Thu, Apr 21, 2011 at 8:58 AM, Devrim Baris Acar
<
devrimbaris@xxxxxxxxx> wrote:
Hi,
I have developed a custom wms renderer for udig which holds a reference to
the original coverage retrieved from geoserver(raw geotiff crop ).
I have noticed a considerable slowdown as geotiff sizes get bigger (>20
seconds )
I have pinned the problem to be the following lines
----------------------------------------------
inputStream = wms.issueRequest(request).getInputStream();
image[0] = ImageIO.read(inputStream);
----------------------------------------------
Now I have tested with various java codes for streams, command line tools
like "wget", "curl".
Command line tools retrieve the image in nearly 2 seconds.
Java code with buffered streams retrieve image in 20 seconds.
So I have used Apache Commons HTTPClient to retrieve the image, stored in a
file, and let ImageIO stream from the filestream, now the responses are 3-4
seconds, which is much more acceptable.
That leaves the question to how ImageIO.read works in internals .
ImageIO needs random access readers and writers, if you provide a stream
you force it to copy the file in a random access container (either another file
or a byte[] in memory) and decode the images from there, depending
on how ImageIO is configured (by default it will work on a file).
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
http://www.geo-solutions.ithttp://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIThttp://www.linkedin.com/in/andreaaimehttp://twitter.com/geowolf-------------------------------------------------------
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.nethttp://lists.refractions.net/mailman/listinfo/udig-devel