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

storage: abstract disk I/O #660

Open
skyzh opened this issue Jun 9, 2022 · 7 comments
Open

storage: abstract disk I/O #660

skyzh opened this issue Jun 9, 2022 · 7 comments

Comments

@skyzh
Copy link
Member

skyzh commented Jun 9, 2022

Currently, we have create_dir, etc. everywhere. We'd better have a single interface to operate files on disk, so as to support in-memory / disk / object store backends.

@wangrunji0408
Copy link
Member

Isn't that only the disk backend depends on file operations?

@skyzh
Copy link
Member Author

skyzh commented Jun 13, 2022

Yes. But even disk backend has two modes -- pure in-memory mode (for testing, where files are stored in a hash map), and real on-disk mode.

@skyzh
Copy link
Member Author

skyzh commented Jun 13, 2022

If we can abstract all disk operations to use a trait like ObjectStore, we can prevent unwanted writes to disk in in-memory secondary storage.

@wangrunji0408
Copy link
Member

I think we should use the real on-disk mode in testing, to make sure we are correctly using the system fs API. Data path can be redirected to ramfs/tmpfs to speed up.

@wangrunji0408
Copy link
Member

wangrunji0408 commented Jun 13, 2022

Later we can also introduce the simulation testing, where all fs API will be mocked to an in-memory simulator.

@skyzh
Copy link
Member Author

skyzh commented Jun 13, 2022

I switch to pure in-memory mode because tmpfs is slow 🤣 fsync and manifest write will add 1s latency to every disk test case, which looks weird.

Maybe I can try switch off fsync for all writes (even manifest), and maybe things will work.

@wangrunji0408
Copy link
Member

🤣 okay let's stay in memory mode for efficiency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants