dbTalk Databases Forums  

Reconciling DB2 and OS memory usage stats

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Reconciling DB2 and OS memory usage stats in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Desmodromic
 
Posts: n/a

Default Reconciling DB2 and OS memory usage stats - 03-04-2011 , 01:59 AM






We are running DB2 9.5 FP5 on Red Hat Enterprise Linux Server release
5.4. The server has 32GB of physical RAM.

Running db2mtrk -d -v shows a total of 16819027968 bytes used for the
database.

However, our SysAdmin claims that DB2 can only be using approx. 2.8 GB
of memory because the output from the free command below shows there
is only 2931148 KB of memory used.

$ free -k
total used free shared buffers
cached
Mem: 32956200 32796116 160084 0 435508
29429460
-/+ buffers/cache: 2931148 30025052
Swap: 8385920 1600 8384320

Can anyone explain the difference between DB2 and the OS reported
memory usage figures?

When a DB2 database is activated are all the bufferpools fully
allocated?

Thanks.

Reply With Quote
  #2  
Old   
Helmut Tessarek
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-04-2011 , 03:22 AM






Hi,

Quote:
Running db2mtrk -d -v shows a total of 16819027968 bytes used for the
database.
Then 16GB are be used by DB2.

Quote:
However, our SysAdmin claims that DB2 can only be using approx. 2.8 GB
of memory because the output from the free command below shows there
is only 2931148 KB of memory used.
Wrong, the value you are talking about are buffers/cache, not physical memory.

Quote:
$ free -k
total used free shared buffers
cached
Mem: 32956200 32796116 160084 0 435508
29429460
-/+ buffers/cache: 2931148 30025052
Swap: 8385920 1600 8384320
Almost all physical memory is used. You are using 32796116k out of 32956200k.
This does not really mean anything, since Linux tends to report memory as
used, even if the memory is inactive or used as filesystem cache. In case of
shortage this memory should be freed in favour of runing processes.

What is more reason for being concerned is the fact that 1600k of swap is
used. Can you explain to me why swap space is used despite of only 16GB used
by DB2? What else is running on this box?

Quote:
Can anyone explain the difference between DB2 and the OS reported
memory usage figures?
I think I just did. :-)

Quote:
When a DB2 database is activated are all the bufferpools fully
allocated?
Yes, as soon as you activate the database (or at the first connect, if not
activated), all bufferpools are fully allocated. There are aso other memory
areas which are allocated, but not in full, which means those areas are
allocated in several steps. There is a start value, which is allocated at
first and the memory can grow up to the max value specified.
With regards to the bufferpools, they are allocated at once.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

Reply With Quote
  #3  
Old   
Helmut Tessarek
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-04-2011 , 03:30 AM



Hi,

Quote:
Running db2mtrk -d -v shows a total of 16819027968 bytes used for the
database.
Then 16GB are used by DB2.

Quote:
However, our SysAdmin claims that DB2 can only be using approx. 2.8 GB
of memory because the output from the free command below shows there
is only 2931148 KB of memory used.
Wrong, the value you are talking about are buffers/cache, not physical memory.

Quote:
$ free -k
total used free shared buffers
cached
Mem: 32956200 32796116 160084 0 435508
29429460
-/+ buffers/cache: 2931148 30025052
Swap: 8385920 1600 8384320
Almost all physical memory is used. You are using 32796116k out of 32956200k.
This does not really mean anything, since Linux tends to report memory as
used, even if the memory is inactive or used as filesystem cache. In case of
shortage this memory should be freed in favour of runing processes.

What is more reason for being concerned is the fact that 1600k of swap is
used. Can you explain to me why swap space is used despite of only 16GB used
by DB2? What else is running on this box?

Quote:
Can anyone explain the difference between DB2 and the OS reported
memory usage figures?
I think I just did. :-)

Quote:
When a DB2 database is activated are all the bufferpools fully
allocated?
Yes, as soon as you activate the database (or at the first connect, if not
activated), all bufferpools are fully allocated. There are aso other memory
areas which are allocated, but not in full, which means those areas are
allocated in several steps. There is a start value, which is allocated at
first and the memory can grow up to the max value specified.
With regards to the bufferpools, they are allocated at once.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

Reply With Quote
  #4  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-04-2011 , 04:00 AM



On 4 mrt, 10:30, Helmut Tessarek <tessa... (AT) evermeet (DOT) cx> wrote:
Quote:
Hi,

Running db2mtrk -d -v shows a total of 16819027968 bytes used for the
database.

Then 16GB are used by DB2.

However, our SysAdmin claims that DB2 can only be using approx. 2.8 GB
of memory because the output from the free command below shows there
is only 2931148 KB of memory used.

Wrong, the value you are talking about are buffers/cache, not physical memory.

$ free -k
* * * * * * *total * * * used * * * free * * shared * *buffers
cached
Mem: * * *32956200 * 32796116 * * 160084 * * * * *0 * * 435508
29429460
-/+ buffers/cache: * *2931148 * 30025052
Swap: * * *8385920 * * * 1600 * *8384320

Almost all physical memory is used. You are using 32796116k out of 32956200k.
This does not really mean anything, since Linux tends to report memory as
used, even if the memory is inactive or used as filesystem cache. In caseof
shortage this memory should be freed in favour of runing processes.

What is more reason for being concerned is the fact that 1600k of swap is
used. Can you explain to me why swap space is used despite of only 16GB used
by DB2? What else is running on this box?

Can anyone explain the difference between DB2 and the OS reported
memory usage figures?

I think I just did. :-)

When a DB2 database is activated are all the bufferpools fully
allocated?

Yes, as soon as you activate the database (or at the first connect, if not
activated), all bufferpools are fully allocated. There are aso other memory
areas which are allocated, but not in full, which means those areas are
allocated in several steps. There is a start value, which is allocated at
first and the memory can grow up to the max value specified.
With regards to the bufferpools, they are allocated at once.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab
It's not the first time that this confusion between OS and DB2 buffers
comes up, surprisingly...

Anyway, I just wanted to add that since you're on 9.5, db2pd -dbptnmem
gives you a nice overview of your total memory usage. I'm a happy
user :-)

--
Frederik Engelen
RealDolmen

Reply With Quote
  #5  
Old   
Mark A
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-04-2011 , 12:04 PM



"Helmut Tessarek" <tessarek (AT) evermeet (DOT) cx> wrote

Quote:
What is more reason for being concerned is the fact that 1600k of swap is
used. Can you explain to me why swap space is used despite of only 16GB
used
by DB2? What else is running on this box?
-
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab
This is (unfortunately) typical on our many DB2 Linux systems (swap space is
being used even when DB2 and other usage is way below total memory). I would
really appreciate if IBM would figure this out and let us know ALL the Linux
and DB2 config settings for a DB2 server so this does not happen (if you can
do it).

If you need more info, let me know.

Reply With Quote
  #6  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-05-2011 , 02:07 AM



On 4 mrt, 19:04, "Mark A" <no... (AT) nowhere (DOT) com> wrote:
Quote:
"Helmut Tessarek" <tessa... (AT) evermeet (DOT) cx> wrote in message

news:ikqbfu$9sj$1 (AT) news (DOT) albasani.net...

What is more reason for being concerned is the fact that 1600k of swap is
used. Can you explain to me why swap space is used despite of only 16GB
used
by DB2? What else is running on this box?
-
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

This is (unfortunately) typical on our many DB2 Linux systems (swap space is
being used even when DB2 and other usage is way below total memory). I would
really appreciate if IBM would figure this out and let us know ALL the Linux
and DB2 config settings for a DB2 server so this does not happen (if you can
do it).

If you need more info, let me know.
Ever tried to play around with the "swappiness" kernel parameter?

I don't know the numbers you're having, but in this case I wouldn't
bother, unless there's constant swapping occurring. If this 1600K was
never really used, why not put it on disk and use the memory (the
whole 1.6M!) for something more useful. No-one ever complains about
DB2 removing inactive pages from memory...

--
Frederik Engelen

Reply With Quote
  #7  
Old   
Helmut Tessarek
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-05-2011 , 03:28 AM



Hi Mark,

Quote:
This is (unfortunately) typical on our many DB2 Linux systems (swap space is
being used even when DB2 and other usage is way below total memory). I would
really appreciate if IBM would figure this out and let us know ALL the Linux
and DB2 config settings for a DB2 server so this does not happen (if you can
do it).
Do you have proof that DB2 is using the swap space? I really doubt that DB2 is
using more memory than set as upper limit.
If you do have proof that this is the case, it is most likely a defect and I
suggest to open a PMR.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab

Reply With Quote
  #8  
Old   
Mark A
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-05-2011 , 06:59 AM



"Helmut Tessarek" <tessarek (AT) evermeet (DOT) cx> wrote

Quote:
Do you have proof that DB2 is using the swap space? I really doubt that
DB2 is
using more memory than set as upper limit.
If you do have proof that this is the case, it is most likely a defect and
I
suggest to open a PMR.

--
Helmut K. C. Tessarek
DB2 Performance and Development
IBM Toronto Lab
No, I have no proof that DB2 is using it, and the total DB2 memory
allocation is way below the total memory on the machine. However, there is
really nothing else running on the machine (except normal Linux stuff) and I
would interested in whether IBM notices the same thing in their labs on
their own Linux boxes.

Overall, I think IBM should provide more guidance on how to set up Linux
properly for a DB2 server. I have seen improvements in this regard in each
new fixpack (more kernel parms getting set automatically, etc), but I don't
feel they have gone far enough in documented a proper Linux configuration.

Reply With Quote
  #9  
Old   
Mark A
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-05-2011 , 07:06 AM



"Frederik Engelen" <engelenfrederik (AT) gmail (DOT) com> wrote

Quote:
Ever tried to play around with the "swappiness" kernel parameter?

I don't know the numbers you're having, but in this case I wouldn't
bother, unless there's constant swapping occurring. If this 1600K was
never really used, why not put it on disk and use the memory (the
whole 1.6M!) for something more useful. No-one ever complains about
DB2 removing inactive pages from memory...
--
Frederik Engelen
Already made these changes long ago (not documented in DB2 manuals, but
found it in some DB2 Redbooks):

swappiness: 0
dirty_ratio: 10
dirty_background_ratio: 5

I don't understand your comment about putting it on disk.

Reply With Quote
  #10  
Old   
Frederik Engelen
 
Posts: n/a

Default Re: Reconciling DB2 and OS memory usage stats - 03-05-2011 , 01:17 PM



On 5 mrt, 14:06, "Mark A" <no... (AT) nowhere (DOT) com> wrote:
Quote:
"Frederik Engelen" <engelenfrede... (AT) gmail (DOT) com> wrote in message

news:f8bd330b-0193-45a8-8c84-bb53242e9b38 (AT) v31g2000vbs (DOT) googlegroups.com...

Ever tried to play around with the "swappiness" kernel parameter?

I don't know the numbers you're having, but in this case I wouldn't
bother, unless there's constant swapping occurring. If this 1600K was
never really used, why not put it on disk and use the memory (the
whole 1.6M!) for something more useful. No-one ever complains about
DB2 removing inactive pages from memory...
--
Frederik Engelen

Already made these changes long ago (not documented in DB2 manuals, but
found it in some DB2 Redbooks):

swappiness: 0
dirty_ratio: 10
dirty_background_ratio: 5

I don't understand your comment about putting it on disk.
Wh

Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.