pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to know how much CPU, RAM is used by existing 1 database
7+ messages / 5 participants
[nested] [flat]

* How to know how much CPU, RAM is used by existing 1 database
@ 2022-10-25 08:30 Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Yi Sun @ 2022-10-25 08:30 UTC (permalink / raw)
  To: pgsql-general

Hi,

There are many databases in our production patroni cluster and it seems it
is overloaded, so we decide to migrate the busiest database to a new
patroni cluster.

pgwatch2 is implemented, how to know how much CPU, RAM is used by the
database please? Then we can use it to prepare the new patroni cluster
hardware. Thank you

Best regards
Dennis

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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
@ 2022-10-26 05:37 ` Yi Sun <yinan81@gmail.com>
  2022-10-26 10:10   ` Re: How to know how much CPU, RAM is used by existing 1 database jian he <jian.universality@gmail.com>
  2022-10-26 15:35   ` Re: How to know how much CPU, RAM is used by existing 1 database Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 2 replies; 7+ messages in thread

From: Yi Sun @ 2022-10-26 05:37 UTC (permalink / raw)
  To: pgsql-general

Hi Guys,

Who can help me with this please? I researched but still no result yet,
thank you

On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:

> Hi,
>
> There are many databases in our production patroni cluster and it seems it
> is overloaded, so we decide to migrate the busiest database to a new
> patroni cluster.
>
> pgwatch2 is implemented, how to know how much CPU, RAM is used by the
> database please? Then we can use it to prepare the new patroni cluster
> hardware. Thank you
>
> Best regards
> Dennis
>

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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
@ 2022-10-26 10:10   ` jian he <jian.universality@gmail.com>
  2022-10-26 14:26     ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: jian he @ 2022-10-26 10:10 UTC (permalink / raw)
  To: Yi Sun <yinan81@gmail.com>; +Cc: pgsql-general

On Wed, Oct 26, 2022 at 11:07 AM Yi Sun <yinan81@gmail.com> wrote:

> Hi Guys,
>
> Who can help me with this please? I researched but still no result yet,
> thank you
>
> On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
>
>> Hi,
>>
>> There are many databases in our production patroni cluster and it seems
>> it is overloaded, so we decide to migrate the busiest database to a new
>> patroni cluster.
>>
>> pgwatch2 is implemented, how to know how much CPU, RAM is used by the
>> database please? Then we can use it to prepare the new patroni cluster
>> hardware. Thank you
>>
>> Best regards
>> Dennis
>>
>
manual: https://www.postgresql.org/docs/current/runtime-config-resource.html
except min_dynamic_shared_memory (integer)
all other parameters are used to cap the memory. almost all parameters
mentioned "database server" which means it's on cluster level.


-- 
 I recommend David Deutsch's <<The Beginning of Infinity>>

  Jian

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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 10:10   ` Re: How to know how much CPU, RAM is used by existing 1 database jian he <jian.universality@gmail.com>
@ 2022-10-26 14:26     ` Yi Sun <yinan81@gmail.com>
  2022-10-26 14:47       ` Re: How to know how much CPU, RAM is used by existing 1 database Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Yi Sun @ 2022-10-26 14:26 UTC (permalink / raw)
  To: jian he <jian.universality@gmail.com>; +Cc: pgsql-general

On Wed, 26 Oct 2022 at 18:10, jian he <jian.universality@gmail.com> wrote:

>
>
> On Wed, Oct 26, 2022 at 11:07 AM Yi Sun <yinan81@gmail.com> wrote:
>
>> Hi Guys,
>>
>> Who can help me with this please? I researched but still no result yet,
>> thank you
>>
>> On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> There are many databases in our production patroni cluster and it seems
>>> it is overloaded, so we decide to migrate the busiest database to a new
>>> patroni cluster.
>>>
>>> pgwatch2 is implemented, how to know how much CPU, RAM is used by the
>>> database please? Then we can use it to prepare the new patroni cluster
>>> hardware. Thank you
>>>
>>> Best regards
>>> Dennis
>>>
>>
> manual:
> https://www.postgresql.org/docs/current/runtime-config-resource.html
> except min_dynamic_shared_memory (integer)
> all other parameters are used to cap the memory. almost all parameters
> mentioned "database server" which means it's on cluster level.
>
>
> --
>  I recommend David Deutsch's <<The Beginning of Infinity>>
>
>   Jian
>
>
>
 Hi Jian he

Thank you for your reply

The parameters are on cluster level, so we still can not know how much
memory is used in a specific database, for example, total memory is 64GB
1. How to get how much memory is used on cluster level? For example 40GB
2. How to get how much memory is used in a specific database? For example
30GB, then we can prepare the new patroni cluster 32GB is enough

Thank you
Dennis

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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 10:10   ` Re: How to know how much CPU, RAM is used by existing 1 database jian he <jian.universality@gmail.com>
  2022-10-26 14:26     ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
@ 2022-10-26 14:47       ` Rob Sargent <robjsargent@gmail.com>
  2022-10-26 14:52         ` Re: How to know how much CPU, RAM is used by existing 1 database Atul Kumar <akumar14871@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Rob Sargent @ 2022-10-26 14:47 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 10/26/22 08:26, Yi Sun wrote:
>
>
> On Wed, 26 Oct 2022 at 18:10, jian he <jian.universality@gmail.com> wrote:
>
>
>
>     On Wed, Oct 26, 2022 at 11:07 AM Yi Sun <yinan81@gmail.com> wrote:
>
>         Hi Guys,
>
>         Who can help me with this please? I researched but still no
>         result yet, thank you
>
>         On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
>
>             Hi,
>
>             There are many databases in our production patroni cluster
>             and it seems it is overloaded, so we decide to migrate the
>             busiest database to a new patroni cluster.
>
>             pgwatch2 is implemented, how to know how much CPU, RAM is
>             used by the database please? Then we can use it to prepare
>             the new patroni cluster hardware. Thank you
>
>             Best regards
>             Dennis
>
>
>     manual:
>     https://www.postgresql.org/docs/current/runtime-config-resource.html|
>     |
>     |except |min_dynamic_shared_memory| (|integer|)|
>     |all other parameters are used to cap the memory. almost all
>     parameters mentioned "database server" which means it's on cluster
>     level.
>     |
>     |
>     |
>     |
>     |
>     -- 
>      I recommend David Deutsch's <<The Beginning of Infinity>>
>
>       Jian
>
>
>
>  Hi Jian he
>
> Thank you for your reply
>
> The parameters are on cluster level, so we still can not know how much 
> memory is used in a specific database, for example, total memory is 64GB
> 1. How to get how much memory is used on cluster level? For example 40GB
> 2. How to get how much memory is used in a specific database? For 
> example 30GB, then we can prepare the new patroni cluster 32GB is enough
>
> Thank you
> Dennis
You can see connection with pg*backend* functions.  You can log 
connections to see which db is most commonly accessed. You can log sql 
to see which table are being touched.  You'll have to assume a 
correlation to CPU/disc usage.  What have you tried?

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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 10:10   ` Re: How to know how much CPU, RAM is used by existing 1 database jian he <jian.universality@gmail.com>
  2022-10-26 14:26     ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 14:47       ` Re: How to know how much CPU, RAM is used by existing 1 database Rob Sargent <robjsargent@gmail.com>
@ 2022-10-26 14:52         ` Atul Kumar <akumar14871@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Atul Kumar @ 2022-10-26 14:52 UTC (permalink / raw)
  To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-general@lists.postgresql.org

I hope the below link helps...

https://www.enterprisedb.com/blog/monitor-cpu-and-memory-percentage-used-each-process-postgresqlppas...

On 10/26/22, Rob Sargent <robjsargent@gmail.com> wrote:
> On 10/26/22 08:26, Yi Sun wrote:
>>
>>
>> On Wed, 26 Oct 2022 at 18:10, jian he <jian.universality@gmail.com>
>> wrote:
>>
>>
>>
>>     On Wed, Oct 26, 2022 at 11:07 AM Yi Sun <yinan81@gmail.com> wrote:
>>
>>         Hi Guys,
>>
>>         Who can help me with this please? I researched but still no
>>         result yet, thank you
>>
>>         On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
>>
>>             Hi,
>>
>>             There are many databases in our production patroni cluster
>>             and it seems it is overloaded, so we decide to migrate the
>>             busiest database to a new patroni cluster.
>>
>>             pgwatch2 is implemented, how to know how much CPU, RAM is
>>             used by the database please? Then we can use it to prepare
>>             the new patroni cluster hardware. Thank you
>>
>>             Best regards
>>             Dennis
>>
>>
>>     manual:
>>     https://www.postgresql.org/docs/current/runtime-config-resource.html|
>>     |
>>     |except |min_dynamic_shared_memory| (|integer|)|
>>     |all other parameters are used to cap the memory. almost all
>>     parameters mentioned "database server" which means it's on cluster
>>     level.
>>     |
>>     |
>>     |
>>     |
>>     |
>>     --
>>      I recommend David Deutsch's <<The Beginning of Infinity>>
>>
>>       Jian
>>
>>
>>
>>  Hi Jian he
>>
>> Thank you for your reply
>>
>> The parameters are on cluster level, so we still can not know how much
>> memory is used in a specific database, for example, total memory is 64GB
>> 1. How to get how much memory is used on cluster level? For example 40GB
>> 2. How to get how much memory is used in a specific database? For
>> example 30GB, then we can prepare the new patroni cluster 32GB is enough
>>
>> Thank you
>> Dennis
> You can see connection with pg*backend* functions.  You can log
> connections to see which db is most commonly accessed. You can log sql
> to see which table are being touched.  You'll have to assume a
> correlation to CPU/disc usage.  What have you tried?





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

* Re: How to know how much CPU, RAM is used by existing 1 database
  2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
  2022-10-26 05:37 ` Re: How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
@ 2022-10-26 15:35   ` Laurenz Albe <laurenz.albe@cybertec.at>
  1 sibling, 0 replies; 7+ messages in thread

From: Laurenz Albe @ 2022-10-26 15:35 UTC (permalink / raw)
  To: Yi Sun <yinan81@gmail.com>; pgsql-general

On Wed, 2022-10-26 at 13:37 +0800, Yi Sun wrote:
> Who can help me with this please? I researched but still no result yet, thank you
> 
> On Tue, 25 Oct 2022 at 16:30, Yi Sun <yinan81@gmail.com> wrote:
> > Hi,
> > 
> > There are many databases in our production patroni cluster and it seems it is overloaded,
> > so we decide to migrate the busiest database to a new patroni cluster. 
> > 
> > pgwatch2 is implemented, how to know how much CPU, RAM is used by the database please?
> > Then we can use it to prepare the new patroni cluster hardware. Thank you

You can look how much *private* memory the backends for a certain database
use by examining /proc/<pid>/smaps, you can use the pg_buffercache extension
to see how much of which database is in cache, but you don't know how much
of the kernel page cache is used to cache files for that database.

Yours,
Laurenz Albe





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


end of thread, other threads:[~2022-10-26 15:35 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-10-25 08:30 How to know how much CPU, RAM is used by existing 1 database Yi Sun <yinan81@gmail.com>
2022-10-26 05:37 ` Yi Sun <yinan81@gmail.com>
2022-10-26 10:10   ` jian he <jian.universality@gmail.com>
2022-10-26 14:26     ` Yi Sun <yinan81@gmail.com>
2022-10-26 14:47       ` Rob Sargent <robjsargent@gmail.com>
2022-10-26 14:52         ` Atul Kumar <akumar14871@gmail.com>
2022-10-26 15:35   ` Laurenz Albe <laurenz.albe@cybertec.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