OCI migration and performance


We recently moved our internal database to another server and instead of changing all the applications to point to the new server we converted all our applications from thin connection to Oracle OCI driver. The figure above shows the difference.

In OCI you refer to the database alias and not the physical machine + port + SID and hence you are protected from changes to the database physical server (if the database moves to a different server). The performance is much better too.

Also, during the change we switched to using the DBCP connection pooling which can be easily configured the the context.xml for Struts as

< Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="username"
password="password"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://example.com:1234/myDB"
maxWait="1000"
removeAbandoned="true"
maxActive="30"
maxIdle="10"
removeAbandonedTimeout="60"
logAbandoned="true"/>

Datasource can be obtained in the code using:-

try {
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/postgres");
} catch( NamingException ne ) {
throw new RuntimeException( "Unable to aquire data source", ne );
}

Our applications were zooming after the upgrade…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s