Open jesperpedersen opened 1 month ago
Can I work on this? Any suggestion on how to start?
We need a disk benchmark to test the current setup vs using O_DIRECT
. Latter should be faster, but we need to know that the extra complexity is worth it
This task is also about having a uniform disk access method - so maybe an io.h
that operates on FILE*
https://commitfest.postgresql.org/46/4532/ could be a good read as well...
Hey, @jesperpedersen I did some research on DIRECT_IO.
int open(const char *pathname, int flags, mode_t mode);
FILE* fp = fdopen(fd, "w");
And do we also need to check that the shared memory is aligned to the disk in pgmoneta also? This is based on the work that is done in postgres for direct io.
This is the memory usage that I have found normally
start
Every 2.0s: free -m fedora: Wed Apr 24 11:47:02 2024
total used free shared buff/cache available
Mem: 5769 773 4241 1 985 4996
Swap: 5768 0 5768
after init db
Every 2.0s: free -m fedora: Wed Apr 24 11:48:45 2024
total used free shared buff/cache available
Mem: 5769 918 3528 40 1593 4850
Swap: 5768 0 5768
Create User command
Every 2.0s: free -m fedora: Wed Apr 24 11:54:04 2024
total used free shared buff/cache available
Mem: 5769 955 3483 68 1628 4813
Swap: 5768 0 5768
Pgmoneta start
Every 2.0s: free -m fedora: Wed Apr 24 11:56:16 2024
total used free shared buff/cache available
Mem: 5769 852 3583 69 1634 4916
Swap: 5768 0 5768
pgmoneta cli
Every 2.0s: free -m fedora: Wed Apr 24 11:56:49 2024
total used free shared buff/cache available
Mem: 5769 925 3481 91 1684 4843
Swap: 5768 0 5768
pgmoneta stopped
Every 2.0s: free -m fedora: Wed Apr 24 11:57:58 2024
total used free shared buff/cache available
Mem: 5769 931 3465 106 1710 4837
Swap: 5768 0 5768
Looks like you are heading in the right direction !
If we unify the API in io.h
and io.c
using O_DIRECT
then I don't think we need a configuration option for it.
Once you have created a work branch feel free to share it
@palak-chaturvedi How is this going ?
What is the status of this issue? I will take it up if no one is working on it.
@shikharish Please, take over
If we know there is an entire block it can be written at once
The important part is that we can look at optimizing later - right now it is about creating a unified interface using O_DIRECT
Investigate the impact of using
O_DIRECT
for disk I/O - especially in restore scenarios