-
Notifications
You must be signed in to change notification settings - Fork 334
Description
Bug report
Describe the bug
Many ImageServer implementations are derived from AbstractTileableImageServer, which breaks requests into fixed tiles and fulfils them using a cache where possible.
Duplicate tile requests occur e.g. when writing an OME-TIFF using multithreading or running a pixel classifier and with a tile size larger than the tile size of the reader. It can result in the same image tiles being read multiple times, potentially adding considerable unnecessary overhead (since tile decompression can be a bottleneck).
Reducing or eliminating this can potentially improve performance substantially, particularly for cases where tile reading is slow.
To Reproduce
The bug can easily be reproduced when writing a pyramidal OME-TIFF or training a pixel classifier - although unfortunately it isn't easy to tell that it has been reproduced, since the duplicate requests aren't reported.
The problem was identified through VisualVM profiling and running in debug mode, checking for repeated tile requests while trying to improve image write performance.
Expected behavior
If a thread wants to obtain a tile that is currently being read by another thread, the first thread should wait until the tile is returned - it should not submit a new read request.
Desktop (please complete the following information):
- OS: All
- QuPath Version 0.3.0 (and earlier)
Additional context
This isn't really an issue when only viewing images, since requests are made that perfectly match tiles available through the ImageServer and pending requests are checked. However it can be an issue when regions are requested in any other way.
Any solution should avoid generating more threads within an ImageServer.