当前位置: 首页 > 知识库问答 >
问题:

Apache点燃频繁缓存关闭异常

方和宜
2023-03-14

我们正在使用Apache Ignite作为一个缓存来加速我们的授权和权限调用。在客户端加载应用程序期间,应用程序使用get调用访问Ignite缓存大约18次,在此期间,我们从Ignite获得频繁的缓存关闭异常。我们一直试图在大量调用中复制相同的调用,但在本地运行时,每18个调用中有3/4的调用发生错误




 <!-- Alter configuration below as needed. -->
   <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
      <property name="peerClassLoadingEnabled" value="true" />
      <property name="cacheConfiguration">
         <list>
            <!-- Partitioned cache example configuration (Atomic mode). -->
            <bean class="org.apache.ignite.configuration.CacheConfiguration">
               <property name="name" value="default" />
               <property name="atomicityMode" value="ATOMIC" />
               <property name="backups" value="1" />
            </bean>
         </list>
      </property>
      <property name="includeEventTypes">
         <list>
            <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED" />
            <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED" />
            <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED" />
         </list>
      </property>
      <property name="binaryConfiguration">

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

            <property name="compactFooter" value="false" />

         </bean>
      </property>
      <!-- Configure internal thread pool. -->
      <property name="publicThreadPoolSize" value="64" />
      <!-- Configure system thread pool. -->
      <property name="systemThreadPoolSize" value="32" />
      <!--<property name="clientMode" value="false" />-->
      <property name="sqlSchemas">
         <list>
            <value>BA_EV</value>
            <value>BA_DEMO</value>
            <value>TEST_1</value>
            <value>TEST_2</value>
            <value>TEST_3</value>
         </list>
      </property>
      <!-- Enabling Apache Ignite Persistent Store. -->
      <property name="dataStorageConfiguration">
         <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
            <property name="defaultDataRegionConfiguration">
               <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                  <property name="persistenceEnabled" value="true" />
               </bean>
            </property>
         </bean>
      </property>
      <property name="communicationSpi">
         <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
            <property name="slowClientQueueLimit" value="1000" />
            <property name="messageQueueLimit" value="1024" />
         </bean>
      </property>
      <!-- Enabling authentication. -->
      <property name="authenticationEnabled" value="true" />
      <!-- 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. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
               <!-- 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>localhost:47500..47509</value>
                     </list>
                  </property>
               </bean>
            </property>
         </bean>
      </property>
     </bean>
    </beans>


    try {
        cache.put(key, returnType.cast(result));
        } catch (CacheException | org.hibernate.cache.CacheException e) {
            if (e.getCause() instanceof IgniteClientDisconnectedException) {
                IgniteClientDisconnectedException cause =(IgniteClientDisconnectedException)e.getCause();
                cause.reconnectFuture().get(); // Wait for reconnection.
                cache.put(key, returnType.cast(result));
                addDiconnectCount();
                LOGGER.error("Diconnection Reason Trace: ", e);
            }
        }

    Map<String, Serializable>
    map.put(String, String[]);
    List<String>

日志:

>>> +----------------------------------------------------------------------+
>>> Ignite ver. 2.7.6#20190911-sha1:21f7ca41c4348909e2fd26ccf59b5b2ce1f4474e
>>> +----------------------------------------------------------------------+
>>> OS name: Windows 10 10.0 amd64
>>> CPU(s): 4
>>> Heap: 2.0GB
>>> VM name: 4484@xxxxxxx
>>> Local node [ID=7F470894-A979-443C-BC4F-7BCB047C7550, order=6, clientMode=true]
>>> Local node addresses: [xxxxxxx.xx.xxxxxxx.com/0:0:0:0:0:0:0:1, BLREQX1352123L.xx.xxxxxxx.com/10.73.4.44, 192.168.138.1/127.0.0.1, BLREQX1352123L.xx.xxxxxxx.com/172.2                    2.192.1, /192.168.138.1, /192.168.234.1]
>>> Local ports: TCP:10801 TCP:47101

[16:39:14,562][INFO][Thread-10][GridDiscoveryManager] Topology snapshot [ver=6, locNode=7f470894, servers=1, clients=1, state=ACTIVE, CPUs=4, offheap=3.2GB, heap=4.0GB]                         [16:39:45,598][INFO][main][Http11NioProtocol] Starting ProtocolHandler ["http-nio-5014"]
[16:39:45,598][INFO][main][NioSelectorPool] Using a shared selector for servlet write/read
[16:40:14,564][INFO][grid-timeout-worker-#23][IgniteKernal]
Metrics for local node (to disable set 'metricsLogFrequency' to 0)
    ^-- Node [id=7f470894, uptime=00:01:00.016]
    ^-- H/N/C [hosts=1, nodes=2, CPUs=4]
    ^-- CPU [cur=0.13%, avg=31.59%, GC=0%]
    ^-- PageMemory [pages=0]
    ^-- Heap [used=183MB, free=91.06%, comm=1024MB]
    ^-- Off-heap [used=0MB, free=-1%, comm=0MB]
    ^-- Outbound messages queue [size=0]
    ^-- Public thread pool [active=0, idle=0, qSize=0]
    ^-- System thread pool [active=0, idle=0, qSize=0]
[16:40:20,864][INFO][exchange-worker-#38][GridCacheProcessor] Started cache [name=userRoleCache, id=-2021367519, memoryPolicyName=null, mode=REPLICATED, atomicity=ATOMIC, ba                    ckups=2147483647, mvcc=false], encryptionEnabled=false]
[16:40:20,888][INFO][exchange-worker-#38][GridCacheProcessor] Finish proxy initialization, cacheName=userRoleCache, localNodeId=7f470894-a979-443c-bc4f-7bcb047c7550
[16:40:20,997][INFO][exchange-worker-#38][GridCacheProcessor] Stopped cache [cacheName=userRoleCache]
[16:40:21,000][INFO][exchange-worker-#38][GridCacheProcessor] Can not finish proxy initialization because proxy does not exist, cacheName=userRoleCache, localNodeId=7f470894                    -a979-443c-bc4f-7bcb047c7550
[16:40:21,001][INFO][exchange-worker-#38][GridCacheProcessor] Can not finish proxy initialization because proxy does not exist, cacheName=userRoleCache, localNodeId=7f470894                    -a979-443c-bc4f-7bcb047c7550
[16:40:21,001][INFO][exchange-worker-#38][GridCacheProcessor] Can not finish proxy initialization because proxy does not exist, cacheName=userRoleCache, localNodeId=7f470894                    -a979-443c-bc4f-7bcb047c7550
[16:40:21,015][INFO][exchange-worker-#38][GridCacheProcessor] Started cache [name=roleAppPermissions, id=-686786119, memoryPolicyName=null, mode=REPLICATED, atomicity=ATOMIC                    , backups=2147483647, mvcc=false], encryptionEnabled=false]
[16:40:21,039][INFO][exchange-worker-#38][GridCacheProcessor] Finish proxy initialization, cacheName=roleAppPermissions, localNodeId=7f470894-a979-443c-bc4f-7bcb047c7550                        [16:40:21,063][INFO][exchange-worker-#38][GridCacheProcessor] Stopped cache [cacheName=roleAppPermissions]
[16:40:21,131][SEVERE][http-nio-5014-exec-4][JerseyConfig]] Servlet.service() for servlet [com.xxxx.xxxx.base.config.JerseyConfig] in context with path [/ba-cct-api] threw e                    xception

共有1个答案

赫连昕
2023-03-14

我终于弄明白了这一点,并追溯到我们的自定义包装器在其中一个地方有一个try-with-resources逻辑。因为Apache Ignite每次都重新打开缓存连接,所以只有在并发命中期间我们才能看到这个错误。

谢谢大家的回答。

 类似资料:
  • 问题内容: 是否可以在经常修改的对象上使用缓存?例如,假设我们有一个BlogPost对象,并且有一个num_of_views列(以及其他)经常更改。是否可以在高速缓存和数据库中更新num_of_views字段,而无需破坏高速缓存对象并重新创建它?我可以手动完成,但是我担心同步问题。 问题答案: 是的。我不知道您的缓存状况如何,但是您可以随时替换缓存实例:

  • 我正在寻找apache ignite授权示例。但我在网上找不到。如果你们中的任何一个已经实现了点火授权,那么请告诉我如何执行授权。

  • 我希望有Apache Ignite经验的人能够帮助指导我的团队找到关于Apache Ignite新设置的答案。 数据从许多分布式传感器中不断产生,并流进我们的数据库。每个传感器每秒可能提供许多更新,但通常每秒生成<10个更新。 null 查询相当复杂,需要在时间上进行重要的(和动态的)回溯。一个查询可能需要来自一个站点中多个传感器的数据,但所需的传感器是动态确定的。大多数连续查询只需要最近几个小时

  • 我使用的是ignite 2.9。本机持久性已禁用。 使用在堆缓存上启用 缓存配置。setOnheapCacheEnabled(真) 但我仍然可以在日志中看到堆外指标。 在将on heap设置为true后,它不应该只使用堆内存吗 什么类型的数据存储在堆外 在为堆上的默认数据区域定义的逐出策略为random2Lru和LRU的情况下,逐出如何工作

  • 我有一个关于Ignite流媒体部分的问题。 我所理解的是,这是一种将数据导入缓存的方式,但我也看到,我们可以配置流接收器来应用一些其他的自定义逻辑。 所以我尝试创建一个包含接收器的类和一个将数据注入流的类(因此在服务器模式下有2个main和2个Ignite实例),但我“只是”将数据放入流的缓存中(接收器中没有任何自定义逻辑处理)。所以,我在问我是不是错过了什么,或者是我不太理解什么是流到点燃。 如

  • 我正在探索Ignite事务性缓存。我已经有了一段代码,它对JDBC使用Spring事务管理。我想使用Spring缓存抽象在代码中集成ignite事务性缓存。 我遇到了SpringTransactionManager(由Ignite提供),但我无法找到正确的使用方法。本质上,我想做一些类似的事情: 当事务提交时,数据库和缓存应该一起提交。为此,Ignite文档提到了使用SpringTransacti