Coherence Federated Caching Overview

Introduction Coherence clusters rely on the ability to enlist multiple servers connected by a reasonably reliable network. This allows strong cache consistency guarantees — in the absence of a catastrophic failure, one can reason about state in a Coherence cluster in a similar manner to how one reasons about state in a local memory space. […]

How to configure Oracle Commerce external repository caching with Coherence

Introduction A growing trend in the e-commerce industry is the exponential growth of assets in catalogs and related assets. The fastest way to access these assets is of course the local, in-memory caching, offered by the GSA, Generic SQL Adapter.  But in-memory caching imposes its own limitations: heap size growth, increased database pressure, etc. An alternative […]

Using the 12c Coherence Adapter to access a non-transactional local cache

Executive Overview New in Oracle Fusion Middleware (FMW) 12c is the Oracle JCA Adapter for Coherence. Prior to FMW 12c, users wanting to take advantage of Coherence directly from, say, BPEL would have had to utilise a Java call-out for that purpose. Oracle Coherence is a JCache-compliant in-memory caching and data management solution for clustered […]

Memcached Adapter in Coherence 12.1.3

* Reposted with permission from Oracle Coherence Blog by Dave Felcey.   Overview Coherence 12c (12.1.3) adds support for Memcached clients to directly store data a in Coherence cluster using the Binary Memcached protocol. This post outlines how to configure the Coherence Memcached Adaptor and includes a simple PHP example to show how Memecached clients […]

Unable to See Coherence MBean in Enterprise Manager Configured for WebCenter Portal Content Presenter

Introduction After configuring Coherence Cache for WebCenter Portal Content Presenter customer was not able to see the Coherence MBeans in the Enterprise Manager. Futher investigation revealed that the issue was due to configuration in WebLogic Server. Main Article After configuring Coherence Cache for WebCenter Portal Content Presenter customer was not able to see the Coherence […]

Basic JVM Garbage Collection Tuning for Coherence

Because Coherence cache servers are built on top of Java, they must deal with the heap size limitations that arise from garbage collection (GC). This is often at odds with the intended use case for Coherence, which is to manage large amounts of data in memory. In order to fully utilize the available memory on […]

Coherence Monitoring Management in Oracle Enterprise Manager 12c – Part 1

Coherence monitoring can be challenging depending on the number of nodes and hosts. Users use Jconsole for getting a view of their Coherence applications. This is done by creating a JMX node that joins the cluster and thereby enabling monitoring. This is good to get current view. However if you are looking for metrics history […]

Optimizing content cache performance in WebCenter Portal

Introduction When integrating content with WebCenter Portal it is important to deliver the content in a performant way. WebCenter Portal can do this by leveraging Coherence cache for content integration. This will allow a faster delivery of the content and by tweaking the cache setting it will also improve performance in WebCenter Content. In this artice […]

Coherence 12.1.2 Released

In case you did not already know, Coherence version 12.1.2 was recently released.  This new version of Coherence offers a diverse of important new features.  As part of the release, the Coherence team has released a set of videos which provide an introduction to some of the new features.  Some of these videos are embedded […]

Bulk loading a Coherence cache from an Oracle Database

Recently, I’ve worked on a couple of projects that required pre-loading data from an Oracle Database table into an Oracle Coherence cache. There are many ways to accomplish this task, but what I’ve found to work well is to distribute the load processing to the Coherence grid itself. To do this, I use the Coherence Invocation Service. To get […]

Visualizing the Coherence Datagram Test

The graph above was generated from the output of the Coherence Datagram Test utility. The Coherence Datagram Test is a tool that sends and receives UDP packets between two ore more machines to evaluate the health and performance of the network between those machines. The above test was run for 100 secs on two server-class machines with […]

Configure Coherence for Oracle WebCenter Portal Framework Content Presenter Task Flow

This guide aims to give you complete configuration overview for how to configure Coherence Cache for Oracle WebCenter Portal Framework Application using the Content Presenter Task Flow.

This document is intended for WebCenter Portal Application administrators who have to improve performance by configuring Coherence cache for Content Presenter.

For more information about the Coherence Cache for Content Presenter have a look at the following link:

http://docs.oracle.com/cd/E21764_01/webcenter.1111/e12405/wcadm_documents.htm#BABHFCJH

Details

 

 

The Content Presenter and the Content Management Interoperability Service (CMIS) are delivered out of the box with in-memory Coherence cache. This cache is NOT enabled by default. You can enable it by adding the file content-coherence-cache-config.xml to the application class path of the WebCenter Portal Application. This guide describes how to configure the cache when you deploy applications based on WebCenter Portal Framework.

The Content Coherence Configuration file below uses the distributed cache mode in combination with local cache mode depending on the type of objects to be cached. Here the example Coherence cache file to use for the configuration:

<!DOCTYPE cache-config SYSTEM “cache-config.dtd”>
<cache-config>
  <caching-scheme-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.nodeUidCache.*</cache-name>
      <scheme-name>ContentNodeCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.nodePathToUidCache.*</cache-name>
      <scheme-name>ContentNodeCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.securityInfoCache.*</cache-name>
      <scheme-name>ContentNodeCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.typeNameCache.*</cache-name>
      <scheme-name>ContentTypeCaches</scheme-name>
    </cache-mapping>
   <cache-mapping>
      <cache-name>repo.ucm.typeNamesCache.*</cache-name>
      <scheme-name>ContentTypeCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>binaryCache.*</cache-name>
      <scheme-name>ContentBinaryCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.searchCriteriaCache.*</cache-name>
      <scheme-name>ContentSearchCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name> repo.ucm.indexedFieldsCache.*</cache-name>
      <scheme-name>ContentSearchCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.securityUserCache.*</cache-name>
      <scheme-name>ContentSecurityCaches</scheme-name>
    </cache-mapping>
    <cache-mapping>
      <cache-name>repo.ucm.profileTriggerValueCache.*</cache-name>
      <scheme-name>ContentProfileCaches</scheme-name>
    </cache-mapping>
  </caching-scheme-mapping>

  <caching-schemes>
    <distributed-scheme>
      <scheme-name>ContentNodeCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentNodeCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <distributed-scheme>
      <scheme-name>ContentTypeCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentTypeCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <distributed-scheme>
      <scheme-name>ContentBinaryCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentBinaryCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <distributed-scheme>
      <scheme-name>ContentSearchCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentSearchCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <distributed-scheme>
      <scheme-name>ContentSecurityCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentSecurityCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <distributed-scheme>
      <scheme-name>ContentProfileCaches</scheme-name>
      <backing-map-scheme>
        <local-scheme>
          <scheme-ref>BM_ContentProfileCaches</scheme-ref>
        </local-scheme>
      </backing-map-scheme>
      <backup-count>0</backup-count>
      <autostart>true</autostart>
    </distributed-scheme>

    <local-scheme>
      <scheme-name>BM_ContentNodeCaches</scheme-name>
      <expiry-delay>5m</expiry-delay>
      <high-units>100</high-units>
    </local-scheme>

    <local-scheme>
      <scheme-name>BM_ContentTypeCaches</scheme-name>
      <expiry-delay>30m</expiry-delay>
      <high-units>50</high-units>
    </local-scheme>

    <local-scheme>
      <scheme-name>BM_ContentBinaryCaches</scheme-name>
      <expiry-delay>5m</expiry-delay>
      <high-units>1000000</high-units>
      <unit-calculator>
        <class-scheme>
          <class-name>com.tangosol.net.cache.SimpleMemoryCalculator</class-name>
        </class-scheme>
      </unit-calculator>
    </local-scheme>

    <local-scheme>
      <scheme-name>BM_ContentSearchCaches</scheme-name>
      <expiry-delay>5m</expiry-delay>
      <high-units>50</high-units>
    </local-scheme>

   <local-scheme>
      <scheme-name>BM_ContentSecurityCaches</scheme-name>
      <expiry-delay>10m</expiry-delay>
      <high-units>50</high-units>
    </local-scheme>

   <local-scheme>
      <scheme-name>BM_ContentProfileCaches</scheme-name>
      <expiry-delay>1h</expiry-delay>
      <high-units>100</high-units>
    </local-scheme>
  </caching-schemes>
</cache-config>

 

The cache entries are described in the following documentation:

http://docs.oracle.com/cd/E21764_01/webcenter.1111/e12405/wcadm_documents.htm#BABEDDBI

NOTE: You have to put this file into the application classpath. If you use the file in the managed server class path or node manager class path it will NOT work.

 

Step by Step Installation Process

 

 

Step 1: Create JAR file with the Coherence Cache Config file

 

 

Create JAR file which contains the example content-coherence-cache-config.xml shown above. For how to create JAR files follow the tutorial from the Java documentation here:

http://docs.oracle.com/javase/tutorial/deployment/jar/build.html

You will use this JAR file to put it inside your WebCenter Portal Framework Application. As mention above this works only if this JAR file is part of the WebCenter Portal Framework Application class path.

 

Step 2: Create WebCenter Application EAR Lib folder

To put the created JAR file into the APP-INF/lib you have to update your project settings:

·From the JDeveloper WebCenter Portal Application Project click on Application->Application Properties.

 

·From the new window select Deployment. From the deployment profile select the EAR profile you want to use and then click on Edit button.

 

· From the new window select File Groups and then click on New button. From the new opened window select Packaging and type a name for the file group as shown bellow. Then click OK to add your new packaging file group. Click then OK again the save the changes.

 

·Create the APP-INF/lib folder into your project. Go to the file system where you create the WebCenter Portal Application Project as shown bellow

 

·<!–[endif]–>You have to create the APP-INF/lib folder under the src/ folder:

 

·<!–[endif]–>Inside the newly created APP-INF/lib folder you can place your JAR file with the Coherence Cache configurations.

 

·<!–[endif]–>To make sure that the file will be picked go back to JDeveloper and open the Application Properties again by clicking on Application->Application Properties and then click on Deployment. Select the EAR Profile which you used to add the Packaging File Group and click on Edit button. Inside the new window you should see that your APP-INF/lib folder is selected and inside there, there is also the JAR file you copied.

 

·<!–[endif]–>WebCenter Portal Framework Application is ready for deployment now. Redeploy your application and bounce(load your application one in an browser) to make sure that the configurations are loaded.

Step 3: Check your configuration

NOTE: You have to open your application once to make sure that the Coherence Configuration is loaded.

Make sure that you open the application once in the browser then open your <managed_server>_diagnosting.log file and search for coherence inside. If you see message like this:

[APP: AviTrustSamplePortal#V2.0] Unable to load Coherence configuration file content-coherence-cache-config.xml. Using in-memory (local) caches.

 

… then it means that your application did not find the configuration file. The reason for that is that the JAR file was not inside the application classpath. In this case you may used the Managed Server Classpath which is not working. You have to place the JAR file inside the application classpath as described above.

 

If you don’t see the message above you can go for the next step and look for the Coherence configuration inside the MBean.

To do so open your Enterprise Manager and go to the application configuration like shown bellow:

 

 

Then from the Application Deployment click on the System MBean Browser to have a look in the MBeans. Inside the MBean Tree search for the word <coherence>:

 

You should be able to see the configurations as shown above.

 

Another very good why to check if the cache works is to have a look inside the WCC request audit. It shows if queries were fired against the Content Server.

To do so login as Administrator to WCC.

 

After you login in as administrator select System Audit Information and from the Active Sections select only system and requestaudit as well as Full Verbose Tracing checkbox.

 

Click on Update button to update the configuration.

 

 

After that click from the upper right menu on View Server Output to trace the Content Presenter queries to the Content Server.

If you open a example page where the content presenter is used, like this:

 

You can see after that in the audit log the queries used by the content presenter to get the information:

 

Refresh the page by click on F5 or just the browser refresh button. There’re should be no new queries visible in the audit log anymore, since the content presenter should use the coherence cache now:

 

 

 

Step 4: Configuration for Cluster Environment

 

 

If you run your application in cluster environment you have to make sure that the coherence configuration works inside the cluster. If you have two managed servers in one cluster you can configure following parameters in the startup arguments. If Node Manager is used to start the Managed Servers, you can put the argument in the Server Start argument option.

First server:

-Dtangosol.coherence.wka1=server1.mycompany.com

-Dtangosol.coherence.wka1.port=8088

-Dtangosol.coherence.wka2= server2.mycompany.com

-Dtangosol.coherence.wka2.port=8088

-Dtangosol.coherence.localhost= server1.mycompany.com

-Dtangosol.coherence.localport=8088

 

Second server:

-Dtangosol.coherence.wka1= server1.mycompany.com

-Dtangosol.coherence.wka1.port=8088

-Dtangosol.coherence.wka2= server2.mycompany.com

-Dtangosol.coherence.wka2.port=8088

-Dtangosol.coherence.localhost= server2.mycompany.com

-Dtangosol.coherence.localport=8088

 

NOTE: If the two server are running on the same physical machine, you have to make sure that they use different ports.

 

Making Coherence play nice in your test environment

This issue has popped up a couple of times for me recently, so I thought I would do a quick post on it. When you are running a number of Fusion Middleware environments in the same IP subnet, as you … Continue reading

Using XA Transactions in Coherence-based Applications

While the costs of XA transactions are well known (e.g. increased data contention, higher latency, significant disk I/O for logging, availability challenges, etc.), in many cases they are the most attractive option for coordinating logical transactions across multiple resources.

 

There are a few common approaches when integrating Coherence into applications via the use of an application server’s transaction manager:

  1. Use of Coherence as a read-only cache, applying transactions to the underlying database (or any system of record) instead of the cache.
  2. Use of TransactionMap interface via the included resource adapter.
  3. Use of the new ACID transaction framework, introduced in Coherence 3.6.

Each of these may have significant drawbacks for certain workloads.

 

Using WKA in Large Coherence Clusters (Disabling Multicast)

Disabling hardware multicast (by configuring well-known addresses aka WKA) will place significant stress on the network. For messages that must be sent to multiple servers, rather than having a server send a single packet to the switch and having the switch broadcast that packet to the rest of the cluster, the server must send a packet to each of the other servers.

 

Using the Coherence ConcurrentMap Interface (Locking API)

For many developers using Coherence, the first place they look for concurrency control is the com.tangosol.util.ConcurrentMap interface (part of the NamedCache interface).

 

The ConcurrentMap interface includes methods for explicitly locking data. Despite the obvious appeal of a lock-based API, these methods should generally be avoided for a variety of reasons.

 

Using Queries with Coherence Write-Behind Caches

Applications that use write-behind caching and wish to query the logical entity set have the option of querying the NamedCache itself or querying the database.

 

Using Queries with Coherence Read-Through Caches

Applications that rely on partial caches of databases, and use read-through to maintain those caches, have some trade-offs if queries are required. Coherence does not support push-down queries, so queries will apply only to data that currently exists in the cache.

Using Bulk Operations with Coherence Off-Heap Storage

Some NamedCache methods (including clear(), entrySet(Filter), aggregate(Filter, …), invoke(Filter, …)) may generate large intermediate results. The size of these intermediate results may result in out-of-memory exceptions on cache servers, and in some cases on cache clients. This may be particularly problematic if out-of-memory exceptions occur on more than one server (since these operations may be cluster-wide) or if these exceptions cause additional memory use on the surviving servers as they take over partitions from the failed servers.

Coherence Data Guarantees for Data Reads – Basic Terminology

When integrating Coherence into applications, each application has its own set of requirements with respect to data integrity guarantees. Developers often describe these requirements using expressions like “avoiding dirty reads” or “making sure that updates are transactional”, but we often find that even in a small group of people, there may be a wide range of opinions as to what these terms mean. This may simply be due to a lack of familiarity, but given that Coherence sits at an intersection of several (mostly) unrelated fields, it may be a matter of conflicting vocabularies (e.g. “consistency” is similar but different in transaction processing versus multi-threaded programming).