AWS RDS First Touch Penalty

AWS RDS First Touch Penalty
According to AWS Documentation

The first time a DB instance is started and accesses an area of disk for the first time, the process can take longer than all subsequent accesses to the same disk area. This is known as the “first touch penalty.” Once an area of disk has incurred the first touch penalty, that area of disk does not incur the penalty again for the life of the instance, even if the DB instance is rebooted, restarted, or the DB instance class changes. Note that a DB instance created from a snapshot, a point-in-time restore, or a read replica is a new instance and does incur this first touch penalty.

Reference :

I captured number of cached pages per database on our SQL Server RDS Instance and rebooted the instance and captured cached pages again.
Based on the documentation, the cached pages should be available and shouldn’t be affected by Reboot process.

Its such a neat feature which makes life lot easier for DBA’s to respond to unexpected situations.
But I noticed significant differences between the number of  cached pages before and after reboot.

Cached Pages Before and After SQL Server RDS Reboot

Resource Database1877143192

For DatabaseOne , Cached Pages dropped from 558482 to 596.

I am not sure whether others have encountered the same issue. Not sure what to think of the First Touch Penalty Promise to keep the cache intact.
Maybe its not true for SQL Server RDS. 🙂

First Touch Penalty Experience with Docker Containers:

Recently I started running SQL Server docker container on Linux and whenever I want to spin up an image from docker instance, it takes about 10-15 Minutes to get the SQL Server up and running with medium Size Database. The initial commands takes unusually long time and results in numerous 502’s 504’s . Be cognizant of this fact whenever you want to bring an instance to the production workload and these types of response times might be acceptable for certain business cases.


AWS Documentation on First Touch Penalty

Query used to calculate number of pages cached.

AWS Discussion Forum

Another soul with similar Issue

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *