Showing posts with label Coherence. Show all posts
Showing posts with label Coherence. Show all posts

Monday, February 9, 2015

MAF 2.1 Alta Mobile UI and Oracle Mobile Suite

This post is about Alta Mobile UI and MAF 2.1. I was using Oracle Work Better mobile application as a reference, along with Alta Mobile UI Design Guidelines. This is based on my previous posts about Oracle Mobile Suite and MAF 2.1 integration, read more here - Oracle Mobile Suite - Web Service Performance Optimisation with Result Caching. You could also use Alta UI 12c with regular ADF Web applications, check more here - Custom ADF Application with New ADF 12c Alta UI.

Sample application - MobileServiceBusApp_v5.zip (contains ADF BC SOAP Web Service, Oracle Mobile Suite SOAP to REST transformation and MAF 2.1 application with Alta Mobile UI) implements a dashboard. Component to visualise amounts and values comes out of the box with MAF (iPad view):


User could open a springboard and select Employees option in the sample application:


Here we can search for employees by first name/last name and bring results as a list:


Optionally user could switch to cards view, to display the same results in different way:


You could click on employee icon - this will load details screen and bring additional info:


Steven King is a manager, he manages Executive department and there are two team members reporting to him. Compensation graph can be displayed for team members:


A list of team members is displayed in the third tab:


There is MAF 2.1 Deck component in Employees search page, it allows to switch between a list and cards view:


Employee details page is rendered with a help of MAF 2.1 Deck component as well, along with Select Button component to display tab UI and navigate between Detail, Compensation and Team sections:


You could check how these pages are implemented in the sample app provided above.

Tuesday, February 3, 2015

Oracle Mobile Suite - Web Service Performance Optimisation with Result Caching

One of the main advantages of Oracle Mobile Suite - Service Bus and SOAP/REST web service transformation (more here - Oracle Mobile Suite Service Bus REST and ADF BC SOAP). In addition you will get very nice performance improvement, there is out of the box caching for Web Service resultset with Coherence. I'm going to demonstrate how it works, all out of the box - really simple.

You could define caching for external service (ADF BC SOAP web service in my case), just edit service definition. This is our business service running on WebLogic backend, where actual processing happens. Naturally we would like to eliminate duplicate calls and retrieve previous resultsets from cache stored in Service Bus layer:


Wizard allows to enable result caching by cache token expression. In my case, nameVar is a variable from ADF BC SOAP web service, findEmployees method. You could use a wizard to construct expression. On runtime it will cache resultsets for all the requests according to specified expression. Basically it will cache all invocations of findEmployees method and will track cached data by nameVar parameter value. You could specify cache expiration time, if data is updated more often, expiration time should be shorter. Expiration time even can be dynamic, taken from the request variable:


That't is - this was really simple. All Coherence complexity is hidden and you don't need to worry about it.

I will be running MAF application to perform a test. Here I'm searching by value - th:


If we would check WebLogic log, where ADF BC SOAP web service is deployed, we could see the SQL query was executed with nameVar=th (as per search request in MAF application screen):


Let's run a different query now, search for nameVar=ew:


Again repeat previous search with nameVar=th, there should be query executed on WebLogic server with ADF BC SOAP web service, result should be taken from cache stored in Service Bus (as directed per performance optimization tuning above):


Indeed there was no SQL query executed for nameVar=th this time, data was taken from cache - this is great performance optimisation:


Download sample application (it contains ADF BC SOAP web service, Service Bus and MAF implementations) - MobileServiceBusApp_v4.zip.

Sunday, February 17, 2013

Oracle Coherence for ADF BC - Performance Test

As you already know (Oracle Coherence Integration and ADF BC Programmatic VO) - Oracle Coherence can be integrated relatively easy into ADF BC and can help to improve ADF BC runtime performance for cached data. This is true, but it was interesting to do a quick research and check in practice - how much optimization Coherence caching gives for ADF BC application. I was using fairly simple application (ADFCoherenceApp_v2.zip) from my previous Coherence post (mentioned above). This application comes with two exactly same screens - one is based on regular SQL View Object, another is based on programmatic Coherence enabled View Object. I was running identical JMeter stress test for both screens.

Here you can download JMeter stress test scripts:

1. ADF screen with regular SQL View Object - AMTestDefault.jmx

2. ADF screen with programmatic Coherence enabled View Object - AMTestCoherence.jmx

Scripts are configured to run 50 parallel threads, 1850 requests in total. Recorded script actions - use Next, Last, First and Previous buttons - navigate through rowset. Scroll down/up and select rows in af:table component:


I executed 30 runs for each of the screens - default SQL VO and Coherence cache based VO. Average request execution result for both screens: 1.34 seconds for Coherence cache VO and 1.62 seconds for SQL VO. This is logical result, because data is cached with Coherence and retrieved directly from the cache for each of the 50 users. While with SQL based VO, data is retrieved from DB each time new user (50 in total) opens a new session:


This shows - to retrieve data from Coherence cache is faster comparing to retrieving the same data from DB with SQL. Sample application is fairly basic, but the same tendency will be reflected in production enterprise systems. Of course we can't use Coherence for every use case, but for such use cases where fast data access is required - Coherence will be great help.

Below I show you samples from the stress test.

Coherence cache based VO:



SQL based VO:



Lessons learned: runtime performance is much faster when using programmatic VO as a wrapper to access data from Coherence cache, comparing to POJO bean (Data Access Optimization in ADF with Oracle Coherence) acting as a wrapper to access Coherence cache. This seems because ADF BC Data Control runtime performance is faster comparing to POJO Data Control performance - this is on my list to verify with another JMeter stress test.

Thursday, February 14, 2013

Oracle Coherence Integration and ADF BC Programmatic VO

Based on blog reader request for my previous post - Data Access Optimization in ADF with Oracle Coherence, I will describe sample application where Oracle Coherence caching functionality is integrated directly into ADF BC. This gives couple of benefits - single Model structure implementation with ADF BC for Coherence based data sources and non Coherence. ADF BC Data Control runtime performance is better comparing to POJO Data Control.

Here you can download sample application - ADFCoherenceApp_v2.zip. Application implements Employee serializable class optimized for Coherence caching - based on Coherence PortableObject:


This class is supported with Coherence POF for optimized serialization:


Sample application contains POF configuration for Employees class:


Main configuration file for Coherence contains reference related to POF configuration:


Coherence cache is constructed only one time per all user sessions from ADF BC AM prepareSession() method. This method is invoked by ADF BC framework automatically, during AM preparation and before any data is shown on UI - perfect place to populate Coherence cache:


Data from Coherence cache is displayed on ADF Faces UI through programmatic ADF BC VO. See another sample for ADF BC programmatic VO here - Fusion Middleware 11g Security - Retrieve Security Groups from ADF 11g. Rows for this programmatic VO are populated from Coherence cache, already initialized in overriden prepareSession() method:


Every attribute for each row is populated from the cache:


Application is started - Coherence cache is populated during AM initialization:


Data is loaded on ADF Faces UI from Coherence cache through programmatic ADF BC VO:


Sunday, January 27, 2013

Data Access Optimization in ADF with Oracle Coherence

ADF BC is accessing database each time user is loading new page or accessing new Web session. Once data is retrieved, data is cached usually for the duration of the current session. If there are lots of users accessing the same data  - we may encounter performance bottleneck in querying database each time for new user access. To optimize this, we can use Oracle Coherence - data will be loaded and cached in the middle-tier, it will be served for all users without accessing database each time. Data in Coherence cache can be updated, removed and synchronized back with the database - but this is out of scope for current post. I would like to explain today how to apply Coherence for ADF project in really simple and understandable way - it can be as a startup for your more advanced research and performance tuning.

Here you can download ADF (11g R2) sample application with Coherence cache enabled - ADFCoherenceApp.zip. This sample is quite straightforward - it implements ADF BC for Employees database table:


There are two different UI's implemented in ViewController - one is standard based on ADF BC Data Control, another one is based on POJO Data Control retrieving data from Coherence Cache. In the next post I plan to stress test both task flows with JMeter and to see performance boost by Coherence:


Coherence task flow contains default Method Call activity. Method Call is responsible to load Employees data from ADF BC into Coherence cache. Once data will be loaded to Coherence cache, ADF BC will not be accessed by any subsequent session, data always will be retrieved from Coherence cache:


You can see that from the source code of initialization Method call activity. ADF BC is accessed if only Coherence cache size is equal zero - Employees VO is queried and Coherence cache is populated:


I will describe now how to setup Coherence library for ADF application (I recommend to read this article on OTN - Creating Oracle Coherence Caches in Oracle JDeveloper). Firstly add Coherence Runtime library to your project:


Once library is added - coherence-cache-config.xml file will be created automatically. Config file is empty by default, I have defined basic cache config for EmployeesCache used in this sample app:


In the project Run options, add Java Option to point to coherence-cache-config.xml file (you will need to modify this path in the sample application, according to your environment):


POJO class exposed as Data Control contains a method where we are accessing Coherence cache - EmployeesCache and populating Data Control:


Data collection is loaded on ADF UI as a table:


During first access to Coherence cache - Coherence server is starting, we are reading data from ADF BC and populating it into cache:


This happens in ADF task flow (for Coherence) initialization  Method Call. When fragment is loaded, data already exists in the cache:


Other users who are accessing the same data, will retrieve it directly from Coherence cache. ADF BC Application Module will not be even created and no database access will be established - data will be loaded directly from the cache - this should optimize page load time significantly: