-
Notifications
You must be signed in to change notification settings - Fork 61
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
Optimize memory usage #168
Comments
Hey! Could you please point me to overlays which won't be needed after making use of that? |
This is how the database guarantees consistency at the moment, simplified.
We can't modify the pages in the memory-mapped regions initially because we don't know when the kernel decides to flush them to the disk. We need to make sure that the modified pages can't be partially persisted before the WAL is flushed. This guarantees that upon recovery any partial-written page sets will be fixed by replaying the WAL.
Page locking may be achievable with |
Thanks for the digest. Makes sense.
I think that means that there is a guarantee for that pages won't be flushed to disk untill But I don't know if |
@arkpar What do you think of that? |
Indeed, this should be the case. man page also has this section:
So locked pages should not be copied to disk.
There are a few issues that still need clarification
|
Under certain write workloads, when there's a lot of commits with a lot of small value insertions, the memory used by the index overlay can be blown by a factor of 10 or more when compared to the actual data inserted. There's a good example in #93. This is because the overlay keeps the whole index page in memory, even though only a single entry in the page may be modified.
I can think of two ways to fix that:
Don't keep the whole page, but rather only modified entries.
Investigate existing mechanisms in linux to control page flushing for memory mapped files. If it is possible to control when exactly individual pages are flushed to disk, we don't need the overlay in the first place.
In any case, this is only worth fixing if the solution does not introduce any performance hits.
The text was updated successfully, but these errors were encountered: