Upload
hamid-j-fard
View
324
Download
3
Embed Size (px)
Citation preview
Microsoft SQL Server
Internal ArchitectureHamid Jabarpour Fard
SpeakerHamid Jabarpour Fard Consultant/Trainer/Speaker CEO, Fard Solutions Sdn. Bhd.
Email: [email protected] Website: http://www.hfard.com Website: http://www.fard-solutions.com
AgendaArchitectural components used to fulfill a Read
and Update request Database recovery and the transaction logDirty pages, checkpoints, and the lazywriterWhere the SQLOS fits in and why it’s needed
Architectural Component of Read Request
ProtocolLayerRelational Engine
(OLEDB) Plan Cache
Data Cache
Buffer PoolStorage Engine
Data File
SNIQuery
Executor
CommandParser
Optimizer
Buffer Manager
AccessMethods
TDS
Language EventQuery Tree
Query PlanTDS
Plan Cache
Data Cache
Buffer Pool
D
Architectural Component of Update Request
ProtocolLayerRelational Engine
(OLEDB)
Storage EngineData File
SNIQuery
Executor
CommandParser
Optimizer
Buffer Manager
AccessMethods
TDS
Language EventQuery Tree
Query PlanTDS
Log File
TransactionManager
Dirty PagesUnmodified Pages are Regarded as “CleanPages”Modified Pages are Regarded as “DirtyPages”
SELECT db_name(database_id) AS 'Database’, count(page_id) AS 'Dirty Pages' FROM sys.dm_os_buffer_descriptors WHERE is_modified =1 GROUP BY db_name(database_id)ORDER BY count(page_id) DESC
Lazywriter ProcessPeriodically checks the size of Free Buffer List.It age-out any data page that haven’t been used
for a while.It Flushes dirty pages to the disk before mark it
as free space in memory.It monitor physical memory.It release some of the free Buffer List memory to
OS in very low memory condition.
Checkpoint ProcessIt makes sure all committed transactions are
written to disk.It doesn’t remove any page from cache.It roughly runs every minute in busy server.It automatically checkpoint when at least 10MB
has been written to the transaction log.Checkpoint can manually run by Checkpoint
command.
Recovery IntervalIt is Server Configuration that can be used to
influence the time between each checkpoint.The value greater than zero, represents number
of minute.Usually set for Test and Lab environments.SQL Server controls Checkpoint I/O to stop it
from impact the disk subsystem too much.SLEEP_BPOOL_FLUSH wait type means
checkpoint I/O was throttled to maintain the overall performance.
SQL Operating System (SQLOS)It is thin user-mode layer between SQL Server
and Windows.It is used for low-level operations such as
Scheduling, IO Completion, Memory Management.
Any DMV that starts with sys.dm_os_% provides enough information about SQLOS.Sys.dm_os_schedulersSys.dm_os_wait_statsSys.dm_os_buffer_descriptorsSys.dm_os_waiting_tasksSys.dm_os_memory_clerks
Questions and Answers
?