Skip to content

RDS PostgreSQL Instance Free memory explanation

0

I am downsizing my RDS instances, and for example I had a machine with 8GB Ram with 6 GB of free memory and then after I modify this database to a 4GB Ram machine, I could see in the monotoring details that I had 3 GB free memory, how is this possible ?

Shouldn´t I have only 2 GB of free memory with the new instance ?

Can someone explain this to me, thanks :)

asked 2 years ago2.8K views
3 Answers
1
Accepted Answer

Hi,

Yes, you can downscale to 4 GB RAM , for example set instance class to db.t4g.medium which has 2 vCPU and 4 GB RAM. Please ensure, this instance class is supported for your DB engine and version.

Hope it helps and if it does, I would appreciate if answer can be accepted so that community can benefit for clarity when searching for similar enquiries in repost/aws guide.

AWS
answered 2 years ago
EXPERT
reviewed 2 years ago
0

When you resized your Amazon RDS PostgreSQL instance from 8GB of RAM to 4GB of RAM and observed 3GB of free memory, it might seem counterintuitive at first, but there are a few reasons why this could be the case:

Dynamic Memory Usage: Databases like PostgreSQL dynamically allocate memory based on the workload and the configurations set. If your database wasn't using a lot of memory in the first place, the system might still be optimizing the usage even after you've downsized the hardware. It could be that the instance does not require the full capacity even at the lower specification.

Caching and Buffering Adjustments: PostgreSQL uses the system RAM for caching and buffering to enhance performance. When the total available memory is reduced, PostgreSQL (and the operating system it runs on) might optimize what is kept in memory, potentially reducing the footprint of what needs to be actively cached.

Memory Allocation by Operating System and RDS Overhead: The operating system and the RDS management layers themselves require memory. When you reduce the total memory, these components might optimize their memory usage to maintain performance, which could paradoxically result in more 'free' memory being reported than expected.

Measurement Timing and Tools: The tools and methods used to measure free memory can also impact what you observe. Monitoring tools often take snapshots at intervals, and what they report as 'free memory' might include buffers and cache that the OS can reclaim if needed. The timing of the snapshot relative to database activity can affect this measurement.

In essence, seeing 3GB of free memory on a 4GB system does not necessarily mean that the system is underutilizing resources; rather, it could indicate efficient use and adjustment to the new limits. It's always a good practice to monitor performance over time, especially after such changes, to ensure that the database continues to perform optimally with the allocated resources.

EXPERT
answered 2 years ago
  • Really good answer it helped me alot, thank you :) I just wanted to ask one more thing I downsize a production database from 16 GB ram to a 8 GB ram and at first I had 11 GB free memory and now I have 5 GB of free memory , from that Logic I can still downsize to a 4GB ram without any problem correct ? By the way my CPU utilization and the rest are prety low.

0

Really good answer it helped me alot, thank you :) I just wanted to ask one more thing I downsize a production database from 16 GB ram to a 8 GB ram and at first I had 11 GB free memory and now I have 5 GB of free memory , from that Logic I can still downsize to a 4GB ram without any problem correct ? By the way my CPU utilization and the rest are prety low.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.