42

Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Embed Size (px)

Citation preview

Page 1: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany
Page 2: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Bernhard DüchtingPrincipal Sales ConsultantBU Database - MigrationOracle Germany

Page 3: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Migrating C++ Applications using

OCCI

Page 4: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Agenda

Object Orientation and C++ Oracle C++ Call Interface - Overview Objects Access Summary Case Study - Using OCCI at CERN Q & A

Page 5: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Object Orientation with 9i

Native data types for collections Definition of object types, object tables

and object views Explicit table inheritance using SQL-99 Implicit inheritance using references

(REF) Overloading of object methods Online schema evolution

Page 6: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Object Orientation and C++ Header files with object definition

generated from object schema No need for separate object-relational

mapping Object cache with pre-fetch capability

for transient and persistent object management

Server-side object locking

Page 7: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Steps for Migration

Determine object model and class hierarchy Use JDeveloper 9i to map to Oracle object

schema Generate C++ header files using Oracle

Type Translater (OTT) Modify old C++ access classes as required

to work with new object type definitions Add functionality for transient and

persistent object management as required

Page 8: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

OCCI Partners and Customers A major GIS cartridge partner

– High performance object-relational and spatial data access for national surveying system

A global power transmission manufacturer– Handle complex object-retrieval for graphical

maintenance console

A global medical systems manufacturer– Replace ODBMS to manage patient image data

A national postal authority– Replacing third-party persistency framework

Page 9: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Agenda

Object Orientation and C++ Oracle C++ Call Interface - Overview Objects Access Summary Case Study - Using OCCI at CERN Q & A

Page 10: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Oracle C++ Call Interface OCCI Built on OCI

– Similar control and performance of OCI Based on Standards

– ANSI/ISO C++ Standard, including STL– Associative access API design similar to JDBC

Performance– Prefetching, client-side cache, array operations,

data buffering, thread safe API easy to use

– API design consistent with C++ programming paradigm (e.g. new operator overloaded for creating persistent objects)

Page 11: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

OCCI Basics Setup of Environment and Connection Executing SQL Statement

– SQL statement– Prepared SQL statement with bind variables– Stored procedure

Executing SQL Query– Return multiple rows into result set– Use prefetching for performance

Seamless support of Oracle datatypes– varchar2 mapped to string, – collection mapped to vector STL

Page 12: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

OCCI Advanced Features Connection Pooling

– Improves scalability by multiplexing many logical connections over few physical connections

– Optimal usage of physical connection resource– Connection pool shrinks and grows on demand

Thread Safety– OCCI handles mutexed access to shared

resources

Array Operations– Insert/update multiple rows – Fetch multiple rows in one round-trip

Page 13: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Environment *env=Environment::createEnvironment(Environment::OBJECT);

RegisterMappings(env);

Connection *conn=env->createConnection(“scott”,”tiger”,””);

Statement *stmt=conn->createStatement();

ResultSet *resultSet=stmt->executeQuery(“select ref(t) from atable t where n=0”);

if (ResultSet::DATA_AVAILABLE == resultSet->next()) {

Ref<mytype> ref=resultSet->getRef(1);

}

conn->commit();

stmt->closeResultSet(resultSet);

conn->terminateConnection(conn);

Environment::terminateEnvironment(env);

create/modify/delete objects

Example Session

Page 14: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Agenda

Object Orientation and C++ Oracle C++ Call Interface - Overview Objects Access Summary Case Study - Using OCCI at CERN Q & A

Page 15: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

OCCI Object Features

Transparent access of database objects as C++ instances

Navigation of objects as simple as de-referencing smart-pointers

Client-side caching of C++ objects Supports all 9i object features including

inheritance Oracle Type Translator (OTT)

– Maps object types to C++ interface classes

Page 16: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Client-side Object Cache

Memory Buffer for Objects– Transparent lookup and memory management

support – Stores and tracks objects fetched from server to

client side– Maintains references– Created when OCCI environment is initialized in

object mode Benefits

– Reduces client/server round-trips– Object-level locking

Page 17: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Accessing Objects

Unique Object Identifier OID Navigational Interface

– No SQL – Navigate using object references (REF)– Create/access/lock/delete/flush/commit

Associative Interface – Use SQL or PL/SQL– Data buffers, no cost of transporting data

to client

Page 18: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Representing ObjectsCREATE TYPE ADDRESS AS OBJECT ( state CHAR(2), zip CHAR(2));

OTT generates:class ADDRESS : public PObject { // OCCI pre-defined classprotected : string state; string zip;public : void *operator new(size_t size); // create a transient

instance void *operator new(size_t size, Connection *conn,

string& table); // create a persistent instance}

Page 19: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Working with Objects I

Create new object– Use new operator– Transient or persistent objects

Fetch object from server– Pin object in cache using REF– Fetch object by value

Navigate to object– Use pinned object to traverse hierarchy– Only with referenceable objects

Page 20: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Working with Objects II

Modify object– Make changes in C++ application– Mark persistent object as dirty

Flush changes to server Commit transaction

– Includes flushing dirty objects

Page 21: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Oracle Object Cache

REF

Client side cache Server buffer cache

Pin

Network

flush

load

Page 22: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Agenda

Object Orientation and C++ Oracle C++ Call Interface - Overview Objects Access Summary Case Study - Using OCCI at CERN Q & A

Page 23: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Summary I

Oracle C++ Call Interface OCCI– Simple and easy– High-performance and Scalable API– Comprehensive support of Oracle

Database features– Ideal choice for implementing high

performance mid-tier applications– 9i Release 2 focus on performance

Page 24: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Summary II

Easy migration of C++ applications– Determine UML class model– Import into Jdeveloper 9i– Re-model as required– Generate Oracle 9i object schema– Generate C++ header files with OTT– Modify C++ persistency classes as

required

Page 25: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Agenda

Object Orientation and C++ Oracle C++ Call Interface - Overview Objects Access Summary Case Study - Using OCCI at CERN Q & A

Page 26: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

C A S E S T U D Y

Using OCCI at CERN

Page 27: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Overview

Brief introduction to CERN & LHC– Huge data volumes, long lifetime, Use of OO

Extensive experience with databases– Oracle since 1982; ODBMS since 1995

Migration of existing applications– Complex C++ programs; – Up to 1000 classes;– Many KLOC - MLOC

Page 28: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

CERN – European Organization for Nuclear Research

Page 29: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

The LHC Machine

Page 30: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

RAW

ESD

AOD

TAG

randomseq.

1PB/yr (1PB/s prior to reduction!)

100TB/yr

10TB/yr

1TB/yr

Data

Users

Tier0

Tier1

Page 31: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Overview

Brief introduction to CERN & LHC– Huge data volumes, long lifetime, OO

Extensive experience with databases– Oracle since 1982; ODBMS since 1995

Migration of existing applications– Complex C++ programs; – Up to 1000 classes;– Many KLOC - MLOC

Page 32: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

CERN & Databases

Oracle brought in for construction of previous accelerator

– 1982; LEP – 27km ring 100m underground– Now pervasive through-out work of lab

Early 1990s: move to object orientated approach for “physics applications”

– Extensive experience with Object Databases– Until end 2001, baseline choice for multi-PB

requirements of LHC– Production experience with ODBMS up to ~100TB

cf SLAC/BaBar 500TB system Requirement for LHC: 100PB system (all

data)

Page 33: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Overview

Brief introduction to CERN & LHC– Huge data volumes, long lifetime, OO

Extensive experience with databases– Oracle since 1982; ODBMS since 1995

Migration of existing applications– Complex C++ programs; – Up to 1000 classes;– Many KLOC – MLOC– Exploit associative and navigational

access

Page 34: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

OCCI / OTT Functionality

CERN has worked closely with Oracle since prior to Oracle 9i announcement on OCCI/OTT functionality, interfaces, implementation etc

Active partner in 9iR1 & 9iR2 Beta program

Happy to confirm that required functionality & product stability are available in 9iR2

Page 35: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Migration of Existing Apps (I) Detector Conditions Database

– Previously implemented on ODBMS– Same user interface re-implemented using OCCI

Client based on associative accessNo changes to user code! (Except connect string)

– Complete re-design of underlying data model Implemented using pure relational modelUses partitioned tables; materialized views;

stored procedures; indexes; …– One of several applications for production 9iRAC service

being setup at CERN Other similar applications foreseen

– Grid replica catalogue, production control DB, …

Page 36: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Migration of Existing Apps (II)

Take existing large C++ application Strip out ODBMS-based persistency layer Replace with OCCI using navigational

access Strong requirements from both user &

developer point of view: C++ Developer:– No change to object

model & classes

User:– No change to

application

Page 37: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

CMS Offline Software – its big!

R .W ilk in s o nD e p u ty

O b je c t P e r s is ta n c y

L .S ilv e s tr isD e p u ty

T e s tb e a m s

V .I n n o c e n teA r c h ite c t

V .I n n o c e n teF r a m e w o r k

V .I n n o c e n teU tilit ie s

T .C o xM u o n e n d c a p

A .V ite lliM u o n b a r r e l

F .B e h n e rC a lo r im e tr y

L .T a y lo rV is u a liz a t io n

E .M e s c h iT r ig g e r

L .S ilv e s tr isT e s tb e a m

C .S e e zE le c tr o n P G

U .G a s p a r in iM u o n P G

T .T o d o r o vT r a c k e r

S .W y n h o ffG e n e r a to r s

A .C a n e rb /ta u P G

S .E n oJ e t P G

S .W y n h o ffE x a m p le s

T .T o d o r o vC o m m o n D e t

S u b -S y s te m C o o r d in a to r s

C .W illia m sL ib r a r ia n

J -P .W e llis c hS W P r o c e s s M a n a g e r

D .S t ic k la n dP r o je c t M a n a g e r

Page 38: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Functionality tests

(I) Tests of basic components Simple objects Compound objects

– Contain other user types as attributes

Inheritance Composition by reference Collections by value & reference(II) Full object models Exploits all above features Stresses client-side object cache & navigation

Page 39: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

CMS Migration

Independent module developed to handle DB interface – Oracle or ODBMS

Modification of the application and the implementation of the independent module totaled several hundreds of lines of code

No other code was modified! From user application level … users are

not aware of the change

Page 40: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

Conclusions

OCCI offers powerful persistency mechanisms for C++ applications

– Both associative & navigational access supported

Full power of database still available– Significant benefit over conventional ODBMS

Migration of complex applications proven– Achieved with no change to user code

Page 41: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany

AQ&Q U E S T I O N SQ U E S T I O N SA N S W E R SA N S W E R S

Page 42: Bernhard Düchting Principal Sales Consultant BU Database - Migration Oracle Germany