2017-04-07 58 views
1

我有一個在複製模式下運行的點火服務器,以及啓用了附近緩存的同一節點上的許多客戶端。現在,當我運行臨近緩存的客戶端並且沒有接近緩存時,我沒有發現明顯的性能差異。Ignite C++客戶端模式,靠近緩存

我對接近緩存的理解是,經常使用的鍵和值將存儲在客戶端本身,因此不會有實際的Get()調用服務器。如果我錯了,請糾正我。

有人可以在緩存配置xml附近共享工作。

SERVER CONFIG: 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:util="http://www.springframework.org/schema/util" 
     xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/util 
     http://www.springframework.org/schema/util/spring-util.xsd"> 
     <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> 

      <property name="cacheConfiguration"> 
       <bean class="org.apache.ignite.configuration.CacheConfiguration"> 
        <property name="cacheMode" value="LOCAL" /> 
           <!-- Enable near cache to cache recently accessed data. --> 

           <!-- <property name="nearConfiguration"> 

            <bean class="org.apache.ignite.configuration.NearCacheConfiguration"/> 

           </property> --> 
        <property name="nearConfiguration"> 
        <bean class="org.apache.ignite.configuration.NearCacheConfiguration"> 
        </bean> 
        </property> 

       </bean> 
      </property> 
     <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> 
     <property name="discoverySpi"> 
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> 
       <property name="ipFinder"> 
        <!-- 
         Ignite provides several options for automatic discovery that can be used 
         instead os static IP based discovery. 
        --> 
        <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. --> 
        <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> --> 
          <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> 
         <property name="addresses"> 
          <list> 
           <!-- In distributed environment, replace with actual host IP address. --> 
           <!-- <value>127.0.0.1:48550..48551</value> --> 
           <value>XXX.ZZZ.yyy.36:47500..47501</value> 
          </list> 
         </property> 
        </bean> 
       </property> 
      </bean> 
     </property> 

    </bean> 
</beans> 


CLIENT CONFIG: 

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:util="http://www.springframework.org/schema/util" 
     xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/util 
     http://www.springframework.org/schema/util/spring-util.xsd"> 
     <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> 

      <property name="cacheConfiguration"> 
       <bean class="org.apache.ignite.configuration.CacheConfiguration"> 
        <property name="cacheMode" value="LOCAL" /> 
           <!-- Enable near cache to cache recently accessed data. --> 

           <!-- <property name="nearConfiguration"> 

            <bean class="org.apache.ignite.configuration.NearCacheConfiguration"/> 

           </property> --> 
        <property name="nearConfiguration"> 
        <bean class="org.apache.ignite.configuration.NearCacheConfiguration"> 
        </bean> 
        </property> 

       </bean> 
      </property> 
     <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. --> 
     <property name="discoverySpi"> 
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> 
       <property name="ipFinder"> 
        <!-- 
         Ignite provides several options for automatic discovery that can be used 
         instead os static IP based discovery. 
        --> 
        <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. --> 
        <!-- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> --> 
          <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder"> 
         <property name="addresses"> 
          <list> 
           <!-- In distributed environment, replace with actual host IP address. --> 
           <!-- <value>127.0.0.1:48550..48551</value> --> 
           <value>XXX.ZZZ.yyy.38:47500..47501</value> 
          </list> 
         </property> 
        </bean> 
       </property> 
      </bean> 
     </property> 


    </bean> 
</beans> 

回答

1

是,近緩存提高了緩存的性能常常使用本地節點上的條目,但如果你運行單機或JVM上的所有測試中,它沒有任何意義。靠近緩存允許不在遠程節點上訪問數據,但在測試中,所有內容都已在本地運行。

而且近緩存對REPLICATEDPARTITIONED高速緩存,其中備份的數量等於或大於數據節點的數量越大沒有意義的服務器節點,因爲設置的所有數據已經​​可以爲每個節點本地。

因此,爲了提高性能,當服務器節點在遠程計算機上工作時,需要將客戶機節點配置爲使用Near緩存。在測量之前,不要忘記在高速緩存附近進行熱身。

這裏是設置近緩存XML片段:

... 
<bean class="org.apache.ignite.configuration.CacheConfiguration"> 

     <!-- Your other cache config --> 

     <property name="nearConfiguration"> 
      <bean class="org.apache.ignite.configuration.NearCacheConfiguration"/> 
     </property> 
</bean> 
... 
+0

我已經加入了使用的配置,但使用上面的配置,我可以看到近緩存從ignitevisor有效OFF。 – Immortalisai

+0

我想你是看錯了節點。它可能被禁用服務器,但爲客戶端啓用。 –

+0

嗨,我可以看到,我沒有單獨爲每個緩存添加近緩存配置。現在無法看到啓用的附近緩存。 – Immortalisai