Re: [netcdf-java] Persisting a NetcdfDatasetCache

  • Subject: Re: [netcdf-java] Persisting a NetcdfDatasetCache
  • From: John Caron <caron@xxxxxxxxxxxxxxxx>
  • Date: Wed, 20 Feb 2008 14:07:52 -0700
Hi Jon and Nick:

Ive been considering whether an object cache like ehcache would be the way to 
go, but havent had
time to investigate.

1. Since NetcdfFileCache/NetcdfDatasetCache encapsolates an open file handle, I 
need to control the
number of such handles. Ive assumed that i want to avoid the overhead of 
opening and closing files,
but havent actually timed this (BAD programmer!).

2. The first few versions of netcdf java were serializable, but ive stopped 
supporting that for
various reasons (eg Bloch "Effective Java" item 54). Could be revisted, but 
serialization is a pain.

"Do not implement Serializable lightly, since it restricts future flexibility, 
and publicly exposes
class implementation details which are usually private. As well, implementing 
Serializable correctly
is not trivial."

"Serialization demands not only backward compatibility, but forward 
compatibility. You might have
people running slightly older versions of software needing to read the newer 
versions, and vice
versa. Serialization incompatibilities are even more serious than API 
incompatibilities: we are
talking about customers not being able to read data that they innocently stored 
away with a previous
version of your software!"

If it turns out large enough improvements are possible, one could use 
NetcdfDatasetCache as first
level cache, then on ejection, close the file and use ehcache to save the 
serialized NetcdfDataset,
which only need reopen the file when fetching. or something like that.

I guess some timings would be useful to see how much such a feature is worth....


Jon Blower wrote:
> Hi,
> 
> My server application (ncWMS) uses the NetcdfDatasetCache as an
> in-memory store of metadata to increase performance and reduce the
> need to continually reload metadata from files.  It would be really
> useful if I could persist the cache to disk so that the metadata is
> available following a server restart (saves trawling through all the
> data files again).
> 
> Is it possible to save the contents of a NetcdfDatasetCache to disk?
> I notice that it isn't marked Serializable.
> 
> Cheers, Jon
> 


  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: