fsspec / fsspec/gcsfs

[Future Work] Promote DirectMemmoveBuffer into Standard Bucket Path

Open
#888 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
398
Forks
181
Avg merge
2d 10h
Merged PRs (30d)
36

Description

ZonalFile manages concurrency through an in-house buffer that preallocates space, allowing workers to write directly to memory. It uses the ctypes.pythonAPI library to execute GIL-free writes, which avoids unnecessary data copies and prevents the global interpreter lock from creating a bottleneck. We call it DirectMemmoveBuffer as of today.

The standard path, by comparison, relies on b"".join. In this process, each worker generates its own byte object, and a new, combined copy is created when the join operation executes. This overhead limits throughput for standard buckets.

As for why we are addressing this now: we initially held off on integrating this with regional buckets due to concerns from the fsspec maintainers regarding the use of the ctypes API. If we are confident in the stability of our buffer, it is time to promote it to the standard bucket

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 by locating ZonalFile, DirectMemmoveBuffer, and the standard bucket write path. Compare the existing direct-memory implementation with the b"".join path, then review the ctypes.pythonAPI safety concerns before changing the shared path. Done means standard buckets use the buffer without regressions and relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.