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

Feature Request: Ability to prevent pgbackrest from impacting heavily OS disk block cache #1038

Open
Soulou opened this issue May 15, 2020 · 6 comments

Comments

@Soulou
Copy link

Soulou commented May 15, 2020

Something which has been already raised in some issues like #822

PgBackRest is reading/writing a lot on disk and for large databases, it simply nuke the OS disk cache. However these data are not really useful in the cache.

In the following case: 16GB box, with a PG with ~300GB of data on disk, when running a pgbackrest backup, it happens that the load of the box gets really high because of the kswapd process of the kernel starting to move pages around, especially pages potentially being swapped out.

From my point of view, there is no problem in preventing pgbackrest from using the disk cache, to keep the useful data from PG into the OS cache, and use a little more disk. At least I don't take the risk seeing the server load average getting to hundreds.

There are two ways to do this usually:

For instance the dd command is using fadvise when the "nocache" flag is enabled: https://github.com/coreutils/coreutils/blob/master/src/dd.c#L1121

Seeing such configuration option in PgBackRest would be absolutely great.

Thanks a lot

@dwsteele
Copy link
Member

Agreed, this is a good idea. We've been considering it for a while but wanted to wait for the C migration to be complete before implementing.

Thank you for the link to dd. This seems to be exactly the implementation we would want. I prefer this to using O_DIRECT as I believe it is more portable based on my research.

Does that sound good?

@Soulou
Copy link
Author

Soulou commented May 18, 2020

Thanks @dwsteele for your answer, I'm glad it has been considered something useful you, it sounds absolutely great to me, I can't wait since it's quite a constant annoyance (we're a PostgreSQL hosting platform)

Do you have any idea of the ETA about the C migration? I've followed that almost all commands have been translated, should we hope this task will be engaged in 1 months, 6 months, 1 year, more? Thanks a lot

@sfrost
Copy link
Contributor

sfrost commented May 18, 2020

Greetings,

The migration to C has been complete for a couple of months now (it was finished back in January), so that's over and done with and isn't a blocker any more. As for when we'll have a chance to implement this particular feature request, that depends on the ongoing workload involving bug fixes and maintenance, plus other feature requests that we already have and things we'd like to see done to move pgBackRest forward.

Thanks,

Stephen

@Soulou
Copy link
Author

Soulou commented May 18, 2020

Ok great, thanks @sfrost for your answer, I wasn't sure the C migration was over, nicely done. We'll keep following the project closely!

@Soulou
Copy link
Author

Soulou commented Mar 3, 2021

@sfrost would it be possible to have an update about the feasibility of this change? Thanks a lot!

@maherbeg
Copy link

maherbeg commented May 3, 2023

We've noticed that pgbackrest based backups do indeed increase the file system cache usage and would be really interested in this feature.

Some of our users running pgbackrest backups have been seeing connection errors from their application to their postgres server while the backup is running. We haven't quite figured out why this is happening, but the memory usage and our vm.overcommit settings might be a culprit.

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

No branches or pull requests

4 participants