Sunday, September 25, 2011

How To Speed Up Application Undeployment in JDeveloper 11g R2

There was new patch set released this week for JDeveloper 11g R2, its called (11.1.2.1.0). I had a quick look, there are still few issues left from previos release (11.1.2.0.0), but overall this new update looks better and more stable.

Update: Same applies for JDeveloper 11g R1.

This post describes issue related to long application undeployment time. Reproduced when running on embedded WLS directly from JDev. I had this issue in (11.1.2.0.0), same reproduced with (11.1.2.1.0).

Sample app is fairly basic, it contains one ADF BC AM, read-only VO and one JSF page - ADFAppADFBCSimple11R21.zip:


As per documentation chapter 9.3 Configuring Your Application Module Database Connection, 11g R2 differently than 11g R1, automatically assigns JDBC Data Source name for newly created AM - java:comp/env/jdbc/HrDSDS:


This is good, but once we need to restart application, or even stop it from JDev:


It takes in average 2 minutes to undeploy ADF app. It says - resource pool shutting down, ignoring 1 resource still in use by applications:


If we switch to JDBC URL type and provide connection name, as it was by default in 11gR1:


As we can see from the log, when connection is changed to be JDBC URL type, application is undeployed just in 2 seconds:


2 minutes vs. 2 seconds, I guess difference is obvious? :)

Let's dig deeper.

We can remove data source prefix and leave only - jdbc/HrDSDS:


This would need to define data source on WebLogic manually, when we have prefix java:comp/env/ it means JDev will create temporary data source automatically. I have defined jdbc/HrDSDS manually:


Application is undeployed fast as well, same as using JDBC URL - around 2 seconds:


Lesson learned - in 11g R2, until it will be fixed - don't use auto generated prefix name java:comp/env for data sources. Always define data sources manually on WebLogic or use JDBC URL, as it was default in 11g R1.

14 comments:

Fredy Gil said...

Thanks for the tip, It works great and fast!

marco said...

Thanks Andrejus, this was a important lesson about ADF.

Gracias Andrejus, esto fue una importante leccion acerca de ADF.

:)

Andrej Baranovskij said...

Thanks for feedback :)

Andrej Baranovskij said...

Same is true for JDev 11g R1 as well.

Andrejus

Andrew said...

Hey Andrejus,

I'm taking my first steps in WebCenter these days.
I would like to know what are "Out of the box" capabilities, especially in Web 2.0 components (WIKI, Blogs, Tags, Forums ,My Profile, etc.).
Have you ever implemented or supported a firm/company WebCenter platform focusing on social media networking?

Tnaks,

Andrew

Andrej Baranovskij said...

Yes, we have build also our own product - set of WebCenter extensions targeted for Social Networking in enterprise. We will present it this Thursday on OOW, later screencast will be uploaded to youtube - stay tuned.

If any additional questions - feel free to get touch by my email.

Andrejus

Steve Muench said...

Another solution without requiring a change to the application-scoped datasource is to set the following ADF appmodule configuration property:

jbo.doconnectionpooling=true

We also recommend its use together with the setting:

jbo.txn.disconnect_level=1

which optimizes the way that partially-fetched rowsets are manages when the JDBC connection is released back to the JDBC connection pool at the end of each request.

You might experiment to see whether your original solution or this one produces a better result, but both should work.

Andrej Baranovskij said...

Thanks Steve, I have tested and indeed setting jbo.doconnectionpooling=true and jbo.txn.disconnect_level=1 gives same good time on undeployment.

I have two questions:

1. Any reasons, why jb.doconnectionpooling=true and jbo.txn.disconnect_level=1 are not default settings?

2. What is the difference between jdbc/HrDSDS and java:comp/env/jdbc/HrDSDS naming, why we have different behavior when closing DB connections?

Didier said...

The integrated WLS was designed to shutdown the JDBC pool gracefully, and is in a loop, waiting for any applications still holding JDBC connections to finish and return them to the pool before killing them all and finishing.

Another solution is to use the Global JDBC Data Sources.
See "Note 1332498.1 - Undeploying ADF Application Takes > 60 Sec. When Using Application Level JDBC Datasource" in My Oracle Support.

Andrej Baranovskij said...

I assume its what is described in the blog - to use Global JDBC Data Source. In other words, for example - jdbc/HrDSDS, this data source should be defined manually on WebLogic.

Don't forget to uncheck Auto Generate and Synchronize weblogic-jdbc.xml Descriptor During Deployment option. Otherwise WLS will try to find application specific data source first, before using global.

Regarding resource pool for application data source - it waits in the loop with no result. As we can see from the error message - "resource pool shutting down, ignoring 1 resource still in use by applications". Even after waiting 2 minutes, connection is still reserved and it just closing pool ignoring connection in use.

Yes, it looks like at least for now - Global JDBC Data Sources are preferred way to go.

Jan Vervecken said...

Thank you Andrejus.

- about "until it will be fixed"
-- For those interested in faster redeploys and getting this fixed, if you leave a comment in JIRA issue ADFEMG-49 maybe the number of responses can help get this fixed.
at http://java.net/jira/browse/ADFEMG-49

thanks
Jan Vervecken

Anonymous said...

Very useful information. Thank you.

Same applies to Jdev 12c as I tested today.

Andrej Baranovskij said...

Yes, I noticed same in 12c. Some bugs never die :)

Andrejus

Anonymous said...

This tip just saved me a lot of time :D

Thanks!!!