forked from yugabyte/yugabyte-db
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yugabyte#20028] YSQL: Set webserver OOM score to yb_webserver_oom_sc…
…ore_adj (default 900) Summary: Prior to this diff, the webserver's oom_score_adj is 0, while PG backends are 900. If the webserver started consuming too much memory, all PG backends were killed before we kill the webserver. Now, set to the value passed in by the flag `yb_webserver_oom_score_adj` (similar to `yb_backend_oom_score_adj`). Both default to 900. We use the same score because typically the webserver just uses 30-40mb. If the webserver oom_score_adj was higher than the backends, it would be the first process to be killed whenever we are in a tight spot. The postmaster would immediately recreate it, and the webserver would go back to consuming 30-40mb of memory. So in a "normal" OOM case where a backend is consuming too much memory, we would unnecessarily and uselessly kill the webserver multiple times. In the case where the webserver is using a large mount of memory, the oom killer will target it first anyways. At the very least, it will be among the first processes to be killed. Setting webserver's oom_score_adj = backend's oom_score_adj means we don't unnecessarily kill the webserver, and we'll quickly kill the webserver if it becomes a problem anyways. Jira: DB-8994 Test Plan: ``` pid=$(pgrep -f "YSQL webserver"); cat /proc/$pid/oom_score_adj # shows 900 pkill -f -9 "YSQL webserver" # kill the webserver to test the oom score when it's restarted pid=$(pgrep -f "YSQL webserver"); cat /proc/$pid/oom_score_adj # shows 900 ``` And, automated tests: ``` ./yb_build.sh --cxx-test pgwrapper_pg_libpq-test --gtest_filter PgLibPqTest.TestOomScoreAdjPGBackend ./yb_build.sh --cxx-test pgwrapper_pg_libpq-test --gtest_filter PgLibPqTest.TestOomScoreAdjPGWebserver # new test! ``` Reviewers: smishra, kfranz, amartsinchyk Reviewed By: smishra Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D30510
- Loading branch information
Showing
5 changed files
with
77 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters