Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fs file caching (#10535) #1058

Merged
merged 20 commits into from Apr 26, 2013
Merged

Fs file caching (#10535) #1058

merged 20 commits into from Apr 26, 2013

Conversation

joshmoore
Copy link
Member

Makes use of the new loci.formats.Memoizer class to cache all calls to IFormatReader.setId() on the server-side. The intent is that quick calls to the server from web (panning over a large image, etc) should incur lower cost per call.

Memo files are created under /tmp/memo (or similar), e.g.

$ find /tmp/memo -name "*.bfmemo"
/tmp/memo/OMERO/ManagedRepository/root_0/2013-04/17/12-34-02.906/.3D-CONFOCAL-PSF-235nm.msr.bfmemo

Loading the memo file is usually under 100ms, while calls to setId() can be several seconds. (Memoizer skips caching when setId() is faster than 100ms).

Critical for testing is a breadth of file formats because the contents of each Reader may or may not cause serialization issues. A single (unused) field in the OBFReader, for example, was able to crash the JVM.

See:


--no-rebase FS only

Reduce the number of locations that OMEROWrapper is created,
passing directory when it is clearly server-side.

Note: this currently does not compile because the OMEROWrapper
lives in blitz while everything else lives in romio.
To simplify cleanup, having all caches written into a single
directory was added to the `loci.formats.Memoizer` class. Here,
hard-coded as `/tmp/memo`.

The various import related classes, howerver, are a tangle of
dependencies making it very difficult to not copy the same block of
code, e.g. the ReaderWrapper sequence and setting the proper
directory, throughout the code base.

By splitting OMEROWrapper into a CachingWrapper part in romio with
no dependencies on blitz we can mostly do this.

A few issues:
 * now, client-side caching is disabled
 * requires an insight dependency on romio
 * enforces use of a wrapper through ome.io.bioformats
 * allowed for preliminary, needed import class cleanup:
    - use of `wrap()` is encouraged
    - overriding `ReaderWrapper` method is discouraged
    - discourage holding on to wrapper instances
@snoopycrimecop
Copy link
Member

Conflicting PR. Removed from build OMERO-merge-develop#233. See the console output for more details.

joshmoore and others added 5 commits April 18, 2013 10:14
Two branches both tried to refactor the copy-n-paste
issues with reader creation. The combined solution means
it's possible to override createBfReader, but by default
a simple CachingWrapper will be returned.

A rebase would have been unduly arduous since in the early
commits of the fs-file-caching branch the CachingWrapper
which would be needed wasn't present, making bissecting
later impossible.

Conflicts:
	components/romio/src/ome/io/nio/PixelsService.java
This reverts commit 6f69e38.

Conflicts:

	components/romio/src/ome/io/bioformats/CachingWrapper.java
	components/romio/src/ome/io/nio/PixelsService.java
There is almost certainly more cleanup that can be done in terms of
where the reader stack is constructed and how it is stored.  This is at
least a start, and is hopefully safe and minimally invasive.

See #10750.
@joshmoore
Copy link
Member Author

Likely last commits pushed to this branch and kryo-memoizer in bioformats, and testing locally. A quick validation should be possible by @pwalczysko tomorrow morning (or earlier if we re-launch gretzky).

@pwalczysko
Copy link
Member

@joshmoore : just checked it, leica-scn, flex plate, svs - works fine - caching definitely in place and does what it should

@joshmoore
Copy link
Member Author

@pwalczysko: did you test locally? These changes haven't been deployed to gretzky yet.

@pwalczysko
Copy link
Member

@joshmoore no I did not - will do

@pwalczysko
Copy link
Member

@joshmoore my build with this PR fs-file-caching failed
is there any other PR which is necessary for it to work and which I have to merge ?

 BUILD FAILED
/Users/petr/Work/openmicroscopy/build.xml:187: The following error occurred while executing this line:
/Users/petr/Work/openmicroscopy/components/antlib/resources/global.xml:383: The following error occurred while executing this line:
/Users/petr/Work/openmicroscopy/components/antlib/resources/lifecycle.xml:62: impossible to resolve dependencies:
    resolve failed - see output for details

@joshmoore
Copy link
Member Author

Yes, sorry. You'll need my kryo-memoizer PR from bioformats.

This removes the last location with /tmp/memo hard-coded.
Along with a change to Bio-Formats, caching will only
occur when a directory is explicitly set. With the current
setup, this means that caching does *not* occur during:

 * client-side import
 * server-side import
 * any where in Bio-Formats natively

The only time memoization should occur is in the ome.io
(i.e. romio) package during rendering and pixel reading.
@pwalczysko
Copy link
Member

@joshmoore : merged the kayo-memoizer branch into my components/bioformats and then merged fs-file caching branch into my test branch in my openmicroscopy folder and ran

./build.py clean && ./build.py && ./build.py release-clients

For the last couple of lines before the end see below:



compile:
Compiling 26 source files to /Users/petr/Work/openmicroscopy/components/romio/target/classes
/Users/petr/Work/openmicroscopy/components/romio/src/ome/io/bioformats/BfPixelsWrapper.java:22: cannot find symbol
symbol  : class Memoizer
location: package loci.formats
import loci.formats.Memoizer;
                   ^
/Users/petr/Work/openmicroscopy/components/romio/src/ome/io/nio/PixelsService.java:23: cannot find symbol
symbol  : class Memoizer
location: package loci.formats
import loci.formats.Memoizer;
                   ^
/Users/petr/Work/openmicroscopy/components/romio/src/ome/io/nio/PixelsService.java:720: cannot find symbol
symbol  : class Memoizer
location: class ome.io.nio.PixelsService
        reader = new Memoizer(reader, 100, memoizerDirectory);
                     ^
/Users/petr/Work/openmicroscopy/components/romio/src/ome/io/nio/SimpleBackOff.java:116: warning: [deprecation] writeImage(java.io.OutputStream,java.awt.image.BufferedImage,boolean,int[],double) in loci.formats.services.JAIIIOService has been deprecated
            service.writeImage(stream, image, false, CODE_BLOCK, 1.0);
                   ^
3 errors
1 warning

BUILD FAILED
/Users/petr/Work/openmicroscopy/build.xml:186: The following error occurred while executing this line:
/Users/petr/Work/openmicroscopy/components/antlib/resources/global.xml:383: The following error occurred while executing this line:
/Users/petr/Work/openmicroscopy/components/antlib/resources/lifecycle.xml:169: The following error occurred while executing this line:
/Users/petr/Work/openmicroscopy/components/antlib/resources/lifecycle.xml:158: Compile failed; see the compiler error output for details.

@pwalczysko
Copy link
Member

Did edit of etc/local.properties.example to include:
https://github.com/openmicroscopy/openmicroscopy/pull/1080/files.
Merged once more the kayo-memoizer and rebuild, changed the parameters in server builds and works fine now.
Imported couple of from_skyking/flex/frans/ plates, as well as leica-scn/mihaela, gatan, trestle, from test_images_good. Hit the bug reported as #10772 on my way during the impor -> full crash of Insight. But, the images imported and displayed fine (after I reopened Insight). The speed of opening in full viewer was very good. The caching is present.
Tried to switch off the caching using following workflow:

  • open a well from from_skyking/flex/frans/Flex 3D uncompressed 8 july 2009/20090618-onco-04/Meas_01(2009-06-18_16-46-32)/002006000.flex
  • this takes (with the caching ON) less than a second
  • go to /OMERO/ folder
  • do
    [petr@ls25165 /OMERO]$ mv BioFormatsCache/ BioFormatsCache_disabled/
  • open the same well again
  • this time it takes 3-4 sec
  • do
    [petr@ls25165 /OMERO]$ mv BioFormatsCache_disabled/ BioFormatsCache/
  • open the same well again
  • again, it takes only less than 1 sec to open
  • similar behaviour was observed with leica-scn/mihaela (less than one sec with and 1-2 sec without caching), hamamtsu/....ndpi (1 sec with and 2-4 sec without)
  • trestle CMU-1 - less than a second with, 3-5 sec without caching
  • gatan is in every case so fast that the effect of caching is imperceptible

Works fine.

@joshmoore
Copy link
Member Author

Note: I updated my kryo-memoizer just now to get travis passing. Once it's merged, then this PR should be mergeable as well.

@joshmoore
Copy link
Member Author

gh-1108 bumps the submodule pointer to include kryo-memoizer.

joshmoore added a commit that referenced this pull request Apr 26, 2013
@joshmoore joshmoore merged commit 875e189 into ome:develop Apr 26, 2013
@joshmoore joshmoore deleted the fs-file-caching branch January 23, 2014 19:16
@sbesson sbesson modified the milestones: 5.0.0-alpha2, 5.0.0 Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants