Vous êtes sur la page 1sur 20

Module 3:

Instance Architecture

Overview
Configure a Database Server
Memory Architecture Overview
Memory Areas and Their Functions
Process and Thread Architecture
Controlling Resources in SQL Server 2008
Client and RDBMS Interactions
Background Processes/Threads and Their Functions

Configuration of a Server
Using Configuration Parameters to Allocate and Manage
Resources
Oracle Configuration
Use of initialization parameters (init.ora or spfile)
ALTER SYSTEM, ALTER DATABASE

SQL Server Configuration


Setting server properties using SQL Server Management Studio
(SSMS)
The role of sp_configure system stored procedure

Demonstration 1: Configuration Parameters


In this demonstration you will see how to:
Manage instance configurations through
SSMS.
Manage instance configurations through
T-SQL scripts.
Manage instance configurations through
PowerShell.

Memory Architecture Overview


Virtual Memory
Relevance to DBMS
Sharing Data in Memory
Using Memory Intelligently
to Reduce I/O and Enhance
Performance

Memory Address Space Oracle


Oracle
Process

PGA

Background
Process

PGA

Server
Process

PGA

SYSTEM GLOBAL AREA


JAVA POOL

BUFFER
CACHE

REDO
BUFFER

SHARED
POOL

STREAMS
POOL

LARGE
POOL

Server
Process

PGA

Components of Oracle in Me
Application components
RDBMS components

Server
Process

PGA

Automatic Shared Memory Management


Managed by SGA_Target
Automatically sizes

SQL Servers Memory Pool and Oracles SGA


Oracle System Global Area (SGA)

Shared Pool

Buffer Cache

Redo
Buffers

Large
Pool

Fixed
SGA

Streams
Pool

Java
Pool

SQL Server Memory Pool

Buffer Cache

Log Cache

System
Structures

Procedure Cache

Connection
Context

CLR Hosting
Layer

SQL Server Architecture (SQLOS)


Components of SQL Server Architecture
Non-Preemptive Scheduling
Memory Management
SQLOS
Memory Management

Non-Preemptive
Scheduling

Memory Nodes

Scheduling Nodes

Memory Clerks

Schedulers

Caches

Tasks

Pools

Worker Threads

Memory Objects

System Threads

Hosting Subsystems

Exception Handling

Resource Monitoring

Demonstration 2: Monitoring Memory Usage via


DMVs
In this demonstration you will see how to:
Review instance memory via T-SQL

Memory Address Space Comparison


Memory Allocation in SQL Server
Dynamic at
higher level (memory pool, etc.)
lower level (buffer cache, procedure cache, etc.)
Few configurable parameters
Memory Address Range
32-bit (x86)
Address Windowing
Extensions (AWE)
/3GB

64-bit (x64 and xIA64)


2TB

Demonstration 3: Monitor and Affect Memory


In this demonstration you will see how to:
View the setting for the Instance though
SSMS
Use the Task Manager for quick Memory
allocations
Track memory peformance though
counters
Improve memory usage in a 32-bit
system.

Process and Thread-Based Architecture


Process - memory space to protect applications
Threads
Execute code
Allocated time on CPU
Managed by Operating System
Fibers are light-weight threads
reduce context switching overhead
Oracle uses processes in Unix and threads in Windows
Both Oracle and SQL Server use threads and optionally fibers.
Allocate thread assignment with CPU affinity

Resource Governor - Greater Control


Performance
Security
Performance
Security
Availability
Availability

Resource G
Resource G

Oracle ClientDatabase Interaction


Client

Client

Client

User
Process

1
8

Dispatcher

User
Process

Shared
Server

User
Process

Dedicated
Server

2
7

SGA

Request
Queue

3
4

5
6

Database
Buffer
Cache

Response
Queue

INSTANCE

USERS

DATABASE

Data Files

Oracles two modes of interaction are:


Dedicated Server uses a dedicated server process per client
session
Shared Server uses dispatchers and shared server processes

SQL Server ClientDatabase Interaction

Client

User
Process

Memory
Pools

Open
Data
Services

Worker
Thread

User
Process

Worker
Thread

Client

User
Process

Client

Users

Database
Buffer
Cache

Worker
Thread

Relational
Engine

Data Files
OLE
DB

Storage
Engine

SQL Server uses the shared server mode


Functionality of the dispatcher is facilitated by the networker thread
Functionality of the shared server processes by the worker threads

Oracle Background Processes


User
Process

INSTANCE

Request
Queue

Client
Dispatcher

User
Process

Client

Process
Monitor

SGA

Shared
Server

System
Monitor

Database
Buffer
Cache
Redo
Log
Buffer

Response
Queue

Job
Queue
Queue
Monitor
Event
Monitor

User
Process

Dedicated
Server

Database
Writer

Recoverer

Archiver

Client

Checkpoint

Log
Writer

USERS

Trace
Writer

Automatic Storage Management

DATABASE
Data Files

Archive Log
Files

Control
Files

Redo Log
Files

SQL Server Background Processes

Database
Cleanup

User
Process

Client

Memory
Pool

Worker
Worker
Thread
Thread

User
Process
Client

Database
Buffer
Cache

Log
Log
Writer
Writer

Open
Data
Services

Log
Cache

Lazy
Lazy
Writer
Writer

User
Process

Worker
Worker
Thread
Thread

Log
Files

Database
Database
Shrinking
Shrinking

Client

Data Files

Users

Relational
Engine

OLE
DB

Storage
Engine

Comparing Background Processes


Oracle
Process

Oracle
Identifier

SQL Server
Equivalent

Required

Process Monitor

PMON

SQLOS

Mandatory

System Monitor

SMON

Database
Cleanup/Shrinking

Mandatory

Database Writers

DBWn

Lazywriter

Mandatory

Checkpoint Process

CKPT

Database Checkpoint

Mandatory

Recoverer

RECO

MS DTC

Optional

Log Writer

LGWR

Log Writer

Mandatory

Archive Processes

ARCn

N/A

N/A

Job Queue Processes

Jnnn

SQL Agent

Optional

Job Queue Coordinators

CJQn

SQL Agent

Optional

Queue Monitor Processes

QMNn

SQL Agent

Optional

Parallel Query Slave


Processes

Pnnn

Worker Threads

Mandatory

Dispatcher

Dnnn

Networker Thread

Mandatory

Shared Servers

Snnn

Worker Threads

Mandatory

Demonstration 4: Evaluating Instance Resources

In this demonstration you will see how to:


Use Dynamic Management Views to see
processor usage.

Review
How to configure a database server
Memory Address Space of a database server
Memory areas inside Oracle SGA and their SQL Server
equivalents
Process- and thread-based architecture relevant to
RDBMS
Client interaction with database server
Background processes and threads and what they do