pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedsystem is swapping (not actively), why?
6+ messages / 3 participants
[nested] [flat]
* system is swapping (not actively), why?
@ 2012-01-03 09:44 MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 1 reply; 6+ messages in thread
From: MirrorX @ 2012-01-03 09:44 UTC (permalink / raw)
To: pgsql-admin
good morning to all and happy new year!
i am facing the following situation; there is a server which is using 2-5GB
of swap very often (almost all the time) and i cannot figure out why. i can
provide any information you find useful and i will start what i think is
more relevant to my 'problem'.
-os -> CentOS release 5.6 (Final)
-the server is a dedicated db server with nothing else running there
-postgres version -> 9.0.5
-shared_buffers -> 15 GB
-vm.swapiness = 0
free -m
total used free shared buffers cached
Mem: 64445 61505 2940 0 159 59989
-/+ buffers/cache: 1356 63089
Swap: 32767 1868 30899
vmstat -n -S M 10 5
procs -----------memory---------- ---swap-- -----io---- --system--
-----cpu------
r b swpd free buff cache si so bi bo in cs us sy id
wa st
4 0 1867 1533 161 61345 0 0 682 164 0 0 9 1 86
4 0
1 0 1867 1286 161 61643 0 0 17932 3224 9776 9957 5 1 94
0 0
3 0 1867 1119 161 61802 0 0 12877 13080 3297 2580 5 1 95
0 0
2 0 1867 929 162 62006 0 0 12386 9406 5871 5749 5 1 94
0 0
3 0 1867 652 162 62190 0 0 13134 4912 6531 6157 8 1 91
0 0
as you can see from above the si/so are always 0 (i have run it for many
iterations and they are always 0) so the system is not actively swapping,
but still, why does it use the swap?
i have found online in some relevant threads/articles that there are some
operating systems that prefer to swap out the memory from the shared_buffers
that is not used. as i can see when inspecting the pg_buffercache, there are
3-5 GB with usagecount=0. could this be the case?
thx in advance for any advice
--
View this message in context: http://postgresql.1045698.n5.nabble.com/system-is-swapping-not-actively-why-tp5116515p5116515.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: system is swapping (not actively), why?
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
@ 2012-01-03 16:23 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-03 17:11 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Grittner @ 2012-01-03 16:23 UTC (permalink / raw)
To: MirrorX <mirrorx@gmail.com>; pgsql-admin
MirrorX <mirrorx@gmail.com> wrote:
> i am facing the following situation; there is a server which is
> using 2-5GB of swap very often (almost all the time) and i cannot
> figure out why.
In the Ubuntu man docs, it says that the swpd column of vmstat is
not affected by the -S switch. Is that the case in CentOS, too?
The man docs for free don't say anything about it, but since you're
showing matching values with vmstat, perhaps it holds there, too.
That would mean 2 MB, not 2 GB, in swap.
We routinely have a few MB of library code swapped out which is
rarely used. I wouldn't worry as long as the si and so columns of
vmstat report zero under load.
-Kevin
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: system is swapping (not actively), why?
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2012-01-03 17:11 ` MirrorX <mirrorx@gmail.com>
2012-01-03 17:38 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 1 reply; 6+ messages in thread
From: MirrorX @ 2012-01-03 17:11 UTC (permalink / raw)
To: pgsql-admin
thx a lot for your reply.
i think it is measured in GB
*free*
total used free shared buffers cached
Mem: 65992668 64425924 1566744 0 196932 62767468
-/+ buffers/cache: 1461524 64531144
Swap: 33554424 2105664 31448760
*top *
top - 17:10:32 up 84 days, 8:23, 2 users, load average: 2.09, 2.12, 2.09
Tasks: 568 total, 5 running, 563 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.0%us, 1.6%sy, 0.0%ni, 90.9%id, 0.1%wa, 0.0%hi, 0.5%si,
0.0%st
Mem: 65992668k total, 65484676k used, 507992k free, 200644k buffers
Swap: 33554424k total, 2105608k used, 31448816k free, 63781976k cached
--
View this message in context: http://postgresql.1045698.n5.nabble.com/system-is-swapping-not-actively-why-tp5116515p5117416.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: system is swapping (not actively), why?
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-03 17:11 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
@ 2012-01-03 17:38 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-05 14:27 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: Kevin Grittner @ 2012-01-03 17:38 UTC (permalink / raw)
To: MirrorX <mirrorx@gmail.com>; pgsql-admin
MirrorX <mirrorx@gmail.com> wrote:
> i think it is measured in GB
> Swap: 33554424 2105664 31448760
> Swap: 33554424k total
That sure seems to be the case.
I don't think it change my overall advice -- if you see zero swaps
in or out under load, I wouldn't worry about it. We tried
configuring our servers to prevent such things, and under careful
benchmarking the effort slightly reduced performance. Probably
because we were using RAM to hold stuff we didn't need instead of
allowing it to be used for OS caching.
I know some people are fanatic about keeping that swap number at
zero, but in our case it turns out to be best to let the OS do its
thing.
-Kevin
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: system is swapping (not actively), why?
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-03 17:11 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 17:38 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
@ 2012-01-05 14:27 ` MirrorX <mirrorx@gmail.com>
2012-01-05 15:06 ` Re: system is swapping (not actively), why? Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 1 reply; 6+ messages in thread
From: MirrorX @ 2012-01-05 14:27 UTC (permalink / raw)
To: pgsql-admin
thx a lot for your advice. it's true that even under load, i havent seen any
so or si...so probably it's best to let the OS handle the situation.
in the meantime if anyone has any idea why the OS would do such a thing, pls
share it with us.
thx
--
View this message in context: http://postgresql.1045698.n5.nabble.com/system-is-swapping-not-actively-why-tp5116515p5122796.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: system is swapping (not actively), why?
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-03 17:11 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 17:38 ` Re: system is swapping (not actively), why? Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-05 14:27 ` Re: system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
@ 2012-01-05 15:06 ` Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 0 replies; 6+ messages in thread
From: Scott Marlowe @ 2012-01-05 15:06 UTC (permalink / raw)
To: MirrorX <mirrorx@gmail.com>; +Cc: pgsql-admin
On Thu, Jan 5, 2012 at 7:27 AM, MirrorX <mirrorx@gmail.com> wrote:
> thx a lot for your advice. it's true that even under load, i havent seen any
> so or si...so probably it's best to let the OS handle the situation.
>
> in the meantime if anyone has any idea why the OS would do such a thing, pls
> share it with us.
> thx
The OS swaps out unused data to make room for more file system caching.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2012-01-05 15:06 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-01-03 09:44 system is swapping (not actively), why? MirrorX <mirrorx@gmail.com>
2012-01-03 16:23 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-03 17:11 ` MirrorX <mirrorx@gmail.com>
2012-01-03 17:38 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2012-01-05 14:27 ` MirrorX <mirrorx@gmail.com>
2012-01-05 15:06 ` Scott Marlowe <scott.marlowe@gmail.com>
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