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

Support for Concurrent Access with XAM.jl: Reader/Writer Safety and Locking Considerations #76

Open
abhinavsns opened this issue Aug 13, 2024 · 0 comments
Labels
question Further information is requested

Comments

@abhinavsns
Copy link

Hello,

I'm working on a distributed Julia application where multiple workers (processes) need to access the same BAM file concurrently, each reading different intervals using an associated index file. Specifically, I create separate XAM.BAM.Reader instances on different workers and have them read from the same BAM file but from different genomic regions.

I have a few questions regarding this use case:

Thread/Process Safety: Is the XAM.BAM.Reader thread-safe or process-safe when multiple instances on different workers read from the same BAM file concurrently but access different intervals? Are there any specific considerations or potential issues I should be aware of when doing this?

Writing Concurrently: In the same setup, I am considering using XAM.BAM.Writer for writing outputs. How should writing be handled when multiple workers might write to the same BAM file? Would it be sufficient to use file-level locks, such as:

BAM.Writer(BGZFStream(open(path, "w", lock=true), "w"))

Are there additional considerations or recommendations for safely writing to BAM files in a distributed environment?

Locking Mechanisms: If locks are necessary, what should I be careful of when implementing them? Is the file-level lock shown above sufficient for ensuring data integrity, or would additional locking strategies be required for BGZFStream?

Your guidance on this would be greatly appreciated. Thank you for your amazing work on XAM.jl!

@kescobo kescobo added the question Further information is requested label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants