1 / 16

Single Writer / Multiple Reader (SWMR)

Single Writer / Multiple Reader (SWMR). Dana Robinson The HDF Group. Efficient Use of HDF5 With High Data Rate X-Ray Detectors Paul Scherrer Institut. Basic Idea.

Download Presentation

Single Writer / Multiple Reader (SWMR)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Single Writer / Multiple Reader(SWMR) Dana Robinson The HDF Group Efficient Use of HDF5 With High Data Rate X-Ray Detectors Paul ScherrerInstitut

  2. Basic Idea Many use cases call for a single writer process which writes data to a single HDF5 file, and multiple readers, which will consume the HDF5 data as it is written. Ideally, we would like to support this scenario with no communication between the processes. With no IPC/signals, there are clearly limits on how this can be used. Seeing arbitrary changes in the read files would be expensive. Readers will have to poll for expected changes. - Changes in dataset sizes - New groups created in a target group - etc.

  3. Data Independent Reader Processes Writer Reader Reader Reader HDF5 File

  4. Example New data elements Writer Reader Which can then be read by a reader. With no IPC necessary. HDF5 File Are added to a dataset in the file.

  5. Basic engineering challenge is to ensure that the readers always see a coherent (though possibly not up to date) HDF5 file. Data Writer Reader Reader Reader HDF5 File

  6. Setting up for SWMR (Basic) Very easy to set up! Writer - Call H5Fopen or createusing the H5F_ACC_SWMR_WRITE flag. Reader - Call H5Fopen using the H5F_ACC_SWMR_READ flag.

  7. Using SWMR (Basic) Very easy to use! Writer - Write data to the HDF5 file. Reader - Poll, checking the size of the dataset to see if there is new data available for reading. - Read new data, if any.

  8. Internal Changes Metadata must be carefully staged so that readers cannot encounter invalid data. Readers must be more aggressive about discarding their metadata cache entries. This needs to be done after a specified time t. Readers must make sure that no read operation takes longer than the above time t. (This ensures the reader does not use metadata which has been invalidated by the writer.) This timeout value t, is stored in the superblock when the file is opened and deleted when the file is closed.

  9. Metadata Flush Dependencies Suppose we have a metadata item which refers to another metadata item in the file. metadata item 2 metadata item 1 1 (2) 2 reference to address of metadata item 2

  10. Metadata Flush Dependencies If we add a new metadata item to the file and update the reference to point to it, we have to be careful about the order in which the metadata is flushed out of the cache. metadata item 1 metadata item 2 1 (3) 2 metadata item 3 3 reference to address of new metadata item 3

  11. If the reference-containing item is flushed before the new item, the reader may read the new reference before the item, creating an invalid state. BAD 1 (3) 1 (3) 2 3 garbage? Writer HDF5 File Reader

  12. If the new metadata item is flushed before the reference-containing item, the reader will not be fully up to date, but will still be consistent. OK 1 (2) 1 (3) 2 3 3 Writer HDF5 File Reader

  13. We are creating flush dependencies in the internal data structures to ensure that metadata cache flush operations occur in the proper order. OK 1 (2) 1 (3) 2 3 3 Writer HDF5 File Reader

  14. File Open and Close Problem The writer MUST be the first process to open the file so the superblock message can be written. If a reader opens the file first, it will find no SWMR superblock message and not use any SWMR protocols when accessing the file. Alternatively, we can create a mechanism for communicating SWMR on/off between processes.

  15. File Open and Close Problem Possible solution: Consider the superblock as volatile whenever SWMR is a possibility. Requires setting a SWMR timeout t. - Writers do not write until time t has passed. - Readers check for SWMR superblock msg every time t. Ensures that the reader and writer will use SWMR together. Also allows readers to discontinue using SWMR protocols when the writer is not actively writing (performance enhancement).

  16. Status Scheduled HDF5 1.10.0 feature. Being paid for by a commercial client of The HDF Group. Currently under development. Metadata cache flush dependencies in progress. Other work in the design stage. Very high priority.

More Related