pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Memory and Swap
7+ messages / 5 participants
[nested] [flat]

* Memory and Swap
@ 2016-05-10 20:23  Campbell, Lance <lance@illinois.edu>
  0 siblings, 3 replies; 7+ messages in thread

From: Campbell, Lance @ 2016-05-10 20:23 UTC (permalink / raw)
  To: pgsql-admin

PostgreSQL 9.5.2
Linux Red Hat

I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.

Yet my swap is at 1 G.


1)      Why is that?

2)      Over that past week it has climbed from almost nothing to 1 G.  It is a steady climb.  No big jump.

Thanks,

Lance

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-10 21:21  Scott Whitney <scott@journyx.com>
  parent: Campbell, Lance <lance@illinois.edu>
  2 siblings, 0 replies; 7+ messages in thread

From: Scott Whitney @ 2016-05-10 21:21 UTC (permalink / raw)
  To: Campbell, Lance <lance@illinois.edu>; pgsql-admin

Swap happens under heavy load. At some point you hit a barrier that caused things to swap. Using swap in and of itself is not bad, and it is to be expected. Actual SWAPPING (happening all the time) means you're out of RAM, AND that's bad.

If you would like to talk to me directly about this, let me know. While I am not as good on the internals as The Big Brains on this list, I am certainly in the top on the IT end of it.

(Hi, Greg...you know what you did...)



Sent via the Samsung GALAXY S®4, an AT&T 4G LTE smartphone


-------- Original message --------
From: "Campbell, Lance" <lance@illinois.edu>
Date: 05/10/2016 3:25 PM (GMT-06:00)
To: "'pgsql-admin@postgresql.org'" <pgsql-admin@postgresql.org>
Subject: [ADMIN] Memory and Swap

PostgreSQL 9.5.2
Linux Red Hat

I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.

Yet my swap is at 1 G.


1)      Why is that?

2)      Over that past week it has climbed from almost nothing to 1 G.  It is a steady climb.  No big jump.

Thanks,

Lance


Journyx, Inc.
7600 Burnet Road #300
Austin, TX 78757
www.journyx.com

p 512.834.8888
f 512-834-8858

Do you receive our promotional emails? You can subscribe or unsubscribe to those emails at http://go.journyx.com/emailPreference/e/4932/714/

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-11 05:37  Marco Nietz <pg@mnietz.de>
  parent: Campbell, Lance <lance@illinois.edu>
  2 siblings, 1 reply; 7+ messages in thread

From: Marco Nietz @ 2016-05-11 05:37 UTC (permalink / raw)
  To: pgsql-admin

Linux tends to swap out to early with the default settings of 
swappiness, try to decrease it to 10 or 1

https://en.wikipedia.org/wiki/Swappiness

Marco


Am 10.05.2016 um 22:23 schrieb Campbell, Lance:
> PostgreSQL 9.5.2
>
> Linux Red Hat
>
> I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.
>
> Yet my swap is at 1 G.
>
> 1)Why is that?
>
> 2)Over that past week it has climbed from almost nothing to 1 G.  It is
> a steady climb.  No big jump.
>
> Thanks,
>
> Lance
>


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-11 18:51  Campbell, Lance <lance@illinois.edu>
  parent: Marco Nietz <pg@mnietz.de>
  0 siblings, 0 replies; 7+ messages in thread

From: Campbell, Lance @ 2016-05-11 18:51 UTC (permalink / raw)
  To: 'Marco Nietz' <pg@mnietz.de>; pgsql-admin

Marco and Scott,
Thanks for your answers.  The  Swappiness web link was great.

Lance

-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Marco Nietz
Sent: Wednesday, May 11, 2016 12:37 AM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Memory and Swap

Linux tends to swap out to early with the default settings of swappiness, try to decrease it to 10 or 1

https://en.wikipedia.org/wiki/Swappiness

Marco


Am 10.05.2016 um 22:23 schrieb Campbell, Lance:
> PostgreSQL 9.5.2
>
> Linux Red Hat
>
> I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.
>
> Yet my swap is at 1 G.
>
> 1)Why is that?
>
> 2)Over that past week it has climbed from almost nothing to 1 G.  It 
> is a steady climb.  No big jump.
>
> Thanks,
>
> Lance
>


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-11 20:14  Fernando Hevia <fhevia@gmail.com>
  parent: Campbell, Lance <lance@illinois.edu>
  2 siblings, 1 reply; 7+ messages in thread

From: Fernando Hevia @ 2016-05-11 20:14 UTC (permalink / raw)
  To: Campbell, Lance <lance@illinois.edu>; +Cc: pgsql-admin

I wouldn't worry about the system using swap while there is plenty of free
RAM available. As others have stated, it is a rather common situation. The
kernel might decide on moving some seldom accessed memory pages to swap in
order to make RAM available for future demand. But when RAM starts running
low, do keep and eye on how many bytes are actually being swapped. You can
use vmstat to show the amount of bytes being swapped in/out of the system.

I.e: vmstat output of a system with no swapping taking place and marginal
swap usage:

~# vmstat 5
procs -----------memory---------- ---swap-- -----io---- -system--
----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id
wa
 2  0  28052 363992 156736 1251116    0    0     6    15    1    7  2  1 97
 0
 0  0  28052 363964 156736 1251128    0    0     0    13  759  283  2  2 96
 0
 0  0  28052 371132 156736 1251132    0    0     0     5  348  287  1  1 98
 0

Any value > 0 means the system is actually reading from or writing to swap,
at the same time you should notice a severe downgrade of the system's
performance.


On Tue, May 10, 2016 at 5:23 PM, Campbell, Lance <lance@illinois.edu> wrote:

> PostgreSQL 9.5.2
>
> Linux Red Hat
>
>
>
> I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.
>
>
>
> Yet my swap is at 1 G.
>
>
>
> 1)      Why is that?
>
> 2)      Over that past week it has climbed from almost nothing to 1 G.
> It is a steady climb.  No big jump.
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-18 14:37  Campbell, Lance <lance@illinois.edu>
  parent: Fernando Hevia <fhevia@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Campbell, Lance @ 2016-05-18 14:37 UTC (permalink / raw)
  To: 'Fernando Hevia' <fhevia@gmail.com>; +Cc: pgsql-admin

Thanks for the reply.
What are the values that can appear in the column SI and SO?  Are those disk blocks?  Also how high would those numbers possibly get in those two columns before I should be concerned.  I am noticing two digit number like 84.  Every once in a while it will spike to something like 814.

Lance

From: Fernando Hevia [mailto:fhevia@gmail.com]
Sent: Wednesday, May 11, 2016 3:14 PM
To: Campbell, Lance <lance@illinois.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Memory and Swap

I wouldn't worry about the system using swap while there is plenty of free RAM available. As others have stated, it is a rather common situation. The kernel might decide on moving some seldom accessed memory pages to swap in order to make RAM available for future demand. But when RAM starts running low, do keep and eye on how many bytes are actually being swapped. You can use vmstat to show the amount of bytes being swapped in/out of the system.

I.e: vmstat output of a system with no swapping taking place and marginal swap usage:

~# vmstat 5
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 2  0  28052 363992 156736 1251116    0    0     6    15    1    7  2  1 97  0
 0  0  28052 363964 156736 1251128    0    0     0    13  759  283  2  2 96  0
 0  0  28052 371132 156736 1251132    0    0     0     5  348  287  1  1 98  0

Any value > 0 means the system is actually reading from or writing to swap, at the same time you should notice a severe downgrade of the system's performance.


On Tue, May 10, 2016 at 5:23 PM, Campbell, Lance <lance@illinois.edu<mailto:lance@illinois.edu>> wrote:
PostgreSQL 9.5.2
Linux Red Hat

I have 10 G of memory.  Nagios is saying I have 2 G used and 8 G free.

Yet my swap is at 1 G.


1)      Why is that?

2)      Over that past week it has climbed from almost nothing to 1 G.  It is a steady climb.  No big jump.



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: Memory and Swap
@ 2016-05-18 15:09  Albe Laurenz <laurenz.albe@wien.gv.at>
  parent: Campbell, Lance <lance@illinois.edu>
  0 siblings, 0 replies; 7+ messages in thread

From: Albe Laurenz @ 2016-05-18 15:09 UTC (permalink / raw)
  To: 'Campbell, Lance *EXTERN*' <lance@illinois.edu>; Fernando Hevia <fhevia@gmail.com>; +Cc: pgsql-admin

Lance Campbell wrote:
> What are the values that can appear in the column SI and SO?  Are those disk blocks?  Also how high
> would those numbers possibly get in those two columns before I should be concerned.  I am noticing two
> digit number like 84.  Every once in a while it will spike to something like 814.

The unit should be KB/s, check your vmstat man page.

Occasional "so" shouldn't be a problem, but if "si" is greater than 0 regularly,
you are probably memory constrained.

Yours,
Laurenz Albe

-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin


^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2016-05-18 15:09 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 20:23 Memory and Swap Campbell, Lance <lance@illinois.edu>
2016-05-10 21:21 ` Scott Whitney <scott@journyx.com>
2016-05-11 05:37 ` Marco Nietz <pg@mnietz.de>
2016-05-11 18:51   ` Campbell, Lance <lance@illinois.edu>
2016-05-11 20:14 ` Fernando Hevia <fhevia@gmail.com>
2016-05-18 14:37   ` Campbell, Lance <lance@illinois.edu>
2016-05-18 15:09     ` Albe Laurenz <laurenz.albe@wien.gv.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox