| From: | "HEARNE, TIMOTHY S" <th1618(at)att(dot)com> | 
|---|---|
| To: | "pgadmin-support(at)postgresql(dot)org" <pgadmin-support(at)postgresql(dot)org> | 
| Cc: | "ANDERSON, RICHARD W" <ra4288(at)att(dot)com>, "HIGGINS, BRIAN" <bh3619(at)att(dot)com>, "Anil Kumar (a(dot)kumar(at)castsoftware(dot)com)" <a(dot)kumar(at)castsoftware(dot)com>, "WICKE, SCOTT W" <sw6534(at)att(dot)com>, Aditya Pai <A(dot)Pai(at)castsoftware(dot)com> | 
| Subject: | Memory use | 
| Date: | 2015-09-10 19:42:26 | 
| Message-ID: | 00CF4A25E32E204B8968E067CE2BB0D902545F1D@CAFRFD1MSGUSRJB.ITServices.sbc.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgadmin-support | 
I am attempting to determine the amount of memory which is being used by my 2 PostgreSQL instances (8.4.1 and 9.2.10).
OS Version: Red Hat Enterprise Linux Server release 5.10 (Tikanga) (Linux xxxxxxx 2.6.18-371.11.1.el5 #1 SMP Mon Jun 30 04:51:39 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux)
When I use top, I have recently observed memory usage of up to 190 GB but I am being told by our Server support team that it never uses more than about 12 GB of computational memory (including memory used by a small Oracle instance). I have read on-line that because PostgreSQL uses shared memory that top (and pmap) tends to overstate the actual memory in use.
top - 09:47:30 up 330 days, 23:12,  1 user,  load average: 2.79, 3.37, 3.14
Tasks: 1525 total,   3 running, 1520 sleeping,   0 stopped,   2 zombie
Cpu(s):  3.0%us,  0.3%sy,  0.0%ni, 96.4%id,  0.4%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:  264114472k total, 193001540k used, 71112932k free,   497484k buffers
Swap: 16779852k total,   697304k used, 16082548k free, 179534676k cached
Using the information found in Table 17-2. PostgreSQL Shared Memory Usage (http://www.postgresql.org/docs/9.2/interactive/kernel-resources.html) I have calculated the following for the instances:
8.4.1 instance:
Usage   Approximate shared memory bytes required (as of 8.3)            megs    Observed        Observed (megs)
Connections     (1800 + 270 * max_locks_per_transaction) * max_connections                           332,316,000                       316.92
Autovacuum workers      (1800 + 270 * max_locks_per_transaction) * autovacuum_max_workers                                 3,323,160                         3.17
Prepared transactions   (770 + 270 * max_locks_per_transaction) * max_prepared_transactions                                              -                              -
Shared disk buffers     (block_size + 208) * shared_buffers              1,033,476,505,600             985,600.00              102,400.00                             0.0977
WAL buffers     (wal_block_size + 8) * wal_buffers                       16,777,216.00                   16.00             2,048.00                           0.0020
Fixed space requirements        770 *1024                                    788,480                        0.75
                         1,033,494,071,296             985,616.75
Variables
max_locks_per_transaction       4096
Max_connections 300
autovacuum_max_workers  3
max_prepared_transactions       0        0 means not used
block_size      1024
shared_buffers  838860800
wal_block_size  8192
wal_buffers     16777216
work_mem        16777216
9.2.10 instance:
Usage   Approximate shared memory bytes required (as of 8.3)            megs    Observed        Observed (megs)
Connections     (1800 + 270 * max_locks_per_transaction) * max_connections                           332,316,000                       316.92
Autovacuum workers      (1800 + 270 * max_locks_per_transaction) * autovacuum_max_workers                                 3,323,160                         3.17
Prepared transactions   (770 + 270 * max_locks_per_transaction) * max_prepared_transactions                                              -                              -
Shared disk buffers     (block_size + 208) * shared_buffers              2,645,699,854,336         2,523,136.00                262,144.00                             0.2500
WAL buffers     (wal_block_size + 8) * wal_buffers                       16,777,216.00                   16.00             2,048.00                           0.0020
Fixed space requirements        770 *1024                                    788,480                        0.75
                         2,645,717,420,032         2,523,152.75
Variables
max_locks_per_transaction       4096
Max_connections 300
autovacuum_max_workers  3
max_prepared_transactions       0        0 means not used
block_size      1024
shared_buffers  2147483648
wal_block_size  8192            4.1015625
wal_buffers     16777216
work_mem        67108864
--------------------
The observed values above for Shared disk buffers and WAL Buffers were captured using the "Current Value" in the Backend Configuration Editor of the pgAdmin III (v1.18) tool.  They are a point in time value.
I question the calculation for Shared disk buffers as it is way too high. I saw another post stating the calculation could be off by the block size. If that is the case, the displayed values above would be divided by 1024. In the postgresql.conf files, the shared_buffer values were entered as 800MB and 2048MB.
The small Oracle mentioned above has the following SGA:
Fixed Size                 2,254,952
Variable Size      1,392,510,872
Database Buffers               704,643,072
Redo Buffers             38,477,824
Bottom line, does it seem reasonable based upon the above that the server could only be using around 12 GB of memory?  Is there another way to determine the actual memory being used by the instances?
Thank you,
Tim Hearne
PROPRIETARY INFORMATION
The Information contained herein is for use only by authorized employees of AT&T, and authorized
Affiliates of AT&T, and is not for general distribution within or outside the respective companies
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dmitriy Olshevskiy | 2015-09-12 09:02:38 | Re: bug report: pgadmin 1.20.0 Windows 8.1 MATERIALIZED VIEW with INDEX, pgadmin doesn't show the INDEX | 
| Previous Message | ganesan.k31 | 2015-09-10 04:54:17 | Setting up Date Language in Postgresql |