Coherence Cache Prune Rate

Assume cache is configured with high-unit, LRU eviction policy and default low-unit which is 75% of high-unit.
Cache prune will start when cache size reaches high-unit with LRU eviction policy until it reaches 75% of high-unit.
I know there is Coherence JMX metric named CachePrunes.
My question is how do i find out the rate of cache prune? In other word, how many entries are being prunes per second?
Assume cache is full (at max high-unit) Is it possible that the rate of creating new cache entries is faster than the rate of cache prune and cache can still overflow?
Thanks in advance.

Hi
LSV wrote:
And also it is not right to draw parallels between the rate of creating new cache entries and the rate of cache prune. They are two independent operation.No that is not correct - eviction happens in response to another action on the cache, so puts and evictions are not independent. For example, if you have single storage node with a cache with high-units=10 and low-units=9 and the size of the cache on the node is 10 then each time you do a put one entry will be evicted as the put would take the size to 11 so the cache is evicted down to 9 and the new entry added so back up to 10. So the eviction rate, however you might want to measure that, will be equal to the rate of adding new entries.
What makes the rate a little more difficult to calculate is that the high-units figure is per-storage-node so depending on how evenly your keys get distributed among the storage nodes in your cluster you might get one node evicting entries before other nodes. If you have a high-units of 10 and 400 storage nodes then the cache could get to 4000 entries before eviction starts although it is more likely that some node start evicting well before 4000 as they reach 10 entries well before other nodes - if you get what I mean.
bitcosmo wrote:
Interesting.. you are suggesting that cache prune is blocking operation such that all put operations will be blocked until cache is pruned to low-units.Not quite, I am pretty sure not all put operations are blocked, I suppose a quick test would verify that. I am pretty sure only the put operation that causes the eviction will be blocked. One thing to be careful of though is when we have eviction and cache stores. An entry cannot be evicted until it has been stored so if you have a slow cache store this will cause the put to block for longer as it will first try to call the cache store before evicting the entry.
JK

Similar Messages

  • Specifying coherence-cache-config.xml for multiple clusters

    Hi,
    I am running two cache clusters (Cluster A and B that hold different cache types). we have a web application that needs to communicate with both the clusters. we have two coherence-cache-config-g.xml files, one for each cluster.
    where do we specify the two coherence-cache-config.xml for each of these clusters in our coherence.jar that we deploy on the web app server.
    pls provide some inputs...
    thanks in advance,
    - G.

    Hi G,
    You can define a path to the cache configuration descriptor in your operation configuration override file (tangosol-coherence=override.xml) or specify it in the system property "tangosol.coherence.cacheconfig".
    Please see this Wiki page for details:
    http://wiki.tangosol.com/display/COH32UG/configurable-cache-factory-config
    Regards,
    Gene

  • How to specify index for cache in coherence-cache-config.xml

    Hi All,
    We want to apply indexing on cache data.
    Suppose i have a EMPLOYEE object in coherence cache.
    and i want to use employeeID for indexing purpose.
    Can anybody help me to achieve this at Congregational level i.e. using xml file (coherence-cache-config.xml) .
    Edited by: 981644 on Jan 16, 2013 1:51 AM

    Hi,
    I've posted some [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace.jar]code and the [url http://coherence.oracle.com/download/attachments/14647422/add-index-namespace-src.jar]source. It depends on coherence common version 2.3.0.39174 however I believe it will work with 2.0.0.23649 also. Coherence common library can be downloaded from [url http://coherence.oracle.com/display/INC10/coherence-common]here
    Note: This is purely an example on how to achieve index creation via a cache configuration file and is not a part of the product thus is not covered by product support.
    Here is an example cache configuration that uses the namespace:
    <cache-config xmlns:service="class://com.oracle.coherence.environment.extensible.ServiceOperations">
        <caching-scheme-mapping>
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>ReflectionExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>string</param-type>
                            <param-value>getName</param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
            <!-- Simplified POF Config -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true">
                <pof-index>8,16,32</pof-index>
            </service:index-add>
            <!-- This should not be counted based on system-property override -->
            <service:index-add cache-name="dist-indexes" pof-enabled="true" enabled="{tangosol.index.add}">
                <pof-index>8,16,31</pof-index>
            </service:index-add>
            <!-- Explicit POF Config -->
            <service:index-add cache-name="dist-indexes">
                <extractor>
                    <class-name>PofExtractor</class-name>
                    <init-params>
                        <init-param>
                            <param-type>{class}</param-type>
                            <param-value>null</param-value>
                        </init-param>
                        <init-param>
                            <param-type>{object}</param-type>
                            <param-value>
                                <class-name>com.tangosol.io.pof.reflect.SimplePofPath</class-name>
                                <init-params>
                                    <init-param>
                                        <param-type>{int[]}</param-type>
                                        <param-value>1,2,4</param-value>
                                    </init-param>
                                </init-params>                     
                            </param-value>
                        </init-param>
                    </init-params>
                </extractor>
            </service:index-add>
        </caching-scheme-mapping>
    </cache-config>Thanks,
    Harvey

  • How to share the same coherence cache in two EPN

    hi,all:
    I need to share the same coherence cache in two EPN. to put data into this coherence cache.
    only whe EPN can been deploy ok, the other EPN deploy will get below exception.
    Caused By: java.lang.IllegalStateException: Service "synergy-scheme-service" has been started by the factory with a different configuration descriptor
    at com.tangosol.net.DefaultConfigurableCacheFactory.validateBackingMapManager(DefaultConfigurableCacheFactory.java:1246)
    who can tell me why? or who can give me a example on how to share the same coherence cache in two EPN.
    thanks a lots

    Hi,
    This is because the system detects that you are using different configuration for the cache of the same name(and the domain name). If you want, we can discuss it, my mail is [email protected]
    Thanks
    Junger

  • Looking for some advice on CEP HA and Coherence cache

    We are looking for some advice or recommendation on CEP architecture.
    We need to build a CEP application that conforms to the following:
    • HA with no loss of events or duplicate events when failing over to the backup server.
    • We have some aggregative rules that needs to see all events.
    • Events are XMLs with size of 3KB-50KB. Not all elements are needed for the rules but they are there for other systems that come after the CEP (the customer services).
    • The XML elements that the CEP needs are in varying depth in the XML.
    Running the EPN on a single thread is not fast enough for the required throughput mainly because network latency to the JMS and the heavy task of parsing of the XML. Because of that we are looking for a solution that will read the messages from the JMS in parallel (multi thread) but will keep the same order of events between the Primary and Secondary CEPs.
    One idea that came to our minds is to use Coherence cache in the following way:
    • On the CEP inbound use a distributed queue and not topic (at the CEP outbound it is still topic).
    • On the CEPs side use a Coherence cache that runs on the CEPs JVMs (since we already have a Coherence cluster for HA).
    • Both CEPs read from the queue using multi threading (10 reading threads – total of 20 threads) and putting it to the Coherence cache.
    • The Coherence cache is publishing the events to both CEPs on a single thread.
    The EPN looks something like this:
    JMS adapter (multi threaded) -> replicated cache on both CEPs -> event bean -> HA adapter -> channel -> processor -> ….
    Does this sounds sound to you?
    Are we over shooting here? Is there a simpler solution for our needs?
    Is there a best practice for such requirements?
    Thanks

    Hi,
    Just to make it clear:
    We do not parse the XML on the event bean after the Coherence. We do it on the JMS adapter on multiple threads in order to utilize all the server resources (CPUs) and then we put it in the replicated cache.
    The requirements from our application are:
    - There is an aggregative query that needs to "see" all events (this means that we need to pass all events thru a single processor and we cannot partition them to several processors).
    - Because this is a HA solution the events on both CEPs (primary and secondary) needs to be at the same order when reaching the HA inbound adapter and the processor.
    - A single thread JMS adapter is not reading the messages from the JMS fast enough mainly because it takes time to parse the XML to an event.
    - Using a multi-threaded adapter or many single threaded adapters with message selector will create a situation that the order of events on both CEPs will not be the same at the processor inbound.
    This is why we needed a mediator so we can read in multiple threads that will parse the XMLs in parallel without concerning on order of messages and on the other hand publish all the messages on a single thread to the processors on both CEPs from this shared mediator (we use a replicated cache that runs on both JVMs).
    We use queue instead of topic because if we read the messages from a topic on both CEPs it will be stored twice on the Coherence replicated cache. But if we use a queue, when server 1 read the message and put it in the Coherence replicated cache then server 2 will not read it because it was removed from the queue.
    If I understand correctly you are suggesting replacing the JMS adapter with an event bean that will read the messages from the JMS directly?
    Are you also suggesting that we will not use a replicated cache but instead a stand alone cache on each server? In this case how do we keep the same order of events on both CEPs (on both caches)?

  • Verify whether the session data is kept in the Coherence caches

    I have successfully combined the MapViewer application with WebLogic and Oracle Coherence*Web.
    How to verify whether the session data of MapViewer application is kept in the Coherence caches or not?
    All out put show that both of MapViewer and WebLogic server as well as Coherence are running well.
    All the following steps are right?
    The procedure is as the following:
    1. Create a WebLogic domain: Map_domain.
    2. Start the WebLogic domain Map_domain by running startWebLogic.sh script.
    3. Install Coherence.jar as a library on WebLogic.
    4. Copy the coherence.jar in the WAR's WEB-INF/lib directory.
    5. Create a reference to the shared library by modifying the weblogic.xml in web applications WEB-INF directory
    and add the following contents:
    <weblogic-web-app>
         <library-ref>
              <library-name>coherence-web-spi</library-name>
              <specification-version>1.0.0.0</specification-version>
              <implementation-version>1.0.0.0</implementation-version>
              <exact-match>false</exact-match>
         </library-ref>
    <weblogic-web-app>6. Install Coherence-web-spi.war as a WebLogic library.
    7. Install the MapViewer as a WebLogic application.
    8. Start a Coherence cache server using the cmd file web-cache-server.cmd and then start MapViewer application.
    The content of web-cache-server.cmd file:
    @echo off
    @rem This will start a cache server
    setlocal
    :config
    @rem specify the Coherence installation directory
    set coherence_home=F:\coherence
    @rem specify the JVM heap size
    set memory=256m
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    :launch
    set java_opts="-Xms%memory% -Xmx%memory%"
    "%java_exec%" -server -showversion "%java_opts%" -cp %coherence_home%\lib\coherence.jar;
    %coherence_home%\lib\coherence-web-spi.war
    -Dtangosol.coherence.management.remote=true
    -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml
    -Dtangosol.coherence.session.localstorage=true
    com.tangosol.net.DefaultCacheServer %1
    goto exit
    :instructions
    echo Usage:
    echo   ^<coherence_home^>\bin\cache-server.cmd
    goto exit
    :exit
    endlocal
    @echo onEdited by: jetq on Jan 13, 2010 9:32 AM

    Any opinions are welcome.

  • Implementing Oracle DCN with Coherence Cache in a weblogic 10 app server

    I m trying to implements a DCN ( Database change notification ) on oracle to notify a listener of an event of DB so I can update Coherence Cache.
    I followed the tutorial here and it is working fine using a sample program with a main method to execute the listener class and keep it running.
    My question is how would this notification and listener gets implemented on a production environment since my local test was only running a main method to keep the listener running? what technology to use to keep the listener always running on the background and receive the notification from the database )?
    would a [weblogic startup class|http://docs.oracle.com/cd/E13222_01/wls/docs81/ConsoleHelp/startup_shutdown.html] work for this purpose?
    We are using Weblogic 10 as our app server.

    That's a very simple question with (many) potentially complex answers. I think that first uou need to study information on TimesTen to understand what it is and what it does. Then you need to relate that to you current performance bottleneck (I assume you have analysed those). If your bottleneck is database access then maybe TimesTen can help you.
    Please bear in mind that TimesTen is not a 'transparent' drop in performance booster. To implement TimesTen and to realise significant performance improvement you will almost certainly need to make changes to both the application and the overall architecture. The cost/difficulty of doing that also needs to be factored in.
    Chris

  • Need a help to update coherence cache values in c++

    Hi,
    I need to update coherence cache value of a particular object.
    Managed<ExposureHolderContract>::Handle contract =
    cast<Managed<ExposureHolderContract>::Handle>(cache->get(vsName));
    contract->setName("dsafd");
    When i try to cast to a ManagedObject:: Handle it says
    coherence::lang::ConstCastException: attempt to cast from a "const coherence::lang::Managed<ExposureHolderContract>" to a "coherence::lang::Managed<ExposureHolderContract>"
    at void coherence::lang::coh_throw_const_cast(const std::type_info&, const std::type_info&)(ConstCastException.cpp:27)
    at coherence::lang::coh_throw_const_cast(std::type_info const&, std::type_info const&)
    <stack frame symbol unavailable>
    <stack frame symbol unavailable>
    <stack frame symbol unavailable>
    <stack frame symbol unavailable>
    <stack frame symbol unavailable>
    at __libc_start_main
    on thread "main"
    In the documentation it says in order to call non static methods we need to retrieve the handle.
    but when I try to cast to a handle it fails.
    I'm inserting data to coherence cache by calling Managed::create method. Is this method making immutable object.
    ExposureHolderContract tempEhc(contractId, name, date, age, weight);
    Managed<ExposureHolderContract>::Handle ss = Managed<ExposureHolderContract>::create(tempEhc);
    cache->put(String::create(contractId.c_str()), ss);
    Please help me to update the recorde value.
    regards,
    sura

    Hi Sura,
    It is a matter of safety and correctness. The in-process caches return a locally held object, and thus if you made some change to it, that change would be visible within the in-process cache, while not visible to the remote cache. Thus future access to the in-process cache would see a value which does not actually exist in the remote cache. While it is true that if you modify it with the intent to immediately re-insert it this shrinks the window of incorrectness that window still exists, and of course the cache has no idea if you will ever reinsert the value. As for the effect on performance it should be insignificant if you actually do put it back in the cache as the cost of a cache update will easily be multiple orders of magnitude greater then the cost of the clone. Also remember there is no requirement to clone a value if you don't intend to mutate it, you can safely use it via the View. So the only time the performance cost of the clone could be considered significant is when you intend to mutate but not reinsert the data, but a clone is also necessary there as not cloning it would leave the in-process cache in an inconsistent state with respect to the remote cache.
    Mark
    Oracle Coherence

  • How to Test coherence cache configuration

    Hi,
    I have configured coherence using the below two config xmls, I had started out by trying to configure a distributed cache scheme but I am not sure if it has come up correctly. This configuration works fine from caching point of view, it even does the clustering, but my only doubt here is that how can I test whether it is actually a distributed cache or a replicated cache?
    coherence-cache-config.xml
    <cache-config>
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>dist-ABCCache</cache-name>
                   <scheme-name>ABC-distributed-cache-scheme</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>
              <!--
    Distributed caching scheme.
    -->
              <distributed-scheme>
                   <scheme-name>ABC-distributed-cache-scheme</scheme-name>
                   <lease-granularity>member</lease-granularity>
                   <backing-map-scheme>
                        <local-scheme/>
                   </backing-map-scheme>
                   <autostart>true</autostart>
              </distributed-scheme>
              <proxy-scheme>
                   <service-name>ExtendTcpProxyService</service-name>
                   <thread-count>5</thread-count>
                   <acceptor-config>
                        <tcp-acceptor>
                             <local-address>
                                  <address>server1</address>
                                  <port>####</port>
                             </local-address>
                        </tcp-acceptor>
                   </acceptor-config>
                   <autostart>true</autostart>
              </proxy-scheme>
         </caching-schemes>
    </cache-config>
    tangosol-coherence-override.xml
    <coherence>
         <cluster-config>
              <member-identity>
                   <cluster-name>MyCluster</cluster-name>
              </member-identity>
              <unicast-listener>
                   <well-known-addresses>
                        <socket-address id="1">
                             <address>server1</address>
                             <port>####</port>
                             <port-auto-adjust>false</port-auto-adjust>
                        </socket-address>
                        <socket-address id="2">
                             <address>server2</address>
                             <port>####</port>
                             <port-auto-adjust>false</port-auto-adjust>
                        </socket-address>                    
                   </well-known-addresses>
              </unicast-listener>
              <multicast-listener>
                   <time-to-live system-property="tangosol.coherence.ttl">4</time-to-live>
                   <join-timeout-milliseconds>3000</join-timeout-milliseconds>
              </multicast-listener>
              <packet-publisher>
                   <packet-delivery>
                        <timeout-milliseconds>30000</timeout-milliseconds>
                   </packet-delivery>
              </packet-publisher>
              <service-guardian>
                   <timeout-milliseconds system-property="tangosol.coherence.guard.timeout">35000
                   </timeout-milliseconds>
              </service-guardian>
         </cluster-config>
         <logging-config>
              <severity-level system-property="tangosol.coherence.log.level">9</severity-level>
              <character-limit system-property="tangosol.coherence.log.limit">0</character-limit>
         </logging-config>
    </coherence>

    user1945969 wrote:
    Thanks for your answer but I also wanted to know if there is anyway I can verify that by the data in the cluster? You can start up the [command line application|http://coherence.oracle.com/pages/viewpage.action?pageId=16684] or write a quick class to display the information for that particular cache.
    I mean can check what all data is present in each cluster member?I would suggest taking a look via JMX. In this case, you would want to look at the ServiceMBean, CacheMBean and StorageManagerMBean MBeans (take a look at the Registry for more information).
    Another reason why I am not so confident if this scheme is distributed or not is that, in my config xml I do not have any backing map scheme configured so how is coherence going to do the backups in this case?
    <backing-map-scheme>
         <local-scheme/>
    </backing-map-scheme>You do have a "backing map" configured, it will just use the defaults.
    Coherence always manages the backups automatically, transparently and dynamically for you. When using the partitioned cache (i.e. "distributed-scheme") Coherence will place the backup in a storage enabled node on a separate physical machine as the primary.
    Rob
    :Coherence Team:

  • Verify if the sessision data of MapViewer app is stored in Coherence caches

    I have successfully combined the MapViewer application with WebLogic and Oracle Coherence*Web.
    How to verify whether the session data of MapViewer application is kept in the Coherence caches or not?
    All out put show that both of MapViewer and WebLogic server as well as Coherence are running well.
    All the following steps are right?
    The procedure is as the following:
    1. Create a WebLogic domain: Map_domain.
    2. Start the WebLogic domain Map_domain by running startWebLogic.sh script.
    3. Install Coherence.jar as a library on WebLogic.
    4. Copy the coherence.jar in the WAR's WEB-INF/lib directory.
    5. Create a reference to the shared library by modifying the weblogic.xml in web applications WEB-INF directory
    and add the following contents:
    <weblogic-web-app>
         <library-ref>
              <library-name>coherence-web-spi</library-name>
              <specification-version>1.0.0.0</specification-version>
              <implementation-version>1.0.0.0</implementation-version>
              <exact-match>false</exact-match>
         </library-ref>
    <weblogic-web-app>6. Install Coherence-web-spi.war as a WebLogic library.
    7. Install the MapViewer as a WebLogic application.
    8. Start a Coherence cache server using the cmd file web-cache-server.cmd and then start MapViewer application.
    The content of web-cache-server.cmd file:
    @echo off
    @rem This will start a cache server
    setlocal
    :config
    @rem specify the Coherence installation directory
    set coherence_home=F:\coherence
    @rem specify the JVM heap size
    set memory=256m
    :start
    if not exist "%coherence_home%\lib\coherence.jar" goto instructions
    if "%java_home%"=="" (set java_exec=java) else (set java_exec=%java_home%\bin\java)
    :launch
    set java_opts="-Xms%memory% -Xmx%memory%"
    "%java_exec%" -server -showversion "%java_opts%" -cp %coherence_home%\lib\coherence.jar;
    %coherence_home%\lib\coherence-web-spi.war
    -Dtangosol.coherence.management.remote=true
    -Dtangosol.coherence.cacheconfig=WEB-INF/classes/session-cache-config.xml
    -Dtangosol.coherence.session.localstorage=true
    com.tangosol.net.DefaultCacheServer %1
    goto exit
    :instructions
    echo Usage:
    echo   ^<coherence_home^>\bin\cache-server.cmd
    goto exit
    :exit
    endlocal
    @echo onEdited by: jetq on Jan 12, 2010 9:02 PM

    Any opinions are welcome.

  • Does coherence cache the value from the cache?

    Hi, I have the question about if the coherence caches the value from the cache? I believe it does from my test, just want to get the confirmation.
    I like to use an example to describe my question. For example:
    If (key1, value1) are in the cache1, (value1 is an object),
    for the first time, if cache1.get(key1), coherence will deserialize value1 and return. But if in the same JVM, when cache1.get(key1) is invoked again, coherence will return value1, which I believe is cached by coherence in the current JVM, and return; instead of deserializing and return it. Is that right?
    I am asking this question because I found a problem in our project when use coherence. As the above example, if I use value1 = cache1.get(key1), and in our project, value1 object has a set method to change one of its internal attributes, and this method was indeed invoked after value1 get from cache1. Then in another class, value2 = cache1.get(key1) is called again, and I found out that value2's attribute will have the modified value, even cache1.put(key1, value1) is never invoked in the first place.
    Of course, this kind of behavior matches the java.util.Map. But coherence cache is a cluster/distributed environment. In the above example, if on another data node, value3 = cache1.get(key1) will get the original attribute value in value3, since the deserialize object will always get the original value, unless the new value is put in explicitly by cache1.put(key1, value1).
    In this case, should cache1.get(key1) always return a clone object make more sense?
    Thanks

    You observation is correct. More specifically for cache topologies which include an in-process cache Coherence may return the same object reference for repeated get requests on the same key. I say "may" because for any variety of reasons we may also have to retrieve a fresh copy from a remote cache server. When possible we will return existing objects for performance reasons avoiding costly things like network hops, and de-serialization. Any modifications made to an object returned from the cache will not be made automatically available to other cluster members. Additionally if these modifications are made concurrently with another thread performing a cache.put() on the same value could result in a corrupt cached value if your serialization methods are not thread-safe. Best practice dictates that unless you are sure that you are using a cache topology which does not include an in-process cache that you treat the values returned from the cache as immutable, and instead deep clone() it before making any modifications.
    The distributed-scheme and remote-scheme are the only types of caches which do not include in-process caching, and thus always return "mutation safe" values. The most common in-process cache topology is near-scheme, but others include replicated-scheme, optimistic-scheme, local-scheme, and the programatically created ContinuousQueryCache.
    thanks,
    mark

  • Start a new Coherence cache server

    Hi experts,
    I have an application configured with oracle coherence running on the weblogic server. Can I start a new Coherence cache server from a command prompt so that, this newly created cache server joins the existing cluster already running on the weblogic server. Can you please guide me through this or point to the relevant documentation.
    Thanks for your time.
    Cheers,

    You just need to run...
    java <parameters> -cp <your class path> DefaultCacheServerwhere...
    <parameters> is set to the same set of -D paramters you have given the application inside WebLogic.
    <your class path> is all the jar files in your application, including coherence.jar (but you don't need any ear or web app stuff obviously)
    Presumably you have configured the system properties for your application in WebLogic to set the multicast address (-Dtangosol.coherence.clusteraddress
    and -Dtangosol.coherence.clusterport), cache config (-Dtangosol.coherence.cacheconfig) etc... If you have not then you really should! You basically run DefaultCacheServer with the same parameters.
    When I have used Weblogic and Coherence in the past the usual configurationis to run a number of storage enabled cache server nodes (which is what you are asking about) and then run the WebLogic nodes as storage diabled cluster members. This is much more efficient as it lets the storage enabled node just concentrate on storing data nad the WebLogic node just concentrate on you application.
    JK

  • Handling collections in coherence cache

    hi,
    In a mutithreaded environment, how does coherence cache handles collection like HashMap in a multithreaded environment where the large majority of method calls are read-only, instead of structural changes?
    Are the read calls non-synchronized by coherence? Is there any mechanism to handle the write calls different from the read calls?
    Thanks.
    suvasis

    Hi Suvasis,
    Coherence caches are coherent, and use a minimal (or zero if possible) amount of synchronization for read-access.
    Coherence does support double-checked locking for read-heavy access:
    <tt>
    Object value = cache.get(k);
    if (value == null)
      cache.lock(key, -1);
      try
        value = cache.get(key);
        if (value == null)
          value = {something};
          cache.put(key, value);
      finally
        cache.unlock(key);
    // read-access to value
    Object x = value.getSomeAttribute();
    </tt>
    It should be noted that Coherence does not "observe" objects outside of the Coherence API calls (get/put/lock/unlock/etc). So once you "get" a local object instance from Coherence, Coherence doesn't pay attention to that local object until you explicitly "put" it the modified object back into the cache.
    Jon Purdy
    Tangosol, Inc.

  • Coherence-cache-config.xml not visible from EAR

    hello all.
    I've met following issues. The coherence does not see my custom cache-config.xml and thereby uses the default from coherence.jar.
    Environment:
    1. WLS 10.3, Coherence 3.7, jvm 1.6
    2. the active-cache is deployed as shared library
    3. the dedicated coherence cluster is configured through WLS Admin console and all started with -Dtangosol.coherence.cacheconfig=d:\OracleFM\R11.1.1.5\WLSGeneric\user_projects\domains\mvn_domain1\coherence-config\coherence-cache-config.xml.. The output shows that the cluster is started and my cache service is started also:
    Services
    ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.7.1, OldestMemberId=1}
    InvocationService{Name=Management, State=(SERVICE_STARTED), Id=1, Version=3.1, OldestMemberId=1}
    PartitionedCache{Name=MVN_Test_Service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}
    Cache services are configured with auto-start=true
    4. the coherence.jar is placed in EAR\lib\coherence.jar
    5. I've got tried to place coherence-cache-config.xml in the following places within EAR
    EAR
    APP-INF\classes\coherence-cache-config.xml
    EAR
    lib\coherence-cache-config.xml
    EAR
    MyModule.jar\META-INF\coherence-cache-config.xml
    The result is that coherence uses default config file from coherence.jar instead of the custom one that deployed with EAR. In fact I do not have ideas what is wrong there....
    And yet, the coherence that deployed with EAR sucessfully joined to cluster, but only to Service Management. From output: "Member 2 joined Service Management with senior member 1"
    Edited by: mvnval on Feb 15, 2012 3:41 AM
    Edited by: mvnval on Feb 15, 2012 3:42 AM

    Hello Robert. Thanks for prompt reply.
    If by saying that you deployed coherence.jar as a shared library means that you put it on the server classpath
    In fact I didn't say that. I said that "4. the coherence.jar is placed in EAR\lib\coherence.jar"
    Below the output from dedicated Coherence server
    +<Feb 16, 2012 4:09:03 AM> <INFO> <NodeManager> <Server output log file is 'D:\OracleFM\R11.1.1.5\WLSGeneric\user_projects\domains\mvn_domain1\servers_coherence\Coherence37Server-0\logs\Coherence37Server-0.out'>+
    +2012-02-16 11:39:04.133/0.928 Oracle Coherence 3.7.1.0 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/D:/OracleFM/R11.1.1.5/WLSGeneric/coherence_3.7.1/lib/coherence.jar!/tangosol-coherence.xml"+
    +2012-02-16 11:39:04.578/1.373 Oracle Coherence 3.7.1.0 <Info> (thread=main, member=n/a): Loaded operational overrides from "jar:file:/D:/OracleFM/R11.1.1.5/WLSGeneric/coherence_3.7.1/lib/coherence.jar!/tangosol-coherence-override-dev.xml"+
    +2012-02-16 11:39:04.579/1.374 Oracle Coherence 3.7.1.0 <D5> (thread=main, member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified+
    +2012-02-16 11:39:04.586/1.381 Oracle Coherence 3.7.1.0 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified+
    Oracle Coherence Version 3.7.1.0 Build 27797
    Grid Edition: Development mode
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    +2012-02-16 11:39:07.080/3.875 Oracle Coherence GE 3.7.1.0 <D4> (thread=main, member=n/a): TCMP bound to /10.6.12.61:9888 using SystemSocketProvider+
    +2012-02-16 11:39:10.591/7.386 Oracle Coherence GE 3.7.1.0 <Info> (thread=Cluster, member=n/a): Created a new cluster "cluster:0x75CB" with Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer, Edition=Grid Edition, Mode=Development, CpuCount=4, SocketCount=4) UID=0x0A060C3D0000013585509CEAD5F326A0+
    +2012-02-16 11:39:10.597/7.392 Oracle Coherence GE 3.7.1.0 <Info> (thread=main, member=n/a): Started cluster Name=cluster:0x75CB+
    +Group{Address=231.1.1.1, Port=7777, TTL=4}+
    MasterMemberSet(
    ThisMember=Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer)
    OldestMember=Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer)
    ActualMemberSet=MemberSet(Size=1
    Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer)
    +)+
    MemberId|ServiceVersion|ServiceJoined|MemberState
    +1|3.7.1|2012-02-16 11:39:10.592|JOINED+
    RecycleMillis=1200000
    RecycleSet=MemberSet(Size=0
    +)+
    +)+
    +TcpRing{Connections=[]}+
    +IpMonitor{AddressListSize=0}+
    +2012-02-16 11:39:10.629/7.424 Oracle Coherence GE 3.7.1.0 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1+
    +2012-02-16 11:39:10.845/7.640 Oracle Coherence GE 3.7.1.0 <D5> (thread=DistributedCache, member=1): Service DistributedCache joined the cluster with senior service member 1+
    +2012-02-16 11:39:10.936/7.731 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member(Id=2, Timestamp=2012-02-16 11:39:10.74, Address=10.6.12.61:9890, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3592,member:Coherence37Server-1, Role=WeblogicWeblogicCacheServer) joined Cluster with senior member 1+
    +2012-02-16 11:39:10.962/7.757 Oracle Coherence GE 3.7.1.0 <D5> (thread=ReplicatedCache, member=1): Service ReplicatedCache joined the cluster with senior service member 1+
    +2012-02-16 11:39:10.975/7.770 Oracle Coherence GE 3.7.1.0 <D5> (thread=OptimisticCache, member=1): Service OptimisticCache joined the cluster with senior service member 1+
    +2012-02-16 11:39:10.986/7.781 Oracle Coherence GE 3.7.1.0 <D5> (thread=Invocation:InvocationService, member=1): Service InvocationService joined the cluster with senior service member 1+
    +2012-02-16 11:39:10.989/7.785 Oracle Coherence GE 3.7.1.0 <Info> (thread=main, member=1):+
    Services
    +(+
    +ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.7.1, OldestMemberId=1}+
    +InvocationService{Name=Management, State=(SERVICE_STARTED), Id=1, Version=3.1, OldestMemberId=1}+
    +PartitionedCache{Name=DistributedCache, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}+
    +ReplicatedCache{Name=ReplicatedCache, State=(SERVICE_STARTED), Id=3, Version=3.0, OldestMemberId=1}+
    +Optimistic{Name=OptimisticCache, State=(SERVICE_STARTED), Id=4, Version=3.0, OldestMemberId=1}+
    +InvocationService{Name=InvocationService, State=(SERVICE_STARTED), Id=5, Version=3.1, OldestMemberId=1}+
    +)+
    Started DefaultCacheServer...
    +2012-02-16 11:39:10.994/7.789 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 2 joined Service Management with senior member 1+
    +2012-02-16 11:39:11.297/8.092 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 2 joined Service DistributedCache with senior member 1+
    +2012-02-16 11:39:11.330/8.125 Oracle Coherence GE 3.7.1.0 <D5> (thread=DistributedCache, member=1): 3> Transferring primary PartitionSet{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127} to member 2 requesting 128+
    +2012-02-16 11:39:11.369/8.164 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 2 joined Service ReplicatedCache with senior member 1+
    +2012-02-16 11:39:11.373/8.168 Oracle Coherence GE 3.7.1.0 <D4> (thread=DistributedCache, member=1): 1> Transferring 129 out of 129 partitions to a node-safe backup 1 at member 2 (under 129)+
    +2012-02-16 11:39:11.399/8.194 Oracle Coherence GE 3.7.1.0 <D5> (thread=DistributedCache, member=1): Transferring 0KB of backup[1] for PartitionSet{128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256} to member 2+
    +2012-02-16 11:39:11.443/8.238 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 2 joined Service OptimisticCache with senior member 1+
    +2012-02-16 11:39:11.461/8.256 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 2 joined Service InvocationService with senior member 1+
    +2012-02-16 12:00:31.435/1288.230 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member(Id=3, Timestamp=2012-02-16 12:00:31.425, Address=10.6.12.61:8888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:6252, Role=WeblogicServer) joined Cluster with senior member 1+
    +2012-02-16 12:00:31.726/1288.521 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member(Id=4, Timestamp=2012-02-16 12:00:31.7, Address=10.6.12.61:8890, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:7116, Role=WeblogicServer) joined Cluster with senior member 1+
    +2012-02-16 12:00:31.758/1288.553 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 3 joined Service Management with senior member 1+
    +2012-02-16 12:00:32.092/1288.887 Oracle Coherence GE 3.7.1.0 <D5> (thread=Cluster, member=1): Member 4 joined Service Management with senior member 1+
    You may see that I have two dedicated Coherence servers member 1 and member 2 that joined in coherence cluster. The member 3 and member 4 are WLS deployed coherence. I mean that I have two WLS that configured to join Coherence cluster, and it's happened after the application had been deployed on both of them. You may see that the two last joined only to Service Management
    There is the output from WLS-out:
    +2012-02-16 12:00:29.071/1219.089 Oracle Coherence 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational configuration from "zip:D:/OracleFM/R11.1.1.5/WLSGeneric/user_projects/domains/mvn_domain1/servers/WLSServer-1/tmp/_WL_user/TestEAR/g0yzyu/lib/coherence.jar!/tangosol-coherence.xml"+
    +2012-02-16 12:00:29.173/1219.191 Oracle Coherence 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded operational overrides from "zip:D:/OracleFM/R11.1.1.5/WLSGeneric/user_projects/domains/mvn_domain1/servers/WLSServer-1/tmp/_WL_user/TestEAR/g0yzyu/lib/coherence.jar!/tangosol-coherence-override-dev.xml"+
    +2012-02-16 12:00:29.175/1219.193 Oracle Coherence 3.7.1.0 <D5> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/tangosol-coherence-override.xml" is not specified+
    +2012-02-16 12:00:29.179/1219.197 Oracle Coherence 3.7.1.0 <D5> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified+
    Oracle Coherence Version 3.7.1.0 Build 27797
    Grid Edition: Development mode
    Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    +2012-02-16 12:00:30.069/1220.087 Oracle Coherence GE 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Loaded Reporter configuration from "zip:D:/OracleFM/R11.1.1.5/WLSGeneric/user_projects/domains/mvn_domain1/servers/WLSServer-1/tmp/_WL_user/TestEAR/g0yzyu/lib/coherence.jar!/reports/report-group.xml"+
    And this from WLS-log:
    +####<Feb 16, 2012 12:00:31 PM FET> <Info> <com.oracle.wls> <EPBYMINW0269> <WLSServer-1> <Logger@1380966230 3.7.1.0> <<anonymous>> <> <> <1329382831441> <BEA-000000> <2012-02-16 12:00:31.441/1221.459 Oracle Coherence GE 3.7.1.0 <Info> (thread=Cluster, member=n/a): This Member(Id=3, Timestamp=2012-02-16 12:00:31.425, Address=10.6.12.61:8888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:6252, Role=WeblogicServer, Edition=Grid Edition, Mode=Development, CpuCount=4, SocketCount=4) joined cluster "cluster:0x75CB" with senior Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer, Edition=Grid Edition, Mode=Development, CpuCount=4, SocketCount=4)>+
    +####<Feb 16, 2012 12:00:31 PM FET> <Info> <com.oracle.wls> <EPBYMINW0269> <WLSServer-1> <Logger@9259509 3.7.1.0> <<anonymous>> <> <> <1329382831661> <BEA-000000> <2012-02-16 12:00:31.661/1221.679 Oracle Coherence GE 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=n/a): Started cluster Name=cluster:0x75CB+
    +Group{Address=231.1.1.1, Port=7777, TTL=4}+
    MasterMemberSet(
    ThisMember=Member(Id=3, Timestamp=2012-02-16 12:00:31.425, Address=10.6.12.61:8888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:6252, Role=WeblogicServer)
    OldestMember=Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer)
    ActualMemberSet=MemberSet(Size=3
    Member(Id=1, Timestamp=2012-02-16 11:39:07.242, Address=10.6.12.61:9888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3012,member:Coherence37Server-0, Role=WeblogicWeblogicCacheServer)
    Member(Id=2, Timestamp=2012-02-16 11:39:10.74, Address=10.6.12.61:9890, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:3592,member:Coherence37Server-1, Role=WeblogicWeblogicCacheServer)
    Member(Id=3, Timestamp=2012-02-16 12:00:31.425, Address=10.6.12.61:8888, MachineId=54771, Location=site:,machine:EPBYMINW0269,process:6252, Role=WeblogicServer)
    +)+
    MemberId|ServiceVersion|ServiceJoined|MemberState
    +1|3.7.1|2012-02-16 11:39:07.242|JOINED,+
    +2|3.7.1|2012-02-16 11:39:10.74|JOINED,+
    +3|3.7.1|2012-02-16 12:00:31.646|JOINED+
    RecycleMillis=1200000
    RecycleSet=MemberSet(Size=0
    +)+
    +)+
    +TcpRing{Connections=[2]}+
    +IpMonitor{AddressListSize=0}+
    +>+
    +####<Feb 16, 2012 12:00:31 PM FET> <Info> <com.oracle.wls> <EPBYMINW0269> <WLSServer-1> <Logger@9259509 3.7.1.0> <<anonymous>> <> <> <1329382831916> <BEA-000000> <2012-02-16 12:00:31.916/1221.934 Oracle Coherence GE 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=3): Loaded cache configuration from "zip:D:/OracleFM/R11.1.1.5/WLSGeneric/user_projects/domains/mvn_domain1/servers/WLSServer-1/tmp/_WL_user/TestEAR/g0yzyu/lib/coherence.jar!/coherence-cache-config.xml">+
    +####<Feb 16, 2012 12:00:32 PM FET> <Info> <Deployer> <EPBYMINW0269> <WLSServer-1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1329382832019> <BEA-149059> <Module EjbWebServices.jar of application TestEAR is transitioning from STATE_NEW to STATE_PREPARED on server WLSServer-1.>+
    +####<Feb 16, 2012 12:00:32 PM FET> <Info> <com.oracle.wls> <EPBYMINW0269> <WLSServer-1> <Logger@9259509 3.7.1.0> <<anonymous>> <> <> <1329382832020> <BEA-000000> <2012-02-16 12:00:32.018/1222.036 Oracle Coherence GE 3.7.1.0 <Info> (thread=[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)', member=3): Loaded cache configuration from "zip:D:/OracleFM/R11.1.1.5/WLSGeneric/user_projects/domains/mvn_domain1/servers/WLSServer-1/tmp/_WL_user/TestEAR/g0yzyu/EjbWebServices.jar!/META-INF/coherence-cache-config.xml">+
    +####<Feb 16, 2012 12:00:32 PM FET> <Info> <EJB> <EPBYMINW0269> <WLSServer-1> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1329382832037> <BEA-010008> <EJB Deploying file: EjbWebServices.jar>+

  • Preload DB tables into Coherence Cache using HibernateDataStore

    Hi,
    I am trying to use Hibernate just to pre-load my database tables [reference data with millions of rows] into coherence cache [as pojos]. I started looking at the configuration file from the below link -
    http://coherence.oracle.com/display/COH35UG/Using+Hibernate+as+a+CacheStore+for+Coherence
    and could not grab much from there.
    Can someone plz provide clean steps on how i can use hibernate to pre-load my database tables into coherence. An example with pojo would be very helpful?
    Thank You,
    Jagadeesh.

    Hi, Steve
    Thanks for the information. I did look at the document regarding CacheLoader and read-through and read-ahead.
    I have the question based on the above info.
    1. Currently I am using Built-in CacheStore implementation: JPA CacheStore.
    Here is the configuration in persistance.xml.
    <backing-map-scheme>
    <read-write-backing-map-scheme>
    <!--
    Define the cache scheme
    -->
    <internal-cache-scheme>
    <local-scheme/>
    </internal-cache-scheme>
    <cachestore-scheme>
    <class-scheme>
    <class-name>com.tangosol.coherence.jpa.JpaCacheStore</class-name>
    <init-params>
    JpaCacheStore extends JpaCacheLoader and implments CacheStore interface.
    so in JpaCacheLoader, it has load and loadAll method implementation.
    Can I confirm in my case, i shouldn't do anything else regarding the read-through?
    Cheers
    Julia

Maybe you are looking for