Re: Invoke OOM killer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 7/6/23 12:27, kaido vaikla wrote:

How to invoke OOM killer for pg process?
Some easy "hack" for test purpose.

Rocky Linux release 9.2 (Blue Onyx)

If you are running postgres under systemd, you can add a cgroup memory limit to the unit file. Something like (depending on cgroup version and systemd version the params might be slightly different -- cannot remember off the top of my head):
Don't forget to
systemctl daemon-reload
systemctl restart postgresql@15
#or whatever version

That will cause an OOM killer strike at 256M of total cgroup usage (all of the postgres processes combined).

From there it is pretty easy to trigger by doing something like, e.g.
-- attempt to create a ~500M string
select repeat('X', 500000000);

Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services:

[Index of Archives]     [Postgresql Home]     [Postgresql General]     [Postgresql Performance]     [Postgresql PHP]     [Postgresql Jobs]     [PHP Users]     [PHP Databases]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Forum]

  Powered by Linux