OS and HW Tuning Considerations!

Similar documents
OS and Hardware Tuning

Database Systems. November 2, 2011 Lecture #7. topobo (mit)

Database Systems II. Secondary Storage

Outline. Failure Types

Storage and File Structure

Definition of RAID Levels

CMSC 424 Database design Lecture 12 Storage. Mihai Pop

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Database Management Systems need to:

I/O CANNOT BE IGNORED

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

Storing Data: Disks and Files. Storing and Retrieving Data. Why Not Store Everything in Main Memory? Chapter 7

Storing and Retrieving Data. Storing Data: Disks and Files. Solution 1: Techniques for making disks faster. Disks. Why Not Store Everything in Tapes?

I/O Management and Disk Scheduling. Chapter 11

Advanced Database Systems

CS5460: Operating Systems Lecture 20: File System Reliability

OPS-23: OpenEdge Performance Basics

Principles of Data Management. Lecture #2 (Storing Data: Disks and Files)

Administração e Optimização de Bases de Dados 2012/2013 Index Tuning

Outlines. Chapter 2 Storage Structure. Structure of a DBMS (with some simplification) Structure of a DBMS (with some simplification)

L9: Storage Manager Physical Data Organization

6.033 Computer System Engineering

CSCI-GA Database Systems Lecture 8: Physical Schema: Storage

Virtual Memory. Reading. Sections 5.4, 5.5, 5.6, 5.8, 5.10 (2) Lecture notes from MKP and S. Yalamanchili

COMP 3361: Operating Systems 1 Final Exam Winter 2009

Database Architecture 2 & Storage. Instructor: Matei Zaharia cs245.stanford.edu

Associate Professor Dr. Raed Ibraheem Hamed

Storing Data: Disks and Files

Disks, Memories & Buffer Management

Storage and File Structure. Classification of Physical Storage Media. Physical Storage Media. Physical Storage Media

Ch 11: Storage and File Structure

The term "physical drive" refers to a single hard disk module. Figure 1. Physical Drive

STORING DATA: DISK AND FILES

Mass-Storage Structure

I/O CANNOT BE IGNORED

Advanced Database Systems

Storage Systems. Storage Systems

CS370: System Architecture & Software [Fall 2014] Dept. Of Computer Science, Colorado State University

!! What is virtual memory and when is it useful? !! What is demand paging? !! When should pages in memory be replaced?

Classifying Physical Storage Media. Chapter 11: Storage and File Structure. Storage Hierarchy (Cont.) Storage Hierarchy. Magnetic Hard Disk Mechanism

Classifying Physical Storage Media. Chapter 11: Storage and File Structure. Storage Hierarchy. Storage Hierarchy (Cont.) Speed

I/O Hardwares. Some typical device, network, and data base rates

A memory is what is left when something happens and does not completely unhappen.

To Everyone... iii To Educators... v To Students... vi Acknowledgments... vii Final Words... ix References... x. 1 ADialogueontheBook 1

Physical Storage Media

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling

Lecture 14: Cache & Virtual Memory

Data Storage and Query Answering. Data Storage and Disk Structure (2)

Chapter 6 Memory 11/3/2015. Chapter 6 Objectives. 6.2 Types of Memory. 6.1 Introduction

Memory. Objectives. Introduction. 6.2 Types of Memory

Ref: Chap 12. Secondary Storage and I/O Systems. Applied Operating System Concepts 12.1

Administrivia. CMSC 411 Computer Systems Architecture Lecture 19 Storage Systems, cont. Disks (cont.) Disks - review

CSE506: Operating Systems CSE 506: Operating Systems

Storing Data: Disks and Files

CPS 104 Computer Organization and Programming Lecture 20: Virtual Memory

RAID SEMINAR REPORT /09/2004 Asha.P.M NO: 612 S7 ECE

Chapter 6 Objectives

Performance of relational database management

Caching and Demand-Paged Virtual Memory

Storage. Hwansoo Han

IT Best Practices Audit TCS offers a wide range of IT Best Practices Audit content covering 15 subjects and over 2200 topics, including:

Introduction to Database Systems CSE 444. Transactions. Lecture 14: Transactions in SQL. Why Do We Need Transactions. Dirty Reads.

Computer Architecture A Quantitative Approach, Fifth Edition. Chapter 2. Memory Hierarchy Design. Copyright 2012, Elsevier Inc. All rights reserved.


This Unit: Main Memory. Building a Memory System. First Memory System Design. An Example Memory System

Chapter 1 Computer System Overview

Block Device Scheduling. Don Porter CSE 506

CPS104 Computer Organization and Programming Lecture 16: Virtual Memory. Robert Wagner

LSI Corporation

Storing Data: Disks and Files

Reliable Computing I

Administração e Optimização Bases de Dados DEI-IST 2010/2011

Lecture 15 - Chapter 10 Storage and File Structure

CSE 544: Principles of Database Systems

Chapter 11: File System Implementation. Objectives

Virtual Memory. Virtual Memory

Chapter 17: Recovery System

CS370: Operating Systems [Spring 2017] Dept. Of Computer Science, Colorado State University

6. Results. This section describes the performance that was achieved using the RAMA file system.

Overview of Enhancing Database Performance and I/O Techniques

Chapter 1 Computer System Overview

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

CS3600 SYSTEMS AND NETWORKS

Information Systems (Informationssysteme)

EMC DMX Disk Arrays with IBM DB2 Universal Database Applied Technology

Caching and reliability

Chapter 10 Storage and File Structure

CISC 7310X. C11: Mass Storage. Hui Chen Department of Computer & Information Science CUNY Brooklyn College. 4/19/2018 CUNY Brooklyn College

CSE 153 Design of Operating Systems

Computer Architecture and System Software Lecture 09: Memory Hierarchy. Instructor: Rob Bergen Applied Computer Science University of Winnipeg

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

Chapter 11. I/O Management and Disk Scheduling

GFS: The Google File System. Dr. Yingwu Zhu

SYSTEM UPGRADE, INC Making Good Computers Better. System Upgrade Teaches RAID

Concurrency Control Goals

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi

Memory Technology. Chapter 5. Principle of Locality. Chapter 5 Large and Fast: Exploiting Memory Hierarchy 1

Disk scheduling Disk reliability Tertiary storage Swap space management Linux swap space management

[537] RAID. Tyler Harter

CSE 451: Operating Systems. Section 10 Project 3 wrap-up, final exam review

Transcription:

Administração e Optimização de Bases de Dados 2012/2013 Hardware and OS Tuning Bruno Martins DEI@Técnico e DMIR@INESC-ID OS and HW Tuning Considerations OS " Threads Thread Switching Priorities " Virtual Memory DB buffer size " File System Disk layout and access Hardware " Storage subsystem Configuring the disk array Using the controller cache " Components upgrades " Multiprocessor Architectures

Threads Switching control from one thread to another is expensive Number of threads: " Fewer active threads = increased waiting time " Decreased thread switching (and increased overall throughput) Further tuning " Adjust the number of threads in the OS or in the DBMS " If possible, configure the system to longer task switching " DBMS should not run below priority of other applications Threads: Priority Inversion Transaction states running waiting Priority #1 Priority #2 Priority #3 T3 Three transactions: T1, T2, T3 in priority order (1=high to 3=low) T1 1. T3 obtains lock on X and is preempted... 2. T1 blocks on X lock, so is T2 descheduled... 3. T2 does not access X and runs for a long time preventing T3 from running... Net effect: T1 waits for T2

Pay attention to priority " Avoid priority inversion Give all transactions the same priority (recommended by Oracle). Can lead to undesirable fairness. Dynamic priorities: Holder of lock inherits priority of highest priority waiter of lock (SQL Server) Tuning Considerations OS " Threads Thread Switching Priorities # Virtual Memory DB buffer size " File System Disk layout and access Hardware " Storage subsystem Configuring the disk array Using the controller cache " Components upgrades " Multiprocessor Architectures

Impact of the Buffer Goal of the buffer: reduce the number of physical accesses to secondary memory (usually disks) The impact of the buffer on the number of physical accesses depends on three parameters: " Logical reads and writes: Pages that the DBMS accesses via system read and write commands: Some of these will be in the buffer; others will be translated to physical reads and writes (depends on the buffer size) " DBMS page replacements: Physical writes to disk that occur when a page must be brought into the buffer; there are no free pages; and the occupied pages are dirty " OS paging: physical accesses to disk that occur when part of the buffer space lies outside RAM. This should never happen. Database Buffer DATABASE PROCESSES Buffer Cache Hit Ratio = 1 - (PR/LR) UNSTABLE MEMORY Paging Disk RAM LOG DATABASE BUFFER BUFFER LOG DATA DATA STABLE MEMORY Buffer too small, then hit ratio too small Buffer too large, risk of paging Recommended strategy: Monitor hit ratio and increase buffer size until hit ratio flattens out. If there is still paging, then buy memory.

Database Buffer Size SQL Server 7 on Windows 2000 630 MB relation -- Warm buffer(the table is scanned once before each run) Scan query: " Either relation accessed in RAM, or entire relation accessed on disk. This is because of LRU replacement policy Multipoint query: " Throughput increases linearly with buffer size up to the point where all data is accessed from RAM. Tuning Considerations OS " Threads Thread Switching Priorities " Virtual Memory DB buffer size # File System Disk layout and access Hardware " Storage subsystem Configuring the disk array Using the controller cache " Components upgrades " Multiprocessor Architectures

Parameters for File Systems Size of disk chunks allocated at one time " Allocate long sequential slices of disk to files that tend to be scanned. History table files or log files Scan-intensive file Usage factor on disk pages: percentage of a page that can be utilized, yet still permitting a further insertion " Depending on scan/update ratio " High utilization helps scan because fewer pages need be scanned (provided there are no overflows) " Low utilization reduces likelihood of overflows when updates change the size of a record (e.g., string fields) Number of pages that may be prefetched " Prefetching: strategy used to speed up table/index scans by physically reading ahead more pages than requested by a query at a specific point in the hope that future requests be logically fulfilled. " Useful for queries that scan files Usage Factor DB2 UDB v7.1 on Windows 2000 Scan table (aggregation) Throughput increases significantly with usage factor. " The bigger the usage factor the fuller the pages are " The fewest pages have to be read

Prefetching DB2 UDB v7.1 on Windows 2000 Scan table (aggregation) Throughput increases up to a certain point when prefetching size increases. Tuning Considerations OS " Threads Thread Switching Priorities " Virtual Memory DB buffer size " File System Disk layout and access # Hardware " Storage subsystem Configuring the disk array Using the controller cache " Components upgrades " Multiprocessor Architectures

RAID Levels (recap) RAID Level 0: Block striping; nonredundant. Reads and writes large block sizes Used in high-performance applications where data lost is not critical Stripe size should be adjusted to the DBMS page size RAID Level 1: Mirrored disks Writes are synchronous and therefore must wait for the slowest disk Slower than RAID 1 but safe Popular for applications such as storing log files in a database system. RAID Levels (recap) RAID Level 5: Rotated parity striping Partitions data and parity among all N + 1 disks, rather than storing data in N disks and parity in 1 disk. " E.g., with 5 disks, parity block for n th set of blocks is stored on disk ( n mod 5) + 1, with the data blocks stored on the other 4 disks. RAID Level 10: Striping with Mirroring Offers best write performance. Popular for applications such as storing log files in a database system.

RAID Levels Log File " RAID 1 is appropriate Fault tolerance. Writes are synchronous and sequential. No benefits in striping. Temporary Files " RAID 0 is appropriate. No fault tolerance. High throughput. Data and Index Files " RAID 5 fault tolerance where reading dominates writing " RAID 10 is best suited for write intensive apps. RAID Levels Read-Intensive: " Using multiple disks (RAID0, RAID 10, RAID5) increases throughput significantly. Write-Intensive: " Negative impact on performance is obvious with Software RAID5. " The controller manages to hide poor RAID5 performances using its cache

Tuning Considerations OS " Threads Thread Switching Priorities " Virtual Memory DB buffer size " File System Disk layout and access Hardware " Storage subsystem Configuring the disk array Using the controller cache " Components upgrades " Multiprocessor Architectures Hardware Configuration There are 3 ways to add HW to our system: Add Memory " Then increase buffer size without increasing paging Add Disks " Log on separate disk (very important) " Mirror frequently read file " Partition large files Add Processors (in a shared-nothing environment) " Off-load non-database applications onto other CPUs " Off-load data mining applications to old database copy " Increase throughput to shared data

Disk Controller Interfaces between the computer system and the disk drive hardware. " accepts high-level commands to read or write a sector " initiates actions such as moving the disk arm to the right track and actually reading or writing the data " Computes and attaches checksums to each sector to verify that data is read back correctly If data is corrupted, with very high probability stored checksum won t match recomputed checksum " Ensures successful writing by reading back sector after writing it " Performs remapping of bad sectors Hardware Configuration Site#1 SHARED EVERYTHING Site#3 SHARED NOTHING (CLUSTER) Site#2 SHARED DISKS

Controller Cache Disk and array controllers contain memory that can be used as read cache or as write cache Read-ahead: " Prefetching at the disk controller level. " No information on access pattern. " Not recommended. Write-back vs. write through: " Write back: transfer terminated as soon as data is written to cache. Batteries to guarantee write back in case of power failure Fast cache flushing is a priority " Write through: transfer terminated as soon as data is written to disk (no caching). Controller Cache SQL Server 7 on Windows 2000. Adaptec ServerRaid controller: " 80 Mb RAM " Write-back mode Controller cache increases throughput whether operation is cache friendly (volume of update is slightly larger than the controller cache) or not (volume of update is 10 times larger than the controller cache). " This controller implements an efficient replacement policy