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

Java API services very slow against IDR #67

Closed
dominikl opened this issue Nov 16, 2022 · 4 comments
Closed

Java API services very slow against IDR #67

dominikl opened this issue Nov 16, 2022 · 4 comments

Comments

@dominikl
Copy link
Member

See Omero Java API with public data hosted on the IDR server .

I can confirm, using the BrowseFacility of the gateway it takes nearly 30sec. Same using the ContainerService of the Java API, which is expected as that's what the BrowseFacility is using under the hood. In contrast to < 100ms using the QueryService!

It's not really an issue of the Java Gateway but rather of the Java API ContainerService, might have to move the issue to a different github repository.

Example code
try (Gateway g = new Gateway(new SimpleLogger())) {
            long datasetId = 7808;  // idr0066 experimentD: https://idr.openmicroscopy.org/webclient/?show=project-854 
            ExperimenterData exp = g.connect(loginCredentials);
            SecurityContext ctx = new SecurityContext(exp.getGroupId());

            ParametersI param;
            DatasetI tmp;
            DatasetData dataset;
            long start;

            System.out.println("BrowseFacility");
            start = System.currentTimeMillis();
            Collection<ImageData> imgs = g.getFacility(BrowseFacility.class).getImagesForDatasets(ctx, Collections.singletonList(datasetId));
            for (ImageData img : imgs)
                System.out.println(img.getName());
            System.out.println(System.currentTimeMillis() - start);

            System.out.println("ContainerService");
            IContainerPrx cs = g.getPojosService(ctx);
            start = System.currentTimeMillis();
            param = new ParametersI();
            param.leaves();
            tmp = (DatasetI) cs.loadContainerHierarchy("Dataset", Collections.singletonList(datasetId), param).iterator().next();
            dataset = new DatasetData(tmp);
            for (Object img : dataset.getImages())
                System.out.println(((ImageData)img).getName());
            System.out.println(System.currentTimeMillis() - start);

            System.out.println("QueryService");
            IQueryPrx qs = g.getQueryService(ctx);
            param = new ParametersI();
            param.addId(datasetId);
            String query = "select d from Dataset as d " +
                    "join fetch d.imageLinks as l " +
                    "join fetch l.child as i " +
                    "where d.id = :id";
            start = System.currentTimeMillis();
            tmp = (DatasetI) qs.findByQuery(query, param);
            dataset = new DatasetData(tmp);
            for (Object img : dataset.getImages())
                System.out.println(((ImageData)img).getName());
            System.out.println(System.currentTimeMillis() - start);
        }

Output

BrowseFacility
ExpD_chicken_embryo_MIP.ome.tif
ExpD_chicken_embryo_stitched.ome.tif
29038
ContainerService
ExpD_chicken_embryo_MIP.ome.tif
ExpD_chicken_embryo_stitched.ome.tif
28236
QueryService
ExpD_chicken_embryo_stitched.ome.tif
ExpD_chicken_embryo_MIP.ome.tif
66
@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/omero-java-api-with-public-data-hosted-on-the-idr-server/73946/2

@jburel
Copy link
Member

jburel commented Nov 16, 2022

This is not surprising since the amount of data that is loaded is different
See https://github.com/ome/omero-server/blob/master/src/main/java/ome/services/query/PojosLoadHierarchyQueryDefinition.java

One option will be to offer "light" queries from the gateway itself

@dominikl
Copy link
Member Author

One option will be to offer "light" queries from the gateway itself

Good idea.

@dominikl
Copy link
Member Author

That's actually covered by above mentioned PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants