24
Module 3: Instance Architecture Part 1

Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

  • Upload
    hathuy

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Module 3: Instance

Architecture

Part 1

Page 2: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Overview

PART 1:

Configure a Database Server

Memory Architecture Overview

Memory Areas and Their Functions

Process and Thread Architecture

Page 3: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

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

• Startup parameters in SQL Server Configuration Manager

Page 4: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Demonstration: Configuration Parameters

Demonstration:

Configuration Parameters

Page 5: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Memory Architecture – Overview

Virtual Memory

Relevance to DBMS

Sharing Data in Memory

Using Memory Intelligently to Reduce I/O and Enhance Performance

Page 6: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Memory Address Space – Oracle

Components of Oracle in Memory

Application components

RDBMS components

SYSTEM GLOBAL AREA

JAVA POOL

LARGE

POOL STREAMS

POOL

SHARED

POOL

REDO

BUFFER BUFFER

CACHE

Oracle

Process

Server

Process

Server

Process

Server

Process Background

Process PGA PGA PGA

PGA PGA

Automatic Memory Management

Manage both SGA and PGA

Automatically sizes memory

Page 7: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

SQL Server’s Memory Pool and Oracle’s SGA

Oracle System Global Area (SGA)

Buffer Cache Shared Pool

Large

Pool

Java

Pool

Redo

Buffers Fixed

SGA

Streams

Pool

SQL Server Memory Pool

Buffer Cache

Procedure Cache

Connection

Context Log Cache System

Structures CLR Hosting

Layer

Column Store Cache

Page 8: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

SQL Server Architecture (SQLOS)

Components of SQL Server Architecture

• Non-Preemptive Scheduling

• Memory Management

Hosting Subsystems

Memory Management Non-Preemptive

Scheduling

SQLOS

Memory Nodes

Memory Clerks

Caches

Pools

Memory Objects

Scheduling Nodes

Schedulers

Tasks

Worker Threads

System Threads

Exception Handling Resource Monitoring

Page 9: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Memory Address Space – Comparison (Cont.)

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) - legacy

/IncreaseUserVA

64-bit (x64)

Page 10: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Demonstration: Monitoring Memory Usage via DMV’s

Demonstration:

Monitoring Memory Usage via DMV’s

Page 11: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

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

Page 12: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

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

Page 13: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Module 3: Instance

Architecture

Part 2

Page 14: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Overview

PART 2:

Controlling Resources in SQL Server 2012

Client and RDBMS Interactions

Background Processes/Threads and Their Functions

Page 15: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Controlling Resources in SQL Server 2012

Resource Governor is an Enterprise Edition feature

CPU and memory limits per workload

Resource Governor allows for:

Workload prioritization

Predictable performance

Preventing “runaway query”

Accounting of resource usage

Page 16: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Resource Governor = Greater Control

Resource Governor

• Performance

• Availability

Key Components

• Resource Pools

• Workload Groups

• Classification

Page 17: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Demonstration: Using the Resource Governor

Demonstration:

Using the Resource Governor

Page 18: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Oracle Client–Database Interaction

• Oracle’s two modes of interaction are: • Dedicated Server – uses a dedicated server process per client

session

• Shared Server – uses dispatchers and shared server processes

DATABASE Data Files

USERS

User

Process

User

Process

User

Process

Client

Client

Client

Request

Queue

Database

Buffer

Cache

Response

Queue

Dispatcher

Shared

Server

Dedicated

Server

INSTANCE

SGA 1

5

6

7

2

3

4

8

Page 19: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

SQL Server Client–Database Interaction

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

Users

User

Process

User

Process

User

Process

Client

Client

Client Database

Buffer

Cache

Data Files

Relational

Engine ODBC Storage

Engine

Open

Data

Services

Worker

Thread

Worker

Thread

Worker

Thread

Memory

Pools

Page 20: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Oracle Background Processes

USERS

User

Process

User

Process

User

Process

Client

Client

Client

INSTANCE

DATABASE

Automatic Storage Management

Process

Monitor

System

Monitor

Queue

Monitor

Job

Queue

Event

Monitor

Recoverer

Trace

Writer

Dispatcher

Shared

Server

Request

Queue

Response

Queue

SGA

Redo

Log

Buffer

Data Files Archive Log

Files

Control

Files

Redo Log

Files

Database

Buffer

Cache

Dedicated

Server

Database

Writer

Checkpoint

Archiver

Log

Writer

Page 21: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

SQL Server Background Processes

Users

User

Process

User

Process

User

Process

Client

Client

Client

Relational

Engine

ODBC Storage

Engine

Data Files

Log

Files

Database

Buffer

Cache

Log

Cache

Database

Cleanup

Worker

Thread

Log

Writer

Lazy

Writer

Worker

Thread

Database

Shrinking

Open

Data

Services

Memory

Pool

Page 22: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

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

Page 23: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Demonstration: Background Processes

Demonstration:

Background Processes

Page 24: Module 3: Instance Architecture Part 1download.microsoft.com/download/0/3/7/037C983A-CB40-4B50-880E...Module 3: Instance Architecture Part 1 . Overview PART 1: Configure a Database

Review

Controling resources with Resource Governor

Client interaction with database server

Background processes and threads and what they do