11
Microsoft SQL Server Internal Architecture Hamid Jabarpour Fard

SQL Server Internal Architecture (Overview)

Embed Size (px)

Citation preview

Page 1: SQL Server Internal Architecture (Overview)

Microsoft SQL Server

Internal ArchitectureHamid Jabarpour Fard

Page 2: SQL Server Internal Architecture (Overview)

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

Page 3: SQL Server Internal Architecture (Overview)

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

Page 4: SQL Server Internal Architecture (Overview)

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

Page 5: SQL Server Internal Architecture (Overview)

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

Page 6: SQL Server Internal Architecture (Overview)

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

Page 7: SQL Server Internal Architecture (Overview)

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.

Page 8: SQL Server Internal Architecture (Overview)

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.

Page 9: SQL Server Internal Architecture (Overview)

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.

Page 10: SQL Server Internal Architecture (Overview)

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

Page 11: SQL Server Internal Architecture (Overview)

Questions and Answers

?