LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-25-2023, 02:39 PM   #1
robson007
LQ Newbie
 
Registered: Mar 2023
Posts: 4

Rep: Reputation: 0
What metrics is oom-killer using to determine memory usage in Cgroup


I am trying to find a metrics that represents memory usage logged in syslog when container reaches the threshold and gets killed.

This is the message I refer to:
Nov 6 10:16:24 pool-a53hsbota-7h3co kernel: [2111341.288726] memory: usage 524288kB, limit 524288kB, failcnt 118
Nov 6 10:16:24 pool-a53hsbota-7h3co kernel: [2111341.289672] memory+swap: usage 524288kB, limit 9007199254740988kB, failcnt 0
Nov 6 10:16:24 pool-a53hsbota-7h3co kernel: [2111341.298582] kmem: usage 5800kB, limit 9007199254740988kB, failcnt 0

I tried to collect different matrices using Prometheus and compare their values to the value in the log, but I couldn't find a metrics or combination of matrices which represents the same value as the one logged at that point of time.

I tried:
- /sys/fs/cgroup/memory/kubepods/burstable/<pod>/<container>/memory.stat
- ps command


All what I am trying to do is to show in Grafana using proper metrics that memory usage for the container grew and when it reached the limit, the container was killed.

Your help here is highly appreciated.
 
Old 04-03-2023, 07:23 PM   #2
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Does it use cgroup info?

Have a look at this nice oom killer article:
https://www.baeldung.com/linux/memor...ent-oom-killer
 
Old 04-03-2023, 08:27 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
If using croup2, add this to your reading list. Yes I know it says facebook, but those folks did all the work for PSI then released it for public consumption.
Go get a beverage of choice before starting.
 
Old 04-22-2023, 12:31 PM   #4
robson007
LQ Newbie
 
Registered: Mar 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zeebra View Post
Does it use cgroup info?

Have a look at this nice oom killer article:
https://www.baeldung.com/linux/memor...ent-oom-killer
Thank you for sharing the article. My problem is not understanding of OOM, but showing that the application misbehave. I know for the fact that application is being killed by OOM when it reaches its limit of 512MB. I am looking for metrics which clearly shows that consumed memory reached that limit value at that moment. Right now when I check cgroup momory used at the time of OOM invocation, it shows only 100MB, which is very far from the actual limit.
Basically I would like to shows on some chart, that used memory was rising and just before the invocation of OOM the consumed memory was close to the limit. I cannot find a single metrics which would show it.
 
Old 04-22-2023, 12:35 PM   #5
robson007
LQ Newbie
 
Registered: Mar 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by syg00 View Post
If using croup2, add this to your reading list. Yes I know it says facebook, but those folks did all the work for PSI then released it for public consumption.
Go get a beverage of choice before starting.
I briefly scanned through the page and haven't found what I am looking for, but I will read it in more details to see if it gives me the information I am looking for.
Thank you for sharing
 
Old 04-23-2023, 06:29 AM   #6
zeebra
Senior Member
 
Registered: Dec 2011
Distribution: Slackware
Posts: 1,830
Blog Entries: 17

Rep: Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638Reputation: 638
Quote:
Originally Posted by robson007 View Post
Thank you for sharing the article. My problem is not understanding of OOM, but showing that the application misbehave. I know for the fact that application is being killed by OOM when it reaches its limit of 512MB. I am looking for metrics which clearly shows that consumed memory reached that limit value at that moment. Right now when I check cgroup momory used at the time of OOM invocation, it shows only 100MB, which is very far from the actual limit.
Basically I would like to shows on some chart, that used memory was rising and just before the invocation of OOM the consumed memory was close to the limit. I cannot find a single metrics which would show it.
Well, that article does mention the exact data sources used for OOM killer, which is why I put it there in the first place.

After answering last time, I remember reading up on some specific cgroup "issues" with OOM killer, but most of it was how to solve it by splitting cgroup memory so it doesn't kill a full "container" when it reaches the limit, but rather killing the high memory consumer inside the container before OOM killer kills the container.
 
Old 04-26-2023, 11:58 AM   #7
robson007
LQ Newbie
 
Registered: Mar 2023
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by zeebra View Post
Well, that article does mention the exact data sources used for OOM killer, which is why I put it there in the first place.

After answering last time, I remember reading up on some specific cgroup "issues" with OOM killer, but most of it was how to solve it by splitting cgroup memory so it doesn't kill a full "container" when it reaches the limit, but rather killing the high memory consumer inside the container before OOM killer kills the container.
The article you are referencing sounds very interesting and could be very helpful in solving the problem I work on. Any chance that you would find a link to that article?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cgroupv2 - Reducing Parent Cgroup with exactly one child Cgroup to just one Cgroup xandus Linux - Kernel 1 04-06-2023 12:27 AM
Duplicity: invalid argument error backing up /sys/fs/cgroup/systemd/user.slice/user-42.slice/cgroup.event_control dzseti Linux - Software 2 05-17-2022 02:16 AM
Out of memory (OOM killer) - what is causing my memory issue? gombi Linux - Server 21 06-10-2015 03:42 PM
Kernel oom autopsy - trying to understand the oom-killer log entries kamermans Linux - Kernel 2 01-11-2011 12:52 PM
Out of memory (oom) killer causes system crash? BusyBeeBop Linux - Software 6 06-02-2008 01:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration