View
225
Download
0
Category
Preview:
Citation preview
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Best Practices for Performance Part 2.NET and Oracle Database
Alex KehChristian ShayProduct ManagersServer TechnologiesSeptember 19, 2016
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Caching
SQL Tuning Advisor
Oracle Performance Monitor
Q+A
1
2
3
4
2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
CachingODP.NET
3
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Desirable Cache Characteristics
• Fast performance
• Easy to use/setup
• Minimize runtime resource usage
– Scalable for both client and server
• Up to date, accurate results
4
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Better Caching Solutions
• DB responsible for change notification
– DB server = the one source of truth
• Overcomes typical disadvantages
– Network traffic – more throughput• Only generates traffic if database change occurs
– Higher scalability• Only updates if change occurs and data is read
– Timing – greater accuracy• As soon as change occurs, clients receive acknowledgement
5
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle .NET Caching Solutions
• Oracle .NET client-side DB caches
– Client Result Cache
– Continuous Query Notification (CQN) – customizable cache
– TimesTen In-Memory Database
• Automatically updates/alerts client cache upon server changes
• Each meets separate caching requirements
• Server-side caches can be used with .NET
– DB In-Memory option, server result cache, etc.
6
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Client Result Cache
• Automatically updating query result set cache
• Benefits
– Easy to use• No code changes required
– Snapshot consistent• Cache refreshes without user intervention
– More scalability and performance• Data retrieval from client, rather than server
• No additional round trips
7
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Client Result Cache Updates
1. Upon data change, client receives change notification on subsequent round trip (or max lag)
– Invalidation notifications piggyback on existing client round trips
– No changes to the cache results yet
2. Cache waits for next read to refresh results– No unnecessary DB traffic
– Defers update as late as possible
• Cache entries do not timeout
– Least Recent Used algorithm
8
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
D E M O N S T R A T I O N
Client Result Cache
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Client Result Cache
• To use cache results, the following must match
– SQL text
– Bind values
– Session settings
• Different sessions with same user settings share cache results
– Must exist in same client process
• Different users do not share the same result sets
• One cache per machine per client process
How It Caches
10
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Continuous Query Notification (CQN)
• Programmatic control over cache notifications and updates
• Also known as Database Change Notification
• Benefits over Client Result Cache
– More control over how cache behavior• What if multiple DB users access the same results?
• What if only a subset of the cached data is required?
• How long should a query be cached?
• Do I want additional logic executed when the cache is refreshed?
• Requires significant customization
– CQN provides cache infrastructure
More Control Over Cache Behavior
11
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Notification
Queue
Application
Listener
OracleCommand
OracleDependency
Data Dictionary
OnChange
Add Dependency
Execute()
Notification Request
TABLE
Data Change
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
D E M O N S T R A T I O N
CQN
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
When to Use These Caches
• Good use cases
– Few and mostly read-only tables
– Few rows updated for each table
– Replace app logic that checks for updates to ensure user has most up to date data
• Bad use case
– Do not use it for constantly changing data
Client Result Cache and CQN
14
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle TimesTen In-Memory Database
• Fully featured relational database
• Oracle compatible SQL and PL/SQL
• Persistent and durable
– Transactions with ACID properties
– Flexible options for durability
• Exceptional performance– Instantaneous response time, high throughput, embeddable
• ODP.NET TimesTen provider for TimesTen DB
– Same ODP.NET APIs
Memory-Optimized Relational Database
15
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Performance Analyzer and SQL Tuning AdvisorOracle Developer Tools for Visual Studio
16
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor
• Included with Oracle Developer Tools for Visual Studio
• Use when designing new SQL statements
• Tune ad-hoc SQL statements in Query Window
• Tune bad SQL found by Oracle Performance Analyzer
• Use if SQL is performing poorly under load
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
SQL Tuning Advisor
• Requirements– ADVISOR privilege
– Oracle Database license for Oracle Diagnostic Pack
– Oracle Database license for the Oracle Tuning Pack
• How to run:– Oracle Query Window “Tune SQL” button
– Oracle Performance Monitor – Tune SQL button
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
D E M O N S T R A T I O N
SQL Tuning Advisor
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Performance Analyzer
• Included with Oracle Developer Tools for Visual Studio
• Detects performance issues in an application’s use of the database under load
• Requirements– SYSDBA
– Oracle Database license for Oracle Diagnostic Pack
• Can be use during testing
• Can be also used on production applications
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Oracle Performance Analyzer
• Simple to use– Run your application
– Enter amount of time to analyze
– Press Start to start timer
– Sufficient “database time” required to get results
– View findings and actions
– Implement recommended actions
– Run Oracle Performance Analyzer again until no remaining issues
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
D E M O N S T R A T I O N
Performance Analyzer
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Additional Oracle .NET Resources
OTNotn.oracle.com/dotnet
Twittertwitter.com/OracleDOTNET
YouTubeyoutube.com/OracleDOTNETTeam
Emailalex.keh@oracle.com and christian.shay@oracle.com
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Upcoming .NET Sessions
• Meet the Oracle Programming and Scripting Experts – Tuesday – 6:15 PM Moscone South - 310
• Best Practices for Performance Part 2: .NET and Oracle Database– Thursday- 10:45 AM Marriott Marquis - Salon 10/11
• PL/SQL Programming for .NET Developers: Tips, Tricks, and Debugging– Thursday – 12:00 PM Marriott Marquis - Salon 10/11
• What’s New for .NET Developers in Oracle Database
– Thursday – 1:15 PM Park Central – Concordia
• Best Practices for High Availability: .NET and Oracle Database
– Thursday – 2:30 PM Park Central – Concordia
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Q&A
25
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
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.
26
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | 27
Priv microphone stops working
Recommended