This discussion is archived
7 Replies Latest reply: Jan 15, 2013 7:59 AM by user738616 RSS

Near cache in client side - Distributed cache in server side

lmtorresalt Newbie
Currently Being Moderated
Hi everyone , i am trying to configure near cache at the cliente side ( apache tomcat as coherence client ) , and distributed cache in server side ( coherence node )

How can i do it ?

thanks in advance.

Coherece Enterprise Grid Edition 3.7

I am testing this , but seems to do not caching at client side :



This is the configuration in client side
-----

<cache-config>
     <caching-scheme-mapping>

          <cache-mapping>
               <cache-name>Proveidor-cache</cache-name>
               <scheme-name>near-cache-jmad-distributed1</scheme-name>
               <init-params>
     <init-param>
          <param-name>back-size-limit</param-name>
          <param-value>8MB</param-value>
     </init-param>
</init-params>
          </cache-mapping>          
     </caching-scheme-mapping>

     <caching-schemes>

     <near-scheme>
<scheme-name>near-cache-jmad-distributed1</scheme-name>
<front-scheme>
<local-scheme>
<high-units>0</high-units> *<!-- 0 means front-scheme no limit-->*
<expiry-delay>0</expiry-delay> *<!-- 0 means front-scheme no limit-->*
</local-scheme>
</front-scheme>
<back-scheme>
<distributed-scheme>
<scheme-ref>jmad-distributed1</scheme-ref>
</distributed-scheme>
</back-scheme>
<invalidation-strategy>none</invalidation-strategy>
<autostart>true</autostart>
</near-scheme>

          <distributed-scheme>
               <scheme-name>jmad-distributed1</scheme-name>
               <service-name>DistributedCache1</service-name>
               <partition-count>19</partition-count>

               
               <backup-count>0</backup-count>
               
               <backing-map-scheme>
                    <partitioned>true</partitioned>
                    <external-scheme>
                         <high-units>1</high-units>
                         <unit-calculator>BINARY</unit-calculator>
                         <unit-factor>1024</unit-factor> *<!-- 1024 means 1K , back-scheme small -->*
                         <nio-memory-manager>
                              <initial-size>1MB</initial-size>
                              <maximum-size>50MB</maximum-size>
                         </nio-memory-manager>
                    </external-scheme>
               </backing-map-scheme>
               <autostart>true</autostart>
          </distributed-scheme>
     </caching-schemes>
</cache-config>



This is the configuration in server side
-----
<cache-config>
     <caching-scheme-mapping>
          <!-- CACHE MAPPINGS - se deben corresponder con los esquemas -->
          <cache-mapping>
               <cache-name>Proveidor-cache</cache-name>
               <scheme-name>jmad-distributed1</scheme-name>
          </cache-mapping>          
          
     </caching-scheme-mapping>

     <caching-schemes>

          <distributed-scheme>
               <scheme-name>jmad-distributed1</scheme-name>
               <service-name>DistributedCache1</service-name>
               <partition-count>19</partition-count>
               <!-- 1GB -->
               
               <backup-count>0</backup-count>
               
               <backing-map-scheme>
                    <partitioned>true</partitioned>
                    <external-scheme>
                         <high-units>1</high-units>
                         <unit-calculator>BINARY</unit-calculator>
                         <unit-factor>1073741824</unit-factor>*<!-- 1073741824 means 1GB , back-scheme big -->*
                         <nio-memory-manager>
                              <initial-size>1MB</initial-size>
                              <maximum-size>50MB</maximum-size>
                         </nio-memory-manager>
                    </external-scheme>
               </backing-map-scheme>
               <autostart>true</autostart>
          </distributed-scheme>

     </caching-schemes>


</cache-config>
  • 1. Re: Near cache in client side - Distributed cache in server side
    tmiddlet Newbie
    Currently Being Moderated
    Hi.

    The cache config looks ok as far as i can see. Although if you enable xsd validation you will find your nio-memory-manager needs to be the first element in the external-scheme.

    A couple of questions.
    1) How do you know that it is not using the near cache? Have you tried enabling jmx and checked in jconsole under the front Cache MBean?
    2) You only have 19 for partition count. This seems very low, what is the reason for this? How many cache servers are you running?
    3) What's the exact version of Coherence you are using?

    Thanks

    Tim
  • 2. Re: Near cache in client side - Distributed cache in server side
    user738616 Pro
    Currently Being Moderated
    Hi,

    Your configuration for back-scheme is incorrect and should be same for client and server. The flag "local-storage" (true for server and false for client) would decide whether the node will store be used for storing the back-scheme data or not.

    Essentially you should have the same cache configuration for client and server and Coherence is intelligent enough to decide where to use the front-scheme and back-scheme depending on the value of the flag "local-storage".

    HTH

    Cheers,
    NJ
  • 3. Re: Near cache in client side - Distributed cache in server side
    lmtorresalt Newbie
    Currently Being Moderated
    tmiddlet wrote:
    Hi.

    The cache config looks ok as far as i can see. Although if you enable xsd validation you will find your nio-memory-manager needs to be the first element in the external-scheme.

    A couple of questions.
    1) How do you know that it is not using the near cache? Have you tried enabling jmx and checked in jconsole under the front Cache MBean?
    2) You only have 19 for partition count. This seems very low, what is the reason for this? How many cache servers are you running?
    3) What's the exact version of Coherence you are using?
    Hi Tim,

    1) Yes i tried but seems using low managed memory
    2) 19 is low yes. Is just a test.
    the client side :
    I don't need distributed scheme ("jmad-distributed1") only near-cache ("near-cache-jmad-distributed1" )
    the server side , is the opposite :
    only need distributed scheme ("jmad-distributed1")

    I don't know how to accomplish it, because a "back-scheme" is an obligatory value when you define a "near-cache"
    3) the exact version is Coherence 3.7.1.0b27797, running in Linux Red Hat 64 bits.


    Thanks,
    Leonardo
  • 4. Re: Near cache in client side - Distributed cache in server side
    lmtorresalt Newbie
    Currently Being Moderated
    user738616 wrote:
    Hi,

    Your configuration for back-scheme is incorrect and should be same for client and server. The flag "local-storage" (true for server and false for client) would decide whether the node will store be used for storing the back-scheme data or not.

    Essentially you should have the same cache configuration for client and server and Coherence is intelligent enough to decide where to use the front-scheme and back-scheme depending on the value of the flag "local-storage".

    HTH

    Cheers,
    NJ
    Yes , this is the question .. currently i have local-storage = true at the client side.

    Is it posible to turn off loca-storage at the client side and using near-cache anyway ? .

    I mean if we put local-storage=false at the client side i think Coherence will use near-cache anyway, as you said is intelligent enough.

    Cheers,
    Leonardo
  • 5. Re: Near cache in client side - Distributed cache in server side
    user738616 Pro
    Currently Being Moderated
    Hi Leonardo,
    Yes , this is the question .. currently i have local-storage = true at the client side.

    Is it posible to turn off loca-storage at the client side and using near-cache anyway ? .

    I mean if we put local-storage=false at the client side i think Coherence will use near-cache anyway, as you said is intelligent enough.
    Yes keep the local-storage=false at client side and Coherence will near-cache the data. You should be able to view size of the data in the front-scheme using JMX.

    HTH

    Cheers,
    NJ
  • 6. Re: Near cache in client side - Distributed cache in server side
    lmtorresalt Newbie
    Currently Being Moderated
    Thanks,

    When we use Near Cache , the response times are so different ( better ) .

    Leo
    user738616 wrote:
    Hi Leonardo,
    Yes , this is the question .. currently i have local-storage = true at the client side.

    Is it posible to turn off loca-storage at the client side and using near-cache anyway ? .

    I mean if we put local-storage=false at the client side i think Coherence will use near-cache anyway, as you said is intelligent enough.
    Yes keep the local-storage=false at client side and Coherence will near-cache the data. You should be able to view size of the data in the front-scheme using JMX.

    HTH

    Cheers,
    NJ
  • 7. Re: Near cache in client side - Distributed cache in server side
    user738616 Pro
    Currently Being Moderated
    Hi,

    Thats' the advantage of using near-cache as it provides the best of both the worlds' - distributed and replicated caches.

    Cheers,
    NJ

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points