Presentation is loading. Please wait.

Presentation is loading. Please wait.

Performance/Scalability with JDBC, UCP & Oracle Database 12c

Similar presentations


Presentation on theme: "Performance/Scalability with JDBC, UCP & Oracle Database 12c"— Presentation transcript:

1

2 Performance/Scalability with JDBC, UCP & Oracle Database 12c
Nirmala Sundarappa Principal Product Manager & Douglas Surber Consulting Member Technical Staff Oracle JDBC & UCP October 2nd, 2014 This is a Title Slide with Picture slide ideal for including a picture with a brief title, subtitle and presenter information. To customize this slide with your own picture: Right-click the slide area and choose Format Background from the pop-up menu. From the Fill menu, click Picture and texture fill. Under Insert from: click File. Locate your new picture and click Insert. To copy the Customized Background from Another Presentation on PC Click New Slide from the Home tab's Slides group and select Reuse Slides. Click Browse in the Reuse Slides panel and select Browse Files. Double-click the PowerPoint presentation that contains the background you wish to copy. Check Keep Source Formatting and click the slide that contains the background you want. Click the left-hand slide preview to which you wish to apply the new master layout. Apply New Layout (Important): Right-click any selected slide, point to Layout, and click the slide containing the desired layout from the layout gallery. Delete any unwanted slides or duplicates. To copy the Customized Background from Another Presentation on Mac Click New Slide from the Home tab's Slides group and select Insert Slides from Other Presentation… Navigate to the PowerPoint presentation file that contains the background you wish to copy. Double-click or press Insert. This prompts the Slide Finder dialogue box. Make sure Keep design of original slides is unchecked and click the slide(s) that contains the background you want. Hold Shift key to select multiple slides. Apply New Layout (Important): Click Layout from the Home tab's Slides group, and click the slide containing the desired layout from the layout gallery. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. |

3 This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template. One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy To learn more about this policy, For internal communication, Safe Harbor Statements are not required. However, there is an applicable disclaimer (Exhibit E) that should be used, found in the Oracle Revenue Recognition Policy for Future Product Communications. Copy and paste this link into a web browser, to find out more information.   For all external communications such as press release, roadmaps, PowerPoint presentations, Safe Harbor Statements are required. You can refer to the link mentioned above to find out additional information/disclaimers required depending on your audience.

4 Program Agenda 1 Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions 2 3 4 5 6

5 Program Agenda 1 Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions

6 Calls for a Connection Strategy
Creating a DB connection is an expensive database operation Spawn O/S process, network connection, several roundtrips Associated database authentication and session creation Database Connections are expensive to tear down! Repeated Connection/Disconnection can be a huge scaling issue Calls for a Connection Strategy

7 Connection Management Strategy
Client Side Connection Pool; Frequent short term connection usage Use Universal Connection Pool (UCP) Very large scale deployment Use Database Resident Connection Pool Single Instance and multiple databases Use Multi-tenant Database Multiple instances, single database scenario RAC Architecture

8 Planned Maintenance Development Steps
Universal Connection Pool (UCP) Most convenient and works with most of the application containers such as Weblogic, Tomcat, Websphere, JBOSS etc., Built-in Failover mechanisms which makes it easier to use with RAC, RAC one etc., PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource(); … Connection conn = pds.getConnection(); Set the below UCP properties for better performance (1) Each 12c DB transaction is associated with a logical transaction ID (LTXID) (2) The main and only purpose of LTXIDs is to help make a reliable determination of the outcome of the last COMMIT statement (see Transaction Guard) (3) LTXIDs are issued by the RDBMS at the beginning of each transaction and changed only by when the transaction is committed or rolled back. UCP Properties Description setInitialPoolSize(), setMinPoolSize(), setMaxPoolSize() Set the Pool size based on your application setTimeToLiveConnectionTimeout() , setAbandonConnectionTimeout() Set the Connection Timeout appropriately setMaxStatements() Enable Statement Caching

9 Very Large Scale Deployment Database Resident Connection Pool (DRCP)
Problem to Solve: eCommerce-style deployment => thousands of mid- tiers, each with it’s own client-side pool Database Resident Connection Pool (DRCP) Thousands of clients requiring database server session for a short period of time Applications mostly have same DB credentials & have identical session settings Specify (SERVER=POOLED) in short URL to enable DRCP Example: Overwhlem the database Only 5 – 10% connbections in use => waste of memory and system resources

10 RAC for Scalability RAC, RAC one customers
New Retry while service is unavailable alias = (DESCRIPTION_LIST= (LOAD_BALANCE=off) (FAILOVER=on) (DESCRIPTION=(CONNECT_TIMEOUT=90)(TRANSPORT_CONNECT_TIMEOUT=10)(RETRY_COUNT=10)(RETRY_DELAY=3) (ADDRESS_LIST= (LOAD_BALANCE=on) (ADDRESS=(PROTOCOL=TCP)(HOST=RAC-scan)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=gold))) (DESCRIPTION=(CONNECT_TIMEOUT=90)(TRANSPORT_CONNECT_TIMEOUT=10)(RETRY_COUNT=10)(RETRY_DELAY=10) (ADDRESS=(PROTOCOL=TCP)(HOST= DG-scan)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=gold)))) Connect time Load Balancing Safe for logon storms Balance IP’s in Scan Talk about Connect Time Load Balancing Vs Run time Load Balancing. The above URL is for customers using RAC, RAC One etc., Talk about the LOAD_BALANCE = ON and how it does the load balancing between the cluster

11 Program Agenda Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions 2

12 Hard Parses About Hard Parse
Parse structure and Execution Plan is thrown out when the statement is closed Problems to solve Causes library cache latch contention Causes shared pool contention Causes scalability issues Very bad on the server Solution Avoid Hard Parsing using Prepared Statement & Bind Variables Reduces hard parses on the server Reduces risk of SQL Injection: Potential Security issues.

13 Hard Parses An Example Instead of: Change to:
String query = "SELECT EMPLOYEE_ID, LAST_NAME, SALARY FROM "+"EMPLOYEES WHERE EMPLOYEE_ID = " generateNumber(MIN_EMPLOYEE_ID, MAX_EMPLOYEE_ID); pstmt = connection.prepareStatement(query); rs = pstmt.executeQuery(); Change to: String query = "SELECT EMPLOYEE_ID, LAST_NAME, SALARY FROM "+"EMPLOYEES WHERE EMPLOYEE_ID = ?"; pstmt = connection.prepareStatement(query); pstmt.setInt(1, n); rs = pstmt.executeQuery();

14 Soft Parses About Soft Parse
Parse structure and Execution Plan are saved and re-used. Session executes a statement that exists in shared pool Creates session specific cursor context Metadata processing Problems to solve Though light weight, can take more time Solution Enable Statement caching oracleDataSource.setImplicit CachingEnabled(true) Choose the correct cache size to best utilize the memory connection.setStatementCac heSize(10);

15 Program Agenda Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions 3

16 Large Objects (LOBs) LOB API Data API
Recommended for offset based access Use for large LOBs (MBs) Data API Handle LOBs like LONG or LONG RAW columns Recommended for small LOBs No extra roundtrips Oracle Database 11g Improvements for LOBs BASIC LOBs: Tune SDU & Use PreFetching SECUREFILES LOBs: Vectored I/O (a.k.a. Zero Copy network transfer)

17 Program Agenda Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions 4

18 Result Set Caching Shared across multiple connections from the same Data Source in the middle tier Faster access to frequently queried data Some of the benchmarks showed 3x improvement Server side configuration to enable Result Set Caching RESULT_CACHE_MAX_SIZE – Should be set to 0 RESULT_CACHE_REMOTE_EXPIRATION – Specifies expiration time (in minutes) for a result in the server result cache

19 Result Set Caching Problems to Solve
Avoid Wasteful Re-execution Faster access to frequently queried data Some of the benchmarks showed 3x improvement Server side configuration to enable Result Set Caching RESULT_CACHE_MAX_SIZE – Should be set to 0 RESULT_CACHE_REMOTE_EXPIRATION – Specifies expiration time (in minutes) for a result in the server result cache

20 Program Agenda Connections Hard and Soft Parses LOB Operations Result Set Cache Array Operations/Stored Procedures Questions 5

21 Stored Procedures Best Practices
Bundle multiple SQL statements in one call Use anonymous blocks or stored procedures Eliminates roundtrips to database Eliminates moving data between database and client Can improve performance dramatically Monitor roundtrips and bytes transferred stats High values may indicate optimization opportunities Oracle furnishes Java and PL/SQL Stored Procedures

22 Questions Questions ???

23

24

25


Download ppt "Performance/Scalability with JDBC, UCP & Oracle Database 12c"

Similar presentations


Ads by Google