1 Oracle Cloud Performance Best Practices Tuning, Diagnostics and Issue Resolution Deb Bhattacharjee Nikolai Potapov Nathan Reynolds PSR Performance, ...
1 Best Practices for Oracle Database on HPE 3PAR StoreServ Storage Best practices, configuration and settings for deploying Oracle on HPE 3PAR StoreSe...
1 Oracle Cloud Performance and Tuning Best Practices E September 20172 Oracle Cloud Performance and Tuning Best Practices, E Copyright 2016, 2017, Ora...
1 Backup and Recvery Best Practices fr the Oracle Database Appliance Prtecting databases and applicatins running n Oracle Database Appliance ORACLE WH...
1 Exploring Oracle Database 12c Multitenant Best Practices for your Cloud Ami Aharonovich Oracle ACE & OCP Oracle ACE About Me Oracle Certified Pr...
1 Best practices for a Data Warehouse on Oracle Database 11g An Oracle White Paper September 20082 NOTE: The following is intended to outline our gene...
1 2 Oracle Net Services 12c Best Practices for Database Performance and Scalability Kant C Patel Director Oracle Net3 Program Agenda Overview of Oracl...
1 2 Best Practices for Performance.NET and Oracle Database Alex Keh Senior Principal Product Manager Oracle October 4, 2017 Christian Shay Senior Prin...
1 Best Practices for Database Administrators Sheeri K. Cabral Database Administrator The Pythian Group, MySQL User Conference & Expo2 MIRE Make It...
1 Using.NET Core and Entity Framework Core Linux/Windows with Oracle Database Alex Keh Senior Principal Product Manager Server Technologies October 23...
Best Practices for Oracle Database Performance on Windows Christian Shay Principal Product Manager, Oracle
• Overview • Architecture • Best Practices for Windows (32 bit & 64 bit) – – – –
Windows OS Diagnostic Tools Optimize CPU usage Optimize Network Optimize File I/O
• Best Practices for 32 bit Windows – Optimize Memory
• Best Practices for 64 bit Windows • Q+A: Ask the Experts 3
Windows 32-bit Platform Support OS
Windows XP Professional
Windows Server 2003 and Windows Server 2003 R2
Windows Server 2008
Windows 64-bit Platform Support OS
Windows Server 2003 for Itanium
Windows XP, Windows Server 2003, and Windows Server 2003 R2, x64 Editions
Windows Vista for x64 systems
Windows 7 for x64 systems
Windows Server 2008 for x64 systems
Windows Server 2008 R2 for x64 systems
Architecture: Thread Model SGA contains
db buffers, log buffers
shared pool, other memory
Background and foreground threads
other memory allocations
Database Architecture • Thread model, not a straight port of Oracle’s process architecture • 3GB (32-bit) or 8TB (64-bit) maximum memory per database instance. VLM support allows >3GB on 32-bit. • Runs as a Windows service process • No limits on memory, connections, resources except those imposed by the operating system
• Oracle11g supports asynchronous I/O to all types of files • Logical and physical raw files and partitions are fully supported (faster than NTFS) • Full 64-bit file I/O internally (for both Win32 and Win64 OS). This means: – No 2GB or 4GB limitations on database file sizes. – Maximum file size is 64GB – Maximum database size is 4 petabytes
File I/O • Asynch IO support on Windows is very good for both file system and raw devices. • No need to set INIT.ORA parameter “filesystemio_options” • Default value of “asynch” is the recommended setting.
Windows Server 2003/2008
• Large Page support – For instances with large memory requirements, large page support can improve performance. • To enable, set registry parameter ORA_LPENABLE to 1 • 32 bit – 4kb default page size– will now be 2MB • 64 bit – 8kb default page size– will now be 16 MB • x64 – 8kb default page size – will now be 2 MB – Windows Server 2003 64-bit may be slow to allocate a huge amount of memory when using large pages especially if memory is already fragmented. Start Oracle before other processes if this affects you. This problem is reduced in Windows Server 2008.
Windows Server 2003/2008
• NUMA support for memory/scheduling – Database intelligently allocates memory and schedules threads based on node configuration – Best Practices: For NUMA on AMD patch to a minimum 10.2.0.2 P5
• Test well before going into production, Work with your hardware vendor and Oracle support to enable NUMA.
• Circuitry added to Intel CPUs resulting in single CPU functioning as 2 CPUs • All versions of Oracle are supported in Hyperthreaded environments.
Additional Integration with Windows
• Integration with Performance Monitor • Integration with Event Log
Direct NFS Client on Windows • Network Attached Storage (NAS) uses Network File System (NFS) • Oracle Database 11g allows direct Windows NFS v3 access – Part of DB kernel in Oracle Disk Manager library
• Specially useful for Windows as Kernel NFS is not natively supported on Windows • Bypasses a lot of software layers in OS • Tailored for the specific I/O patterns that Oracle uses
Direct NFS • Linear scalability of direct NFS can be achieved with inexpensive NICS - and – Does not require expensive switches which support link aggregation…Oracle does load balancing rather relying on a switch. – Parallel network paths – More NICS – more bandwidth
• Direct NFS is a good solution from low to high end database servers
32-Bit and 64-Bit
Diagnostic Tools - Performance Monitor
• • • • • • • •
tasklist, taskkill tlist (Shows command line args with -c) driverquery diskpart sc (sc query state= all) regmon, filemon, procexp, tcpview Windows Services for Unix poolmon
ODP.NET Integration with Performance Monitor
• Monitor Connection Pools (New Feature of ODP.NET 11.1) • Enable in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ODP.NET\Asse mbly_Version\PerformanceCounters Counters include (among many): • HardConnectsPerSecond • HardDisconnectsPerSecond • SoftConnectsPerSecond • SoftDisconnectsPerSecond • NumberOfActiveConnection • NumberOfFreeConnections
Client Diagnosability on 11g
• • • •
Integrated with ADR OCI and Net tracing and logging uses ADR by default Multithreaded client-side diagnosability context support First Failure Capture – No need to reproduce a second time to get a dump
• Client and Server trace file correlation • Reduce one-off diagnostic patches • Structure Dump Facility – Dumps more than just a stack
• V$SESSION_CONNECT_INFO/GV$_SESSION_CONNECT_INF – CLIENT_CHARSET (NLS character set) – CLIENT_CONNECTION (Homogeneous/heterogeneous) – CLIENT_OCI_LIBRARY (Home-based, Instant Client Full/Light) – CLIENT_VERSION (client RSF version) – CLIENT_DRIVER (OCI/JDBC/other) • OCI_ATTR_DRIVER_NAME to set third party driver
Client-Side Crash Handler
• • • •
Goal: handle segfaults, other core dumps As of 10.2, handler only in RDBMS server With 11g, we add one on client side Generates error message & stack trace, and controls core dump location
• Oracle uses all processors available through the OS • ORACLE_AFFINITY registry value can be set to tell Oracle which threads to run on which processors (same setting for all instances) • Use Database Resource Manager to set CPU usage for different classes of users – For example, one can configure the db to use 50% CPU for gold customers, 30% for silver and 20% for rest
• Thread priorities can be set in the registry using the ORACLE_PRIORITY variable
CPU Tuning – Diagnosing High CPU
• Process Explorer: drill down to threads • Get thread id of high CPU thread and then do query • SELECT a.spid, b.username FROM v$process a, v$session b WHERE a.addr= b.paddr AND a.spid =
Networking Best Practices
• Use one listener per system • The default queue-size for Windows Server is 50 – increase to 200 or 300 using QUEUESIZE parameter in LISTENER.ORA – prevents errors during login storms • Listener Logon Storm Handler – Configurable on server side in LISTENER.ORA (RATE_LIMIT = ) – Use only if you have logon storm issues
Networking Best Practices
• Increase “DEFAULT_SDU_SIZE” in SQLNET.ORA or “SDU” in TNSNAMES.ORA – Controls SQL*Net packet size – Default SDU size in 11g is now 8k. For bulk data transfer scenarios, increase DEFAULT_SDU_SIZE in sqlnet.ora or SDU in tnsnames.ora. It can be increased up to 32K. – Any mix of 11g and 10g will cause it to negotiate down to lower of the two peers (pre-11g default is 2K) • For 10g increase DEFAULT_SDU_SIZE to 8k or higher. – Common misperception: Do not set to match MTU!
Networking Best Practices: Shared Server vs. Dedicated Server • Dedicated server gives very best performance – – – –
Each client connection has it’s own thread Memory usage is 2-4 MB per server thread Oracle uses dedicated server for OLTP benchmarks Can hit scalability limits due to memory use
• Shared server saves a lot of memory! – Idle connections will not consume much memory – Latency because dispatcher hands request to shared server – Good for large number of connections with many idle
Networking Best Practices: Shared Server vs. Dedicated Server • Recommendation: Use dedicated server if you have enough physical memory, otherwise use shared for all sessions that may be idle for some time. • Continue to use dedicated server for a small number of high performance connections/queries.
Networking Best Practices: Using Shared Server • Client connections share pre-spawned server threads – No dedicated idle threads wasting resources
• Enable Shared Server on client in tnsnames.ora: (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp) (HOST=sales-server)(PORT=1521)) (CONNECT_DATA= (SERVICE_NAME=sales.us.acme.com) (SERVER=shared) ))
• Modify init.ora parameters on server to enable shared servers • Rough guidelines: 20 or 30 Shared Servers per 500 sessions, then tune from there • Use 1 dispatcher for every 50-100 sessions • See Net Admin Guide for more details
Networking Best Practices: Oracle Database Resident Connection Pool – Pools Oracle Dedicated Servers – Shares server side connection pool across mid tier systems and processes – Co-exists in all server configurations • Dedicated Servers, Shared Servers, RAC – Most useful when you have many thousands of client processes connecting to a database server and each process needs to hold on to the database server session for a short time – In test environment, we were able to support more than 20,000 connections to a 2 GB Database Server – Pooling is optionally enabled by DBA on Server – Client connect string also needs to have (SERVER=POOLED)
Networking Best Practices: Connection Timeouts • Client Side connection timeouts: Achieve fast failover when you have multiple addresses in connect string – TCP.CONNECT_TIMEOUT – 11g feature - it can be a few seconds. (60 Seconds default in 11.2). Tune down from there. Too low – false positives – SQLNET.OUTBOUND_CONNECT_TIMEOUT – 10gR2 and later – Not set by default. – These two timeouts can be used individually or at the same time
• Server Side connection timeouts: – SQLNET.INBOUND_CONNECT_TIMEOUT – available in 10gR1 and later - default 60 secs for 10gR2 and 11g, not enabled by default for 10gR1; this can also be used along with the client side timeouts above.
Networking Best Practices: TCP Optimization on Windows • Vista / Server 2008 supports TCP auto-tuning • For other versions, *careful* tuning necessary under RegKey HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\Tcpip\Parameters
– Turn on Window Scaling and Timestamps Tcp1323Opts = 3
– Set TCP Window Size to BDP GlobalMaxTcpWindowSize
– If desired, tune Window Size at the Interface Level (eg network card level) Tcpip\Parameters\Interfaces\\ TcpWindowSize
Networking Best Practices
• SQLNET.AUTHENTICATION_SERVICES=(NTS) – This is a default value in SQLNET.ORA, needed for OS authentication (connect / as SYSDBA) – It should be left at default on server side.
• Use SecureFile LOBs – NET stack optimizations provide very high throughput limited only by the underlying hardware
File System Best Practices
• Use ASM – whether single-instance or RAC – use most recent version of ASM • Benefits – Don’t need to move datafiles around – Don’t need to take tablespaces offline – Add disks with no downtime
• If you don’t use ASM, but want to use raw devices: – Use volume mount points to mount raw devices onto directories – Use this mount point as the file name for raw devices.
Provides Best Performance
– Database instance directly accesses data on disks – ASM not in path between instance and storage
• Sun ASM vs RAW benchmark – ASM supported 80% more throughput with 50% shorter response
• CERN testing on 11.2 Beta: “ACFS much faster than ext3 with comparable or less CPU usage”
• ASM provides equivalent performance to RAW Non-ASM (Gets out of tune in time)
ASM vs ext3 and OCFS full scan and index build speed to perform operation - small is better 900 Full Scan 100G parallel 32 create index parallel 32 800
ASM has Best Performance
0 ext3 async
Stores All Data
SOA IMDB OC4J APACHE
ASM Cluster File System
ASM Cluster File System (ACFS)
File System Binaries OCR & Voting Files
• General purpose scalable file system • Accessible through NAS protocols (NFS, CIFS) • Multi OS platform (Linux and Windows at initial release) • Dynamic Volume Management Supported • Read Only Snapshots Supported
Memory Best Practices
• 11g: Use MEMORY_TARGET for automatic management of combined SGA and PGA • 10g and earlier: – Control SGA Memory by using SGA_TARGET parameter – Control PGA Memory by using PGA_AGGREGATE_TARGET parameter
Specific to 32-bit
32 bit Memory Best Practices • Don’t use 32-bit Windows! Move to 64-bit Windows if at all possible!!! Memory issues on Win32 are a pain to deal with. • Increase addressable memory available to the Oracle process by adding /3GB switch to boot.ini file: multi(0)disk(0)rdisk(0)partition(1)\WINNT="Microsoft Windows 2000 Advanced Server" /fastdetect /3GB
• Reboot server to enable • Must monitor kernel memory closely to prevent instability of operating system • See Metalink Notes 46001.1 and 297498.1 • See Microsoft KB article 297812 43
• Key Items to Monitor for Memory Usage: – Perfmon - Virtual Bytes for oracle.exe to see total memory used by the process – Total Pool Non-Paged Bytes – Memory Counter • If grows close to 128MB, operating system instability will occur • If this grows too high, look for memory leaks – Free System Page Table Entries (PTE’s) – Memory Counter • Should never fall below 7500 or so • /USERVA=2560 switch in boot.ini will help prevent this
• Each thread within Oracle process is provided 1MB reserved stack space • Reduce to 500k without consequence on most systems: C:\ orastack tnslsnr.exe 500000 C:\ orastack oracle.exe 500000
• • • • •
Be sure to run on BOTH tnslsnr.exe and oracle.exe Stop processes before running Orastack If you apply a patch, you must re-run Orastack Make sure to test your system to be sure 500k is OK See Metalink Note 46001.1 for more information
32-bit: VLM Support
Window s Server
Memory Limits (32-bit)
For O/S, other apps
4GB Enterprise Edition:
3GB database threads/ Code
32-bit: VLM Support Memory from AWE calls Extended memory available for db
buffers via AWE calls
The amount of AWE memory allocated
used for db buffers only.
For O/S, other apps
Window on dbbuffers in
SGA minus db buffers
Oracle operating system process. Normally limited to 3GB of address space. With VLM, Oracle can get up to 12GB of database buffers.
• Use AWE with Oracle by adding initialization parameter USE_INDIRECT_DATA_BUFFERS • Use DB_BLOCK_BUFFERS instead of DB_CACHE_SIZE • With AWE, database buffer cache can be increased up to roughly 12 GB • Default value for AWE_WINDOW_MEMORY is 1 GB • See Metalink Note 225349.1 for more information
Best Practices for 32-Bit Memory
• Use Automatic Workload Repository (AWR) to monitor cache hit ratios and shared_pool stats, etc. Make sure that values are not too high • When implementing AWE be aware that using AWE disables Automatic Memory Management features (SGA_TARGET cannot be used when USE_INDIRECT_DATA_BUFFERS is set).
Specific to 64-Bit
Oracle on 64-bit Windows • Long history of supporting 64-bit databases on other platforms • Interoperability between 32-bit clients and 64-bit servers and vice versa • Improved performance, availability and scalability
64-bit: Migration • 32-bit to 64-bit upgrade process is simple – 32-bit data files are compatible with 64-bit DB – Only recreate control file if neccesary (eg file location changes)
• No need to recreate the database • Full export and import not required • Database Upgrade Assistant automates process
• Transparent migration for end-user applications – No changes required to existing client applications when running against 64bit database
64-Bit Best Practices
• Use SP2 or later for Windows Server 2003 to avoid OS performance bug. (Fixed in 2008) • Run correct 64-Bit version of Oracle for the architecture – I.e. 64-Bit Oracle for AMD or 64-Bit Oracle for Itanium. • 32-Bit Oracle db not supported on 64-Bit platforms • 32-bit Client is supported on x64 64-bit platforms • Enable Large Pages
High Availability Solutions
• HA becomes essential as databases are critical component of business • HA Goals: Minimize downtime to your company and your customers • Solutions for Windows Environments – – – –
Real Application Clusters (RAC) Oracle Fail Safe Data Guard (DG) Maximum Availability Architecture (MAA)
Fail Safe Best Practices
• One database per group – Separate production from non-production databases into different groups
• Multiple physical disks to be separated into different groups • Failback and Restart properties should be reviewed for business needs – Not all properties need to fail over http://otn.oracle.com/tech/windows/failsafe/index.html
Real Applications Clusters • Use RAC for scalability and High Availability – Add instances against same database files providing more Oracle processes and increasing number of users – Provides unique scalability on Windows that no other vendor offers
• Clustered databases supported on Windows platforms since version 7.3.4 • Oracle provides platform independent Oracle Clusterware to handle failover of services to surviving nodes • Uses Oracle’s own clustering software, it does not depend on MSCS
Oracle Data Guard • Data Guard is Oracle’s Disaster Recovery product which maintains and monitors one or more standby databases to protect enterprise data from failures, disasters, errors, and corruptions • Standby databases, which can be located across large geographic regions away from the primary database, can be switched to the production role if a problem occurs with the primary • Can use different Windows versions for primary and standby (2003 for primary, 2000 for standby) • DG is free with Enterprise Edition of RDBMS http://www.oracle.com/technology/deploy/availability/htdocs/DataGuardOv erview.html
For More Information Sessions
Wed 4:45-5:45: What’s New for Oracle Database 11g Release 2 on Windows? (Moscone South 302) Thu 10:30-11:30: Best Practices for Oracle Database and Client Deployment on Windows (Moscone South 302)
• Windows Server Center – http://otn.oracle.com/windows
Oracle Store Buy Oracle license and support online today at oracle.com/store
The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.