This chapter describes how to configure Coherence in WebLogic Server Multitenant (MT). You can use either Fusion Middleware Control (FMWC) or WLST to configure Coherence, as described in this chapter. The chapter refers to the Coherence documentation and online help for additional information as appropriate.
This chapter includes the following sections:
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.
Multitenant domains use a single shared 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 Coherence Grid ARchives (GAR) modules and common partition lifecycle operations are used to manage the life cyle of Coherence services.
Coherence setup in a multitenant domain requires the use of managed Coherence servers. You must first create a Coherence cluster for the domain and configure all managed Coherence servers to be part of the cluster. Managed Coherence servers are typically set up in tiers using WebLogic Server clusters, which allows Coherence to easily scale up or scale down as required. For details, see Administering Clusters for Oracle WebLogic Server. In addition, Coherence applications must be packaged as GAR modules in order to be deployed to a multitenant domain, for details on packaging a Coherence application as a GAR module, see Developing Oracle Coherence Applications for Oracle WebLogic Server.
Cache isolation in a multitenant domain allows a single GAR 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 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 tenant-id and meta-data when bootstrapping the Coherence services. Some cache configuration properties may be overridden with different values for each domain partition.
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 only be used when cache data is not specific to any one tenant.
Coherence applications are deployed using the common deployment tools such as Fusion Middleware Control and WLST. For detailed instructions on deploying applications in a multitenant environment, see Deploying Applications.
When deploying Coherence applications, use the Scope field to specify the domain partition to which the application is deployed. Coherence applications can be deployed to a:
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 injected into the cache configuration when a GAR module is initialized. For example, a cache in one partition may be configured to expire entries after 5 minutes and for another domain partition the cache may be configured to expire entries 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 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 Coherence caches” in the online help.
To override cache configuration properties, connect to the Weblogic 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 non-shared caches in a multitenant domain. However, a cache scheme can use scheme references in order 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 a 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 Coherence caches” in the online help.
To enable cache sharing across partitions, connect to the Weblogic 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)
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. For details about security in multitenant domains, see Configuring Security. For details about Coherence security in WebLogic Server, see Securing Oracle Coherence.
Note:Shared caches are owned by the global partition and authorization is based on the global realm.
For a detailed example of using Coherence with multitenancy, see the Managed Coherence Servers - multitenant example that is included in the WebLogic Server Code Examples.
For details about creating Coherence clusters, see Administering Clusters for Oracle WebLogic Server.
For details about packaging Coherence applications, see Developing Oracle Coherence Applications for Oracle WebLogic Server.
For details about securing Oracle Coherence in Oracle WebLogic Server, see Securing Oracle Coherence