-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework SubprocessImpl for extern-worker
Summary: SubprocessImpl works, but is pretty slow. Most of this slowness comes down to how it stores blobs and it's input/output format. For blobs, it uses a single file per blob. This can result in a huge number of files, which stresses the file system. Moreover, the input/output format it uses has a lot of sub-directories filled with symlinks, which is again stressful. Rework SubprocessImpl to be more efficient. Instead of an individual file per blob, it keeps a pool of blob files. Blobs are just appended to the end of the next free blob file. Blob files are allocated per-thread, so there's no need for synchronization. As an additional optimization, blobs below a certain threshold aren't stored on disk at all, and are instead stored "inline" in the RefId. To allow for all of this, RefId now has a m_size and a m_extra field. m_size is *always* the blob size (which is useful), and can be used to distinguish inline from not. m_extra contains the offset of the blob within the blob file. To address input/output overhead, the notion of creating directories is discarded entirely. Instead the metadata is encoded in a string (using BlobEncoder and BlobDecoder), and sent over to the worker via stdin. Once the worker has done it's work and written any blobs to disk, it likewise returns it's output via a pipe, which the parent can read. This avoids writing to disk at all. Reviewed By: edwinsmith Differential Revision: D39153960 fbshipit-source-id: 933d10d39463e57897ba75e58e93b790d88be654
- Loading branch information
1 parent
2cb71fd
commit 280e689
Showing
6 changed files
with
1,170 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.