Lazy writer and Checkpoint both are very important internal process which is used in Microsoft SQL Serve & allows to use the memory properly & minimise data loss in case of any disaster or system failures. Both serve the same purpose but there are significant differences between them.
Few differences between Lazy writer and Checkpoint are given below:
1) Trigger: Lazy Writer is triggered when the system feels memory pressure and buffer pool is running out of space but Checkpoint is triggered either log buffer is full or manually issued checkpoint by user.
Lazy Writer occurs depending on the memory pressure and resource availability but Checkpoint occurs every 1 minutes approx. or as per user request.
2) Priority: Lazy Writer does not interfere with other SQL Server processes because it has a low priority but Checkpoint can temporarily block other processes because it has a higher priority.
3) Mechanism: Lazy Writer works on a least-recently used (LRU) algorithm to select flush the pages but Checkpoint moves all dirty pages to disk in one go.
4) Function: Lazy Writer is responsible for moving the pages from the buffer pool to the disk but Checkpoint moves dirty pages from the buffer pool to the database file.
5) Frequency: Lazy Writer periodically runs to free up space in the buffer pool but Checkpoint runs at specific recovery intervals, based on the recovery interval setting.
6) Impact on Performance: Impact of Lazy Writer is generally positive and improves performance by reducing I/O operations but impact of Checkpoint is negative on performance due to temporary spike in I/O operations.
7) Data Loss: In case of System failure, Lazy Writer does not guarantee data consistency but Checkpoint reduces risk of data loss written all committed transactions to the disk.
8) Recovery: Lazy Writer makes the recovery slower by reducing volume of data available in memory but Checkpoint makes recovery faster by writing data to the disk.
9) Configuration: Lazy Writer does not require any specific configuration but for Checkpoint need to set recovery interval parameter to determine the frequency of checkpoints.
10) Usage: Lazy Writer is used to manage the buffer pool but Checkpoint is used to ensure data durability and to minimise data loss.
No comments:
Post a Comment