mosaicml / mosaicml/streaming

Does MDSWriter release the GIL?

Open
#978 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.6k
Forks
206
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a lot of small files (100k files, each around 15kb) and I want to save them to a MDS dataset.
I am trying to use multiple writing threads - as recommended in the documentation, I have each worker write a subset of the files in a different subdirectory, and then join the index.json file later on.

The problem is that this is still quite slow (writing at around 300-500 kb / second), and having multiple writers doesn't seem to help speeding this up too much. Does MDSWriter release the GIL when writing to remote files (an S3 bucket)? Or should I use different processes in this case?

Are there any tricks I can use to improve / debug the writing speed? Even the single threaded performance seems suboptimal. Does it make more sense to point the MDS Writer to a local folder instead, and upload the entire folder when done manually?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MDSWriter entry point and the documentation's multi-worker guidance, then compare writing to an S3 bucket with writing to a local folder. Reproduce the reported 100k-small-files workload and measure single-threaded, threaded, and process-based runs, including the later index.json join. Done means the GIL behavior and a supported performance recommendation are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
data-engineering, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.