Thread: memory does not return back

memory does not return back

From
"hessam"
Date:
I'm using freeradius 0.9.3 with postgresql 7.3.2.
All I do is just inserting some h323 accounting data into my tables.
After a couple of hours the memory reaches to about 1G and then Linux
starts using swap file.I lose some of my records and PC becomes very
slow.
Even if I restart postgresql , the memory does not return back.
I've ordered another 1Gb RAM.Is it really necessary?
When I reboot Linux and start Postgresql momory  usage is about 250 Mb.
Even a single select from a large table which lasts more than a minute
causes this.
I'm using Pentium 4 (2.6 GHZ) , 1 GB RAM, 80Gb HDD.
PostgreSQL 7.3.2 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-
linux-gcc (GCC) 3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1).
Just a couple of days ago I ordered Intel PC with two Xeon CPUs and 1
GB RAM(soon would be 2GB) and installed Linux(9) on it same as above.
Selects are faster But again RAM usage reaches about 1GB and it's using
swap , cpu cache.Restarting Postgresql does not help.
What am I to do now?

Re: memory does not return back

From
Richard Huxton
Date:
On Tuesday 17 February 2004 12:03, hessam wrote:
> I'm using freeradius 0.9.3 with postgresql 7.3.2.
> All I do is just inserting some h323 accounting data into my tables.
> After a couple of hours the memory reaches to about 1G and then Linux
> starts using swap file.I lose some of my records and PC becomes very
> slow.
> Even if I restart postgresql , the memory does not return back.

Which would suggest perhaps that postgresql might not be the problem here. Can
you provide output from ps/top showing memory usage for the key processes
involved here?

--
  Richard Huxton
  Archonet Ltd

Re: memory does not return back

From
Richard Huxton
Date:
On Wednesday 18 February 2004 05:54, hessam wrote:
> Dear Richard,
>
> Thank you for your reply.Below are results of ps and top commands on
> my new linux Box:
>
> There are 64 database connection made by freeradius.When I reboot my
> machine with 'chkconfig postgresql off' 'chkconfig radiusd off' .
> nothing happens and everything is normal.Then I just start postgresql
> and do "select * form mytable;" memory goes up . The more select I do
> from different table, the more memory usage becomes.(whithout
> freeradius).And memory does not return back,but when I restart
> postgresql it goes down from 1GB to about 300Mb at the begining but
> after just minutes it reaches the top.Then I reboot linux with
> postgresql at the begining it is about 200 Mb but it takes hours to
> reach 1GB.

I see no evidence of high memory usage in the trace below - indeed the largest
memory usage is by the RedHat network config applet. If you look at the
figures, you have 144028KB used for buffering (144MB) and 960924KB for file
cache (960MB) along with 0 swap used.

>  08:56:26  up 18:51,  3 users,  load average: 0.01, 0.02, 0.00
> 133 processes: 132 sleeping, 1 running, 0 zombie, 0 stopped
> CPU0 states:   1.0% user   2.0% system    0.0% nice   0.0% iowait
> 96.3% idle
> CPU1 states:   1.0% user   1.1% system    0.0% nice   0.0% iowait
> 97.2% idle
> Mem:  2064420k av, 1512876k used,  551544k free,       0k shrd,
> 144028k buff
>                     495576k actv,  377752k in_d,  369380k in_c
> Swap: 2040244k av,       0k used, 2040244k free
> 960924k cached
>
>   PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU
> COMMAND
>  2514 root      15   0  4000 4000  1340 S     1.3  0.1   2:48   0
> radiusd
>  3089 root      15   0  6092 6088  5060 S     1.3  0.2  13:00   1
> magicdev
> 18985 root      16   0  1184 1184   856 R     0.7  0.0   0:00   0 top
>  2365 root      15   0  2972 2972  1436 S     0.3  0.1   0:08   0 cupsd
>  2599 postgres  15   0  5208 5208  3984 S     0.3  0.2   0:04   0
> postmaster
>  2609 postgres  15   0  5196 5196  3992 S     0.3  0.2   0:04   0
> postmaster
>  2718 root      16   0  1200 1200   856 S     0.3  0.0   3:39   1 top
>  3096 root      15   0 13408  13M  8704 S     0.3  0.6  10:27   1 rhn-
> applet-gu
[snip]

You do know that the "1512876k used" includes all this buffer/cache memory and
isn't really "in use"? If not, do some searching on Google for terms like
"linux out of memory buffer cache" - it confuses everybody the first time
they come across it.

Tip: try "free -m"
$ free -m
             total       used       free     shared    buffers     cached
Mem:           975        213        761          0         12        101
-/+ buffers/cache:         99        875
Swap:         1027          0       1027
Here the important values are on the second line - 99MB used, 875MB free.

If you still think there is a problem, can you show the output of "top" when
your system's memory usage increases. Tip: press "M" (not "m") to sort the
output by memory usage.

--
  Richard Huxton
  Archonet Ltd