optimize oracle on linux

Upload: emilio-sosa

Post on 04-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Optimize Oracle on Linux

    1/44

    2008 Quest Software, Inc. ALL RIGHTS RESERVED.

    Optimizing Oracle ServerPerformance on LINUX

    Tips for Maximizing Toad Productivity

    OOUG 2009Columbus, OH

    July 16th

  • 7/30/2019 Optimize Oracle on Linux

    2/44

    Agenda

    Apply low hanging fruitfixes to speed up Oracle

    performance on Linux

    Well look at both database and operating system

    level modifications

    Goal is simple how can we maximize Oracle

    performance on Linux servers!

  • 7/30/2019 Optimize Oracle on Linux

    3/44

    3

    Bert Scalzo Database Expert & Product Architect for Quest Software

    Oracle Background: Worked with Oracle databases for over two decades (starting with version 4) Work history includes time at both Oracle Education and Oracle Consulting

    Academic Background: Several Oracle Masters certifications BS, MS and PhD in Computer Science

    MBA (general business) Several insurance industry designations

    Key Interests: Data Modeling Database Benchmarking Database Tuning & Optimization "Star Schema" Data Warehouses

    Oracle on Linux and specifically: RAC on Linux

    Articles for: Oracles Technology Network (OTN) Oracle Magazine, Oracle Informant PC Week (eWeek)

    Articles for: Dell Power Solutions

    Magazine The Linux Journal www.linux.com

    www.orafaq.com

    http://www.linux.com/http://www.orafaq.com/http://www.orafaq.com/http://www.linux.com/
  • 7/30/2019 Optimize Oracle on Linux

    4/44

    4

    Books by Bert

    Coming in 2009

  • 7/30/2019 Optimize Oracle on Linux

    5/44

    Couple of Questions (for both our benefit)

    How many people using Where using Linux

    Production

    Development

    Personal Education

    Which Linux Distribution

    Oracle Enterprise Linux

    Redhat Enterprise Server SUSE Linux Enterprise

    Other ???

  • 7/30/2019 Optimize Oracle on Linux

    6/44

    LINUX Server Popularity

    IDC Linux Servers:

    Posted 12th consecutive quarter of double-digit growth Year-over-year revenue growth of 45.1% Unit shipments up 32.1% Revenue exceeded $1.4 billion quarterly (will reach 9.1 billion by

    2008)

    HP was first with 24.3% market share IBM was second with 20.3% market share Customers continue to expand role of Linux servers into an ever

    increasing array of workloads in both commercial and technicalsegments of the market

    Gartner Linux Servers:

    One of hottest applications for Linux is on RDBMS servers Linux was the fastest growing platform for RDBMS past year Enterprises turning to Linux as an alternative for older Unixs

  • 7/30/2019 Optimize Oracle on Linux

    7/44

    LINUX Web Popularity

    #1 OS !!!

    www.netcraft.com/survey/index-200007.html

    In Netcrafts July 2000 survey of18,169,498 web sites.

    http://www.netcraft.com/survey/index-200007.htmlhttp://www.netcraft.com/survey/index-200007.htmlhttp://www.netcraft.com/survey/index-200007.htmlhttp://www.netcraft.com/survey/index-200007.html
  • 7/30/2019 Optimize Oracle on Linux

    8/44

    LINUX Web Popularity

    http://survey.netcraft.com/index-200106.html

    http://survey.netcraft.com/index-200106.htmlhttp://survey.netcraft.com/index-200106.htmlhttp://survey.netcraft.com/index-200106.htmlhttp://survey.netcraft.com/index-200106.html
  • 7/30/2019 Optimize Oracle on Linux

    9/44

    LINUX Web Popularity

    http://news.netcraft.com/archives/2003/07/index.html

    http://news.netcraft.com/archives/2003/07/index.htmlhttp://news.netcraft.com/archives/2003/07/index.html
  • 7/30/2019 Optimize Oracle on Linux

    10/44

    LINUX Gaining Momentum

  • 7/30/2019 Optimize Oracle on Linux

    11/44

    LINUX Gaining Momentumhttp://www.gartner.com/DisplayDocument?ref=g_search&id=414985

    http://www.gartner.com/DisplayDocument?ref=g_search&id=414985http://www.gartner.com/DisplayDocument?ref=g_search&id=414985
  • 7/30/2019 Optimize Oracle on Linux

    12/44

    Popularity != Performance

    Some plausible reasons for this:

    Relative newness of the LINUX OS in general

    RISC UNIX sys admin unfamiliar with INTEL

    INTEL UNIX sys admin unfamiliar with LINUX

    Windows based sys admin unfamiliar with UNIX

    Oracle, Oracle, Oracle

  • 7/30/2019 Optimize Oracle on Linux

    13/44

  • 7/30/2019 Optimize Oracle on Linux

    14/44

    Performance Pyramid

    Application

    DBMS

    OS

    Hardware

    Network

  • 7/30/2019 Optimize Oracle on Linux

    15/44

    Our Main Goal

    To squeeze all the blood out of our LINUX turnip

  • 7/30/2019 Optimize Oracle on Linux

    16/44

    Which LINUX Distribution

    SLES-9 10gR2 Certified

    Red Hat Enterprise AS/ES 4 10gR2 Certified

    Red Hat Enterprise AS/ES 3 10gR2 Certified

    SLES-9 10g Certified

    SLES-8 10g Certified

    Red Hat Enterprise Linux AS/ES 4 10g Certified

    Red Hat Enterprise Linux AS/ES 3 10g Certified

    Red Hat Enterprise Linux AS/ES 2.1 10g Certified

    Red Flag DC Server 4.0 (China Only) 10g Certified

    Monta Vista Carrier Grade Linux 3.1 (Embedded) 10g Certified

    Miracle Linux Standard Edition 2.1 (Japan only) 10g Certified

    Asianux 2.0 10g Certified

    Asianux 1.0 10g Certified

    UnitedLinux 1.0 9.2 Certified

    SLES-9 9.2 Certified

    SLES-8 9.2 Certified

    Red Hat Enterprise Linux AS/ES 4 9.2 Certified

    Red Hat Enterprise Linux AS/ES 3 9.2 Certified

    Red Hat Enterprise Linux AS/ES 2.1 9.2 Certified

    Red Flag DC Server 4.0 (China Only) 9.2 Certified

    Monta Vista Carrier Grade Linux 3.0 (Embedded) 9.2 Certified

    Miracle Linux Standard Edition 2.1 (Japan only) 9.2 Certified

    Asianux 1.0 9.2 Certified

  • 7/30/2019 Optimize Oracle on Linux

    17/44

    Which LINUX Distributionhttp://news.netcraft.com/archives/2005/12/05/strong_growth_for_debian.html

    http://news.netcraft.com/archives/2005/12/05/strong_growth_for_debian.htmlhttp://news.netcraft.com/archives/2005/12/05/strong_growth_for_debian.htmlhttp://news.netcraft.com/archives/2005/12/05/strong_growth_for_debian.htmlhttp://news.netcraft.com/archives/2005/12/05/strong_growth_for_debian.html
  • 7/30/2019 Optimize Oracle on Linux

    18/44

    Test Method

    TPC benchmark (www.tpc.org)

    TPC Benchmark C (TPC-C) is an OLTP workload. It is a mixture of read-only and updateintensive transactions that simulate the activities found in complex OLTP applicationenvironments. It does so by exercising a breadth of system components associated withsuch environments, which are characterized by:

    The simultaneous execution of multiple transaction types that span a breadth of

    complexity On-line and deferred transaction execution modes Multiple on-line terminal sessions Moderate system and application execution time Significant disk input/output Transaction integrity (ACID properties) Non-uniform distribution of data access through primary and secondary keys Databases consisting of many tables with a wide variety of sizes, attributes, and

    relationships Contention on data access and update

    Excerpt from TPC BENCHMARK C: Standard Specification, Revision 3.5

  • 7/30/2019 Optimize Oracle on Linux

    19/44

    Test Platform

    Simulate

    200

    Users

  • 7/30/2019 Optimize Oracle on Linux

    20/44

    Carpenter Needs Tools

    Between the hardware, LINUX and Oraclethere

    are far too many dependent variables for tuning to

    rely merely on human intuition and experience.

    Golden Rule #1:Use OS & DB tuning tools!

    Golden Rule #2:Dont rely on free tools only!

    If your customer or management are willing to buy

    more hardware for better performance, then there is

    obviously budget for tuning toolspress the issue!

    Free is nicebut you often get what you pay for!

  • 7/30/2019 Optimize Oracle on Linux

    21/44

    Tools Used

    This is not a sales pitchIm a DBA (a.k.a techno-nerd)!

    Benchmark Factory

    Create, populate and index the test database (200 megs)

    Simulate 200 concurrent users via a single or many PCs

    LINUX Freebies

    Command line utilities: sar, mpstat, iostat, vmstat, linmon, ipcs,

    top, free, hdparm, linuxconf, slmon,

    X-Windows utilities: gtop, ktop, xload, xosview, kperfmeter,gkrellmm, procmeter, gpowertweak,

  • 7/30/2019 Optimize Oracle on Linux

    22/44

    Benchmark Factory - GUI

  • 7/30/2019 Optimize Oracle on Linux

    23/44

    Benchmark Factory - Agent

  • 7/30/2019 Optimize Oracle on Linux

    24/44

    LINUX cmd toolssar r

    01:00:00 PM kbmemfree kbmemused %memused kbmemshrd kbbuffers kbcached kbswpfree kbswpused %swpused

    01:10:00 PM 465132 48128 9.37 0 2708 26136 525288 0 0.00

    01:20:00 PM 463352 49908 9.72 0 2784 26732 525288 0 0.0001:30:00 PM 463356 49904 9.72 0 2784 26736 525288 0 0.00

    01:40:03 PM 1652 511608 99.67 0 532 18216 447360 77928 14.83

    01:50:01 PM 1604 511656 99.68 0 768 17228 369024 156264 29.74

    02:00:00 PM 376852 136408 26.57 0 1120 25692 503344 21944 4.17

    Average: 295324 217936 42.46 0 1782 23456 482598 42690 8.12

    vmstat

    procs memory swap io system cpur b w swpd free buff cache si so bi bo in cs us sy id

    0 5 0 122308 1588 440 17492 0 124 145 81 906 338 5 5 90

    0 1 0 124608 1588 440 16992 0 230 194 97 1114 435 8 6 86

    0 3 0 127132 1588 432 17140 0 253 164 155 992 373 11 5 84

    0 1 0 128836 1588 440 17344 0 171 172 88 987 394 8 5 87

    0 1 0 130428 1592 468 17024 0 159 189 143 1104 426 11 7 82

    0 0 0 132052 1596 460 16940 2 164 181 131 1059 407 7 5 87

    0 0 0 133240 1600 444 16508 1 120 166 124 1006 394 8 5 87

    0 5 0 134920 1588 452 16596 0 168 138 122 870 344 6 7 87

    1 2 0 136800 1592 448 16500 12 190 184 104 1074 419 7 7 86

    1 0 0 138400 1600 432 16576 0 160 158 128 991 394 9 6 86

    0 1 0 139764 1588 468 16516 0 136 183 135 1086 433 9 6 84

    1 0 0 140780 1596 456 16680 5 102 126 65 815 332 9 8 83

    1 1 0 141984 1588 444 16756 0 120 157 93 957 388 10 9 81

    0 3 0 143044 1588 456 16516 0 106 185 137 1097 441 10 9 81

    1 2 0 143944 1588 464 16468 0 90 138 115 899 348 12 7 82

    1 2 0 144940 1588 464 16320 2 100 179 133 1099 442 8 8 84

    1 1 0 146092 1596 468 16588 0 115 147 82 910 367 8 8 84

    0 2 0 146820 1588 460 16416 18 73 135 111 882 338 7 7 86

    0 5 0 147580 1588 440 16284 2 76 125 84 841 343 8 6 87

    0 2 0 148144 1596 444 15776 0 56 134 89 890 361 6 5 890 0 0 148652 1588 448 15480 0 51 109 47 767 316 7 6 87

  • 7/30/2019 Optimize Oracle on Linux

    25/44

    LINUX gui tools

  • 7/30/2019 Optimize Oracle on Linux

    26/44

    Here We Go

    Work up Performance Pyramid:

    Application (TPCno mods)

    Database

    Operating System

    Hardware

    Other general benchmarking advice:

    Limit to one item per try OS Low Hanging Fruit 1st

    DB Low Hanging Fruit 2nd

    Easy items before hard stuff

  • 7/30/2019 Optimize Oracle on Linux

    27/44

    DB1 - Initial Database Creation

    Database Block Size = 2K

    SGA Buffer Cache = 64M

    SGA Shared Pool = 64M

    SGA Redo Cache = 4M

    Redo Log Files = 4M

    Tablespaces = Dictionary

    Test database created via OraclesDatabase Configuration Assistant

    Prior to 9i, the tools default settings were

    ridiculously lower than these. A novice DBA

    or system admin user might use those lower

    default values and get much worse results!

  • 7/30/2019 Optimize Oracle on Linux

    28/44

    DB2 Increase Buffer Cache & Shared Pool

    Database Block Size = 2K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 4M

    Redo Log Files = 4M

    Tablespaces = Dictionary

  • 7/30/2019 Optimize Oracle on Linux

    29/44

    DB3 Increase Redo Cache & Log Files

    Database Block Size = 2K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 16M

    Redo Log Files = 16M

    Tablespaces = Dictionary

  • 7/30/2019 Optimize Oracle on Linux

    30/44

    DB4 4K Block Size

    Database Block Size = 4K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 16M

    Redo Log Files = 16M

    Tablespaces = Dictionary

  • 7/30/2019 Optimize Oracle on Linux

    31/44

    DB5 Local Tablespaces

    Database Block Size = 4K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 16M

    Redo Log Files = 4M

    Tablespaces = Local

  • 7/30/2019 Optimize Oracle on Linux

    32/44

    DB6 8K Block Size

    Database Block Size = 8K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 16M

    Redo Log Files = 16M

    Tablespaces = Local

    Be carefulfor example on RAC setupchoosing larger block size may cause

    interconnect overload / hot-spots

  • 7/30/2019 Optimize Oracle on Linux

    33/44

    DB7 IO Slaves + Increase Redo Log Files

    Database Block Size = 8K

    SGA Buffer Cache = 128M

    SGA Shared Pool = 128M

    SGA Redo Cache = 16M

    Redo Log Files = 64M

    Tablespaces = Local

    INIT.ORA

    session_cached_cursors=2

    db_block_lru_latches=8

    dbwr_io_slaves=4

    lgwr_io_slaves=4

  • 7/30/2019 Optimize Oracle on Linux

    34/44

    Oracle Modification Results

    DB1 DB2 DB3 DB4 DB5 DB6 DB7 DB Final

    load time 49.41 48.57 41.39 17.35 15.07 11.42 10.48 10.48% Improved -1.73% -17.35% -138.56% -15.13% -31.96% -8.97% -371.47%

    trans/sec 8.15 9.15 10.09 10.18 10.43 10.68 10.72 10.72

    % Improved 10.88% 9.33% 0.89% 2.36% 2.42% 0.32% 23.93%

  • 7/30/2019 Optimize Oracle on Linux

    35/44

    OS1 IPC + Monolithic Kernel

    Kernel = 2.2.14-5smp

    Linuxconf = monolithic

    Shared memory/usr/src/linux-2.2.16/include/asm/shmparam.h#define SHMMAX 0x13000000

    Semaphors/usr/src/linux-2.2.16/include/linux/sem.h#define SEMMNI 100

    #define SEMMSL 512

    #define SEMMNS (SEMMNI*SEMMSL)

    #define SEMOPM 100

    #define SEMVMX 32767

    Monolithic Kernel - If you compile

    everything into the kernel to exactly

    match your hardware and thus

    make minimal use of modules.

  • 7/30/2019 Optimize Oracle on Linux

    36/44

    OS2 Newer Minor Kernel Update

    Kernel = 2.2.16-3smp

    Linuxconf = monolithic

    Shared memory/usr/src/linux-2.2.16/include/asm/shmparam.h#define SHMMAX 0x13000000

    Semaphors/usr/src/linux-2.2.16/include/linux/sem.h#define SEMMNI 100

    #define SEMMSL 512

    #define SEMMNS (SEMMNI*SEMMSL)

    #define SEMOPM 100

    #define SEMVMX 32767

  • 7/30/2019 Optimize Oracle on Linux

    37/44

    OS3 Newer Major Kernel Update

    Kernel = 2.4.1smp

    Linuxconf = monolithic

    Shared memory/usr/src/linux-2.4.00/include/linux/shm.h#define SHMMAX 0x13000000

    Semaphors/usr/src/linux-2.4.00/include/linux/sem.h#define SEMMNI 128

    #define SEMMSL 512

    #define SEMMNS (SEMMNI*SEMMSL)

    #define SEMOPM 128

    #define SEMVMX 32767

    Edit /etc/sysctl.conf

    kernel.shmmax = 2147483647

    kernel.sem = 250 32000 100 128

    The sem values are:

    SEMMSL

    SEMMNSSEMOPM

    SEMMNI

    To set w/out a reboot on Redhat:

    sysctl -p

  • 7/30/2019 Optimize Oracle on Linux

    38/44

    OS4 Newer Minor Kernel Update After Major

    Kernel = 2.4.17smp

    Linuxconf = monolithic

    Shared memory/usr/src/linux-2.4.00/include/linux/shm.h#define SHMMAX 0x13000000

    Semaphors/usr/src/linux-2.4.00/include/linux/sem.h#define SEMMNI 128

    #define SEMMSL 512

    #define SEMMNS (SEMMNI*SEMMSL)

    #define SEMOPM 128

    #define SEMVMX 32767

    Edit /etc/sysctl.conf

    kernel.shmmax = 2147483647

    kernel.sem = 250 32000 100 128

    The sem values are:

    SEMMSL

    SEMMNSSEMOPM

    SEMMNI

    To set w/out a reboot on Redhat:

    sysctl -p

  • 7/30/2019 Optimize Oracle on Linux

    39/44

    OS5 noatime file attribute

    The ext2 file system normally records when a filewas last modified and last accessed. We dont need

    to know access time for Oracle files as background

    programs open and access the files until shutdown.

    chattr +A file_name

    chattrR +A directory_name

    Edit /etc/fstab

    /dev/sda6 / ext2 defaults,noatime 1 1

    /dev/sda1 /boot ext2 defaults,noatime 1 2

    /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0

    /dev/md0 /u01 ext2 defaults,noatime

    1 2/dev/fd0 /mnt/floppy auto noauto,owner 0 0

    none /proc proc defaults,noatime 0 0

    none /dev/pts devpts gid=5,mode=620 0 0

    /dev/sda5 swap swap defaults,noatime 0 0

    Actually, this can be done onWindows server as well!

    HKEY_LOCAL_MACHINE\Sy

    stem\CurrentControlSet\Control\

    FileSystem

    NtfsDisableLastAccessUpdate=1

  • 7/30/2019 Optimize Oracle on Linux

    40/44

    OS6 bdflush rate for VM

    The bdflush file is closely related to the operation ofthe virtual memory (VM) subsystem of the Linux

    kernel and also has a little influence on disk usage.

    Default = "40 500 64 256 500 3000500 1884 2"

    Redhat 6.1

    echo 100 1200 128 512 15 500 1884 2 > /proc/sys/vm/bdflush

    Redhat 6.2 (edit /etc/sysctl.conf)

    vm.bdflush = 100 1200 128 512 15 5000 500 1884 2

    Restart daemon

    /etc/rc.d/init.d/network restart

    1st

    parm is max # of dirty buffers incache. Higher = delayed disk writes.

    2nd parm is max # of dirty buffers per

    write. Higher = delayed, bursty I/O.

    3rd parm is # of buffers added tolist of free buffers by refill_freelist.

    4th parm refill_freelist comesacross more than nref_dirt dirtybuffers, it will wake up bdflush.

    5th parm is max time Linux waitsbefore writing dirty buffers to disk

    for data blocks.6th parm is max time Linux waitsbefore writing dirty buffers to diskfor file system metadata.

  • 7/30/2019 Optimize Oracle on Linux

    41/44

  • 7/30/2019 Optimize Oracle on Linux

    42/44

    LINUX Modification Results

    DB1 DB Final OS1 OS2 OS3 OS4 OS5 OS6 OS7 OS Final Totalload time 49.41 10.48 9.54 9.40 8.32 8.20 5.58 4.43 3.80 3.80 3.80

    % Improved -371.47% -9.85% -1.49% -12.98% -1.46% -46.95% -25.96% -16.58% -151.05% -1200.26%

    trans/sec 8.15 10.72 11.51 11.52 12.82 12.90 13.88 14.99 20.51 20.51 20.51

    % Improved 23.93% 6.90% 0.10% 10.09% 0.66% 7.09% 7.37% 26.92% 43.88% 60.25%

  • 7/30/2019 Optimize Oracle on Linux

    43/44

  • 7/30/2019 Optimize Oracle on Linux

    44/44

    Presenters:

    Bert Scalzo: [email protected]

    Questions and Answers

    Note: these slides should be available on OOUG web site, but

    well also make sure to post them on our companys web site:

    www.toadworld.com/Experts/BertScalzosToadFanaticism/tabid/318/Default.aspx

    Thank You

    mailto:[email protected]://www.toadworld.com/Experts/BertScalzosToadFanaticism/tabid/318/Default.aspxhttp://www.toadworld.com/Experts/BertScalzosToadFanaticism/tabid/318/Default.aspxmailto:[email protected]