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

Add low memory protection #104

Merged
merged 1 commit into from
May 6, 2024
Merged

Add low memory protection #104

merged 1 commit into from
May 6, 2024

Conversation

kakra
Copy link

@kakra kakra commented May 6, 2024

If the system is under memory stress, memory allocation latency spikes which disrupts proper operation of portmaster, resulting in DNS timeouts. While the memory pressure persists, portmaster never recovers.

Fix it by adding a low memory protection to the systemd service. From experiments, 2 GB is enough to stop the system from swapping important memory of portmaster and reduce cache thrashing. A lower value like 1 GB might work, too. The resident size of portmaster peaks at around 530 MB for me but this value as low protection is not enough, we need to protect some IO cache memory, too.

After applying to the running service, DNS operation almost instantly recovers.

If the system is under memory stress, memory allocation latency spikes
which disrupts proper operation of portmaster, resulting in DNS
timeouts. While the memory pressure persists, portmaster never
recovers.

Fix it by adding a low memory protection to the systemd service. From
experiments, 2 GB is enough to stop the system from swapping important
memory of portmaster and reduce cache thrashing. A lower value like
1 GB might work, too. The resident size of portmaster peaks at around
530 MB for me but this value as low protection is not enough, we need
to protect some IO cache memory, too.

After applying to the running service, DNS operation almost instantly
recovers.
@dhaavi
Copy link
Member

dhaavi commented May 6, 2024

Hey @kakra, thanks for the improvement!

FYI: I will merge the PR now, but we currently have no new release for the installers scheduled, as we are currently transitioning to a new build system, which builds everything at once over in the main portmaster repo.

@dhaavi dhaavi merged commit 73c3669 into safing:master May 6, 2024
18 checks passed
@kakra kakra deleted the patch-1 branch May 6, 2024 15:41
@kakra
Copy link
Author

kakra commented May 6, 2024

Thanks @dhaavi. This file is referenced by the docs, so I thought it would be still worth it. Maybe the wiki should be improved where it doesn't directly link to this file.

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

Successfully merging this pull request may close these issues.

2 participants