Oracle Coherence applications can take full advantage of the density and operational efficiencies that are provided by Weblogic Server MT. All tenant instrumentation is automatically provided without any changes required to the application.
This chapter includes the following sections:
Multitenant domains use a single shared Oracle Coherence cluster that is available across all domain partitions. Application caches are isolated, and can also be shared, at the domain partition level. Common deployment tooling is used to deploy and manage Oracle Coherence Grid ARchive (GAR) modules and common partition lifecycle operations are used to manage the life cycle of Oracle Coherence services.
Understanding Oracle Coherence Setup in a Multitenant Domain
Oracle Coherence setup in a multitenant domain requires the use of managed Oracle Coherence servers. You must first create an Oracle Coherence cluster for the domain and configure all managed Oracle Coherence servers to be part of the cluster. Managed Oracle Coherence servers are typically set up in tiers using WebLogic Server clusters, which allows Oracle Coherence to easily scale up or scale down as required. For details, see Administering Clusters for Oracle WebLogic Server. In addition, Oracle Coherence applications must be packaged as GAR modules to be deployed to a multitenant domain. For more information about packaging an Oracle Coherence application as a GAR module, see Developing Oracle Coherence Applications for Oracle WebLogic Server.
Understanding Cache Isolation in a Multitenant Domain
Cache isolation in a multitenant domain allows a single GAR module to be deployed across multiple domain partitions and used by all tenants. Isolation is provided at the domain partition level and is transparent to the application. When a GAR module is deployed to a domain partition, a new cache service instance is created and is isolated to that domain partition. The GAR module generates the appropriate
meta-data when starting the Oracle Coherence services. Some cache configuration properties may be overridden with different values for each domain partition.
Understanding Cache Sharing
Cache sharing allows a single cache instance to be used by multiple domain partitions. Each tenant has access to the same cache. Cache sharing is enabled at the partition level and must be set for each domain partition that accesses the cache. Cache sharing is transparent to the application.
Cache sharing provides the greatest amount of cache reuse and the most efficient use of resources. However, cache sharing should be used only when cache data is not specific to any one tenant.
Oracle Coherence applications are deployed using the common deployment tools such as Fusion Middleware Control and WLST.
For more information about deploying applications in a multitenant environment, see Deploying Applications.
When deploying Oracle Coherence applications, use the Scope field to specify the domain partition to which the application is deployed. Oracle Coherence applications can be deployed to the following:
Global scope: The global scope is equivalent to a non-multitenant deployment and does not impose any cache isolation.
Resource group template: Applications are deployed to the domain partitions that are configured to use the specified resource group template. Cache instances are isolated to each domain partition.
Resource group for a partition: Applications are deployed to the partitions that are configured to use the specified resource group. Cache instances are isolated to each domain partition.
Cache configuration properties can be specified for each domain partition. Partition-specific values are inserted into the cache configuration when a GAR module is initialized. For example, a cache in one partition may be configured so that entries expire after 5 minutes and for another domain partition the cache may be configured so that entries expire after 10 minutes. In both cases, the same cache configuration file is deployed in the GAR module.
The main steps for overriding cache configuration properties are as follows:
Select a partition to edit its partition settings.
Update Oracle Coherence configuration settings by adding the property names and values to be overridden.
To override cache configuration properties using Fusion Middleware Control, see Configure domain partition Oracle Coherence caches in the online help.
To override cache configuration properties, connect to the Weblogic Server Domain MBean server and execute the
createCoherencePartitionCacheProperty operation to specify a property and the
setValue operation to enter the property value. For example:
cd('/') cd('/Partitions/MyPartition-1') cmo.createCoherencePartitionCacheConfig('MyConfig') cd('CoherencePartitionCacheConfigs/MyConfig') cmo.createCoherencePartitionCacheProperty('expiry-delay') cd('CoherencePartitionCacheProperties/expiry-delay') cmo.setValue('3600s')
Cache configuration properties can also be deleted using the
destroyCoherencePartitionCacheConfig operation. For example:
cd('/') cd('/Partitions/MyPartition-1') cmo.createCoherencePartitionCacheConfig('MyConfig') cd('CoherencePartitionCacheConfigs/MyConfig/CoherencePartitionCacheProperties/ expiry-delay') property = cmo cd('..') cmo.destroyCoherencePartitionCacheProperty(property)
Cache sharing must be explicitly set for each partition where the cache is deployed. Enabling cache sharing on a cache in one partition does not automatically share the cache for all partitions.
Note that the same cache scheme cannot be used for both shared and nonshared caches in a multitenant domain. However, a cache scheme can use scheme references to reuse the same scheme definition. For example:
<caching-scheme-mapping> <cache-mapping> <cache-name>example</cache-name> <scheme-name>ExamplesPartitioned-NonShared</scheme-name> </cache-mapping> <cache-mapping> <cache-name>example-shared</cache-name> <scheme-name>ExamplesPartitioned-Shared</scheme-name> </cache-mapping> </caching-scheme-mapping> <caching-schemes> <distributed-scheme> <scheme-name>ExamplesPartitioned-NonShared</scheme-name> <scheme-ref>ExamplesPartitionedScheme</scheme-ref> </distributed-scheme> <distributed-scheme> <scheme-name>ExamplesPartitioned-Shared</scheme-name> <scheme-ref>ExamplesPartitionedScheme</scheme-ref> </distributed-scheme> <distributed-scheme> <scheme-name>ExamplesPartitionedScheme</scheme-name> <service-name>ExamplesPartitionedCache</service-name> <backing-map-scheme> <local-scheme> <high-units>32M</high-units> <unit-calculator>binary</unit-calculator> </local-scheme> </backing-map-scheme> <autostart>true</autostart> </distributed-scheme> </caching-schemes>
The main steps for enabling cache sharing are as follows:
Select a partition to edit its partition settings.
Add an Oracle Coherence cache to the partition.
Specify that the cache is shared.
Repeat the process for each partition that shares the cache. Configuration values must be the same for each partition.
To enable cache sharing using Fusion Middleware Control, see Configure domain partition Oracle Coherence caches in the online help.
To enable cache sharing across partitions, connect to the Weblogic Server Domain MBean server and execute the
setShared operation with a
true parameter. For example:
cd('/') cd('/Partitions/MyPartition-1') cmo.createCoherencePartitionCacheConfig('MyConfig') cd('CoherencePartitionCacheConfigs/MyConfig') cmo.setShared(true) cd('/') cd('/Partitions/MyPartition-2') cmo.createCoherencePartitionCacheConfig('MyConfig') cd('CoherencePartitionCacheConfigs/MyConfig') cmo.setShared(true)
Oracle Coherence applications use the authorization features that are available with WebLogic Server. Authorization roles and policies are configured for caches and services and should be set for each partition.
Shared caches are owned by the global partition and authorization is based on the global realm.
For a detailed example of using Oracle Coherence with multitenancy, see the Managed Oracle Coherence Servers - multitenant example that is included in the WebLogic Server Code Examples. For more information about creating Oracle Coherence clusters, packaging Oracle Coherence applications, and securing Oracle Coherence in Oracle WebLogic Server, see the referenced information.