Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A9AAB1337A5D for ; Mon, 4 Apr 2011 08:34:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 65610-06 for ; Mon, 4 Apr 2011 11:34:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp180.iad.emailsrvr.com (smtp180.iad.emailsrvr.com [207.97.245.180]) by mail.postgresql.org (Postfix) with ESMTP id C09D9133616B for ; Mon, 4 Apr 2011 08:34:27 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp48.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id E371216816E; Mon, 4 Apr 2011 07:34:27 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp48.relay.iad1a.emailsrvr.com (Authenticated sender: adarsh.sharma-AT-orkash.com) with ESMTPSA id DD6C3168176; Mon, 4 Apr 2011 07:34:25 -0400 (EDT) Message-ID: <4D99ACC0.5090009@orkash.com> Date: Mon, 04 Apr 2011 17:04:24 +0530 From: Adarsh Sharma User-Agent: Thunderbird 2.0.0.22 (X11/20090625) MIME-Version: 1.0 To: Raghavendra CC: Scott Marlowe , sethuprasad.in@gmail.com, pgsql-performance@postgresql.org Subject: Re: Postgres Performance Tuning References: <4D999211.9080507@orkash.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050101010002010909000501" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201104/14 X-Sequence-Number: 43076 This is a multi-part message in MIME format. --------------050101010002010909000501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit My database size is :- postgres=# select pg_size_pretty(pg_database_size('pdc_uima_dummy')); pg_size_pretty ---------------- 49 GB (1 row) I have a doubt regarding postgres Memory Usage :- Say my Application makes Connection to Database Server ( *.*.*.106) from (*.*.*.111, *.*.*.113, *.*.*.114) Servers and I check the top command as :-- Say it makes 100 Connections top - 17:01:02 up 5:39, 4 users, load average: 0.00, 0.00, 0.00 Tasks: 170 total, 1 running, 169 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0% us, 0.2% sy, 0.0% ni, 99.6% id, 0.1% wa, 0.0% hi, 0.0% si, 0.0% st Mem: 16299476k total, 16198784k used, 100692k free, 73776k buffers Swap: 16787884k total, 148176k used, 16639708k free, 15585396k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 3401 postgres 20 0 4288m 3.3g 3.3g S 0 21.1 0:24.73 postgres 3397 postgres 20 0 4286m 119m 119m S 0 0.8 0:00.36 postgres 4083 postgres 20 0 4303m 104m 101m S 0 0.7 0:07.68 postgres 3402 postgres 20 0 4288m 33m 32m S 0 0.2 0:03.67 postgres 4082 postgres 20 0 4301m 27m 25m S 0 0.2 0:00.85 postgres 4748 postgres 20 0 4290m 5160 3700 S 0 0.0 0:00.00 postgres 4173 root 20 0 12340 3028 1280 S 0 0.0 0:00.12 bash 4084 postgres 20 0 4290m 2952 1736 S 0 0.0 0:00.00 postgres 4612 root 20 0 12340 2920 1276 S 0 0.0 0:00.06 bash 4681 root 20 0 12340 2920 1276 S 0 0.0 0:00.05 bash 4550 root 20 0 12208 2884 1260 S 0 0.0 0:00.08 bash 4547 root 20 0 63580 2780 2204 S and free command says :-- [root@s8-mysd-2 8.4SS]# free -g total used free shared buffers cached Mem: 15 15 0 0 0 14 -/+ buffers/cache: 0 15 Swap: 16 0 15 [root@s8-mysd-2 8.4SS]# Now when my job finishes and I close the Connections from 2 Servers , the top & free output remains the same :- I don't know What is the reason behind this as I have only 3 Connections from the below command : postgres=# select datname, client_addr,current_query from pg_stat_activity; datname | client_addr | current_query ----------------+---------------+------------------------------------------------------------------ postgres | | select datname, client_addr,current_query from pg_stat_activity; postgres | 192.168.0.208 | pdc_uima_s9 | 192.168.0.208 | pdc_uima_s9 | 192.168.0.208 | pdc_uima_dummy | 192.168.0.208 | pdc_uima_dummy | 192.168.1.102 | pdc_uima_dummy | 192.168.1.102 | pdc_uima_dummy | 192.168.1.102 | (8 rows) PLease help me to understand how much memory does 1 Connection Uses and how to use Server parameters accordingly. Thanks & best Regards, Adarsh Sharma Raghavendra wrote: > Adarsh, > > What is the Size of Database? > > Best Regards, > Raghavendra > EnterpriseDB Corporation > > On Mon, Apr 4, 2011 at 4:24 PM, Scott Marlowe > wrote: > > On Mon, Apr 4, 2011 at 4:43 AM, Scott Marlowe > > wrote: > > > >> [root@s8-mysd-2 ~]# free total used > free shared > >> buffers cached > >> Mem: 16299476 16202264 97212 0 58924 > 15231852 > >> -/+ buffers/cache: 911488 15387988 > >> Swap: 16787884 153136 16634748 > > > > There is nothing wrong here. You're using 153M out of 16G swap. > 15.x > > Gig is shared buffers. If your system is slow, it's not because > it's > > running out of memory or using too much swap. > > Sorry that's 15.xG is system cache, not shared buffers. Anyway, still > not a problem. > > -- > Sent via pgsql-performance mailing list > (pgsql-performance@postgresql.org > ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance > > --------------050101010002010909000501 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit My database size is :-
postgres=# select pg_size_pretty(pg_database_size('pdc_uima_dummy'));
 pg_size_pretty
----------------
 49 GB
(1 row)

I have a doubt regarding postgres Memory Usage :-

Say my Application makes Connection to Database Server ( *.*.*.106) from (*.*.*.111, *.*.*.113, *.*.*.114) Servers and I check the top command as :-- Say it makes 100 Connections

top - 17:01:02 up  5:39,  4 users,  load average: 0.00, 0.00, 0.00
Tasks: 170 total,   1 running, 169 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0% us,  0.2% sy,  0.0% ni, 99.6% id,  0.1% wa,  0.0% hi,  0.0% si,  0.0% st
Mem:  16299476k total, 16198784k used,   100692k free,    73776k buffers
Swap: 16787884k total,   148176k used, 16639708k free, 15585396k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                                        
 3401 postgres  20   0 4288m 3.3g 3.3g S    0 21.1   0:24.73 postgres                                                                                       
 3397 postgres  20   0 4286m 119m 119m S    0  0.8   0:00.36 postgres                                                                                       
 4083 postgres  20   0 4303m 104m 101m S    0  0.7   0:07.68 postgres                                                                                       
 3402 postgres  20   0 4288m  33m  32m S    0  0.2   0:03.67 postgres                                                                                       
 4082 postgres  20   0 4301m  27m  25m S    0  0.2   0:00.85 postgres                                                                                       
 4748 postgres  20   0 4290m 5160 3700 S    0  0.0   0:00.00 postgres                                                                                       
 4173 root      20   0 12340 3028 1280 S    0  0.0   0:00.12 bash                                                                                           
 4084 postgres  20   0 4290m 2952 1736 S    0  0.0   0:00.00 postgres                                                                                       
 4612 root      20   0 12340 2920 1276 S    0  0.0   0:00.06 bash                                                                                           
 4681 root      20   0 12340 2920 1276 S    0  0.0   0:00.05 bash                                                                                           
 4550 root      20   0 12208 2884 1260 S    0  0.0   0:00.08 bash                                                                                           
 4547 root      20   0 63580 2780 2204 S  

and free command says :--
[root@s8-mysd-2 8.4SS]# free -g
             total       used       free     shared    buffers     cached
Mem:            15         15          0          0          0         14
-/+ buffers/cache:          0         15
Swap:           16          0         15
[root@s8-mysd-2 8.4SS]#


Now when my job finishes and I close the Connections from 2 Servers , the top & free output remains the same :-

I don't know What is the reason behind this as I have only 3 Connections from the below command :

postgres=# select datname, client_addr,current_query from pg_stat_activity;
    datname     |  client_addr  |                          current_query                          
----------------+---------------+------------------------------------------------------------------
 postgres       |               | select datname, client_addr,current_query from pg_stat_activity;
 postgres       | 192.168.0.208 | <IDLE>
 pdc_uima_s9    | 192.168.0.208 | <IDLE>
 pdc_uima_s9    | 192.168.0.208 | <IDLE>
 pdc_uima_dummy | 192.168.0.208 | <IDLE>
 pdc_uima_dummy | 192.168.1.102 | <IDLE>
 pdc_uima_dummy | 192.168.1.102 | <IDLE>
 pdc_uima_dummy | 192.168.1.102 | <IDLE>
(8 rows)


PLease help me to understand how much memory does 1 Connection Uses and how to use Server parameters accordingly.


Thanks & best Regards,
Adarsh Sharma



Raghavendra wrote:
Adarsh,

What is the Size of Database?

Best Regards,
Raghavendra
EnterpriseDB Corporation

On Mon, Apr 4, 2011 at 4:24 PM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
On Mon, Apr 4, 2011 at 4:43 AM, Scott Marlowe <scott.marlowe@gmail.com> wrote:
>
>> [root@s8-mysd-2 ~]# free              total       used       free     shared
>>    buffers     cached
>> Mem:      16299476   16202264      97212          0      58924   15231852
>> -/+ buffers/cache:     911488   15387988
>> Swap:     16787884     153136   16634748
>
> There is nothing wrong here.  You're using 153M out of 16G swap.  15.x
> Gig is shared buffers.  If your system is slow, it's not because it's
> running out of memory or using too much swap.

Sorry that's 15.xG is system cache, not shared buffers.  Anyway, still
not a problem.

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


--------------050101010002010909000501--