[Geoserver-users] OutOfMemoryError when using an ImageMosaic of PNG files

I've created an ImageMosiac of 39 PNG files with a total disk size of 37.4MB. When I'm attempting to view the mosaic at a zoom level where no more than 2 images would be exposed, geoserver runs out of memory. I've found when I turn off the native codec (by either removing the binary files from the JDK installation or using the System property "-Dcom.sun.media.imageio.disableCodecLib=true") I no longer run out of memory. I do however end up with an image that is no longer scaled and/or projected correctly onto my base layer (I'm viewing using OpenLayers). I've had similar experiencing after converting my PNG images to TIFF. Instead of running out of memory though, I seemed to get in some sort of CPU intensive process (infinite loop??) that never seemed to complete. Once I turned off the native codec, the TIF mosaic was able to return an image that was once again not scaled/projected correctly. I've troubleshooted using a subset of my mosaic (5 images all connected so that I could see how they overlayed with each other). In my troubleshooting I discovered that the PNG mosaic would render properly regardless of the native codec plugin for all the images in the mosaic but 1 (which was equivalent in size to the other 4...). The TIFF mosaic plugin still had issues with the smaller image count.

I'm interested in knowing if others are having similar type problems and if so, what workarounds you've found. We're currently leaning towards using the PNG image format as it tends to take up less physical space when compared to TIFF, not to mention if we decided to render the images as is in a browser, PNG is more widely accepted in browsers.

Here's my environment:
OS: Fedora 7, kernel 2.6.21-1.3228.fc7
JDK: Sun 1.5.0_11-b03
JAI/ImageIO: 1.1.3/1.1 (also tried beta versions 1.1.4/1.2)
Geoserver: 1.5.1 (also tried alpha 1.6)
OpenLayers: latest-n-greatest
Tomcat Config: -Xmx512M -Xms128M

Jeremy Nix ha scritto:

I'm interested in knowing if others are having similar type problems and if so, what workarounds you've found. We're currently leaning towards using the PNG image format as it tends to take up less physical space when compared to TIFF, not to mention if we decided to render the images as is in a browser, PNG is more widely accepted in browsers.

Unfortunately both TIFF and PNG plugins are pretty rough at the moment.
If you want good performance, you need to convert your images to
GeoTIFF (not plain tiff), get rid of the world files, and make sure
the GeoTIFF are natively tiled and eventually compressed.
This should give you better performance.

About PNG, I don't know if we can do much, since PNG literally explode
when you decompress them in memory, and there is no way to partially
read just one part of the image... Do you know of any other software
that fares better than Geoserver at PNG mosaics? I would be
quite interested to know.

Cheers
Andrea