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

layout design questions #42

Open
HypenZou opened this issue Sep 13, 2024 · 2 comments
Open

layout design questions #42

HypenZou opened this issue Sep 13, 2024 · 2 comments

Comments

@HypenZou
Copy link

I would like to ask why fixed size blocks are used. Considering that this WAL implementation is used as bitcask storage log, the waste of storage space due to padding + record type is significant. I noticed that RocksDB wal also has a similar structure. Compared to directly appending records, what are the advantages of doing it this way?

@roseduan
Copy link
Contributor

When you read a large wal file from the begining to end, read a fix-sized block is more efficient. Normally the size is equals to the page cache size.

if one record is small, like 1KB, you will read 32 tims to load 32 records.
but if the block size is 32k, we can read them all once, which will reduce the syscall(fread).

@Jack-Kingdom
Copy link

there's no index, fix-sized block is easier to extend a binary search for taget data.

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

3 participants