Saturday, June 19, 2010

ADF Regions and Nested Application Modules to Improve Performance

Oracle Fusion application typically includes multiple regions and integrates smaller applications into dashboard for better user experience. Users like this approach, however we should check what are implications for technical side. Today I'm describing different approaches for ADF Regions integration and use of Nested Application Modules.

Download sample application - This sample contains multiple Oracle JDeveloper 11g PS2 applications to demonstrate integration functionality together with nested application modules usage.

You will find first application with Employees Model implementation. ADF BC Model is packaged into ADF JAR Library to reuse it inside main application:

Second application is identical to first one and implements Jobs Model functionality. It is packaged into ADF Jar Library as well:

There are two applications two integrate ADF BC Model and use Business Services inside ADF Regions. Why two applications? First integrates ADF JAR's directly into ViewController - means using Application Modules directly from ADF JAR's. Second integrates ADF JAR's into local Model project, Business Services from imported libraries are exposed through local proxy Application Module - this Application Module contains Nested Application Modules from imported libraries.

Application without Nested Application Modules (FIRST) - no Model part implementation:

Application with Nested Application Modules (SECOND) - contains local proxy Application Module, it joins Application Modules from imported libraries into Nested group:

We have two imported libraries, based on Employees and Jobs models:

FIRST application integrates Model libraries directly into ViewController, this means DataControl is available:

You can see two Data Controls available, this basically means we are using two different Application Modules. Application is deployed on WLS under regions context root path:

Now we can test FIRST application, it implements two ADF Regions based on two Application Modules from imported ADF JAR Libraries:

Type any value into Employees and Jobs regions, press Save inside Employees region:

Press Undo inside Jobs region - it works as expected, data from Jobs region is reset to original values and Employees keeps updated values. It happens because we are using two different Application Modules - transactions are managed separately:

While it works good from user perspective, if we check reserved database connections, we will see two of them:

Thats quite logical - we are using two Application Modules, both are present on current page inside of two regions. However, from performance view its not ideal - each user will use two database connections in this case.

How we can improve this and use only one connection even for two ADF Regions working with two Application Modules? We can use Nested Application Modules. When we are importing ADF JAR Libraries, local proxy Application Module can be created to join imported ones into Nested group - check SECOND application:

SECOND application imports ADF JAR libraries with Model implementation for Jobs and Employees into local Model project:

Local proxy Application Module doesn't have any View Object Instances - its empty:

But it contains Application Module Instances - Nested group of modules from imported libraries:

In Data Control we can see now only one local Application Module, it contains nested Application Modules:

Nested Application Modules bring View Object Instances from imported ADF JAR Libraries:

I'm using those View Objects from Nested Application Modules inside ADF Regions.

Important to mention, both Commit and Rollback operations are declared on local Application Module. Since imported ones are nested, Commit and Rollback operations are applied from master Application Module:

Main page contains ADF Faces Dashboard component with both regions for Jobs and Employees:

SECOND application is deployed with nestedregions context root path:

Again two ADF Regions are rendered:

We type into Employees and Jobs, press Save for Employees to commit changes:

Press Undo in Jobs region:

Uncommited data in Jobs is reverted, commited Employees changes remain:

Here is one very critical difference between ADF Region and ADF Page - even we are using Nested Application Modules and Commit operation from master Application Module - it still commits only transaction for current region (specific imported Application Module), which is great. With ADF Page it would commit changes from all Nested Application Modules at once.

Let's take a look into database connection usage, only one database connection is used now - great performance improvement:

As you can see, Nested Application Modules in combination with ADF Regions can be great performance improvement in Oracle Fusion applications.


Anonymous said...

Hi Andrejus,
Congratulation for your 2 awards.
I’m desperately looking for a solution to reduce database connections and I’ve found this post.
In my case, I want reuse the view layer also (not only the model layer).
So I would like to have page fragment and task flow inside their application:
empl.jsff and empl-flow inside EmployeesApp
jobs.jsff and jobs-flow inside JobsApp
And reuse empl-flow and jobs-flow in mainApp.
Is it possible to do that and share the same database connection while running the mainApp ?
Thanks and Regards


Andrej Baranovskij said...

Hi Nicolas,

I understand your problem. There is no standard way to achieve this in current release. I'm working on task flow tuning, same as your case, will post blog with tuning workarounds (to minimize opened connections through shared data control).


Kavin said...

Thanks, good post.

I would like to know the cons of this approach as well? Can you please share if you can think of anything obvious?

Andrej Baranovskij said...


As I'm describing, it might by limitation that transactions are managed separately. But in most cases it is advantage.

See another post on same topic:


M.Ahmed said...

great post, but When I tried to run the applications in my local machine from jdeveloper I have exception that
jdbc/HrDSDS is not found.

so I logged in
and added

Is this true I have to create data source on my local machine to test the applications or I can user the connection in jdeveloper
And How can I test the application without creating the data source

Andrej Baranovskij said...

Yes, simplest way to test is to create local data source as you did. In 11g R2 this is improved and they migrate data source automatically.


Vinitha said...


Great post. So is it like nested AM is used only to reduce the usage of DB connections. If there are any other uses please suggest as am getting pretty confused between shared and nested am.

Also the db performance that is shown thrown a chart is great . can you please guide me with the steps to achieve the same.

It would be of great help if the confusion is clarified with sample and more information. Looking forward...

Thanks and Regards,
Vinitha G

Manikanda Prabhu said...

Hi Andrejus,

Very good post.. Am also having some confusions in differentiating Shared and Nested AMs. Please give comparison of both the approaches.