I'm using AWS Aurora PostgreSQL Serverless
with autoscaling.
It appears as though scaling clears the shared buffer, so right when we want to crank out the performance, we are forced to face-plant with an I/O bottleneck. After we get warmed up, we see a great performance improvement.
However, if we run back-to-back once scaled, the second run goes much faster.
While I haven't seen anything specific on whether the shared buffer gets cleared on scaling, I'm almost positive that it is.
Aurora Serverless is currently using PostgreSQL 10.14
and it supports the pg_prewarm
extension. It looks like the newest documentation suggests that prewarm supports auto pre-warm after a server restart, but this is serverless and a version that doesn't appear to mention auto pre-warming in the documentation.
I found this post that works great for PostgreSQL when restarting the server or recovering from a crash.
- If we could at least retain the contents of the shared buffer of the lower ACU node after scaling, that'd be fine.
- If we could pre-warm exactly what needs to be in memory ahead of time, that would be awesome!
- There are certain tables that are quite large and we would want to selectively pre-warm the pieces that we want.
pg_prewarm
supportsfirst_block
andlast_block
block numbers for a table/index, but how would one know what values to put in there?
We know ahead of time when our peak is and tell RDS to scale right before, so we have a window of time where we could prepare.
What are my options?