ignite:使用 igniteCache 时 strip 池中可能出现饥饿

标签 ignite starvation

那里:

我在使用ignite缓存时遇到错误。 我的系统使用zookeeper选择一个主节点,并且有许多从节点。主进程ignite缓存过期值并放入ignite队列中。从节点使用streamer.addData(k,v)将数据提供到ignite缓存并消费ignite队列。 我的代码是:

启动缓存和流媒体:

    // use zookeeper IpFinder
    ignite = Ignition.getOrStart(igniteConfiguration);
    igniteCache = ignite.getOrCreateCache(cacheConfiguration);
    igniteCache.registerCacheEntryListener(new MutableCacheEntryListenerConfiguration<>(
        (Factory<CacheEntryListener<K, CountValue>>)() -> (CacheEntryExpiredListener<K, CountValue>)this
            ::onCacheExpired, null, true, true));

    //onCacheExpired master resolve the expired entry and put in igniteQueue

    cacheConfiguration.setExpiryPolicyFactory(CreatedExpiryPolicy.factoryOf(Duration.ONE_MINUTE));

    igniteDataStreamer = ignite.dataStreamer(igniteCache.getName());
    igniteDataStreamer.deployClass(BaseIgniteStreamCount.class);
    igniteDataStreamer.allowOverwrite(true);
    igniteDataStreamer.receiver(StreamTransformer.from((CacheEntryProcessor<K, CountValue, Object>)(e, arg) -> {
        // process the value.
        return null;
    }));

master处理缓存中过期的条目,并放入ignite队列:

    CollectionConfiguration collectionConfiguration = new CollectionConfiguration().setCollocated(true);
    queue = ignite.queue(igniteQueueName, 0, collectionConfiguration);

从服务器消耗队列。

但运行几个小时后我收到以下错误日志:

2017-09-14 17:06:45,256 org.apache.ignite.logger.java.JavaLogger warning
WARNING: >>> Possible starvation in striped pool.
    Thread name: sys-stripe-6-#7%ignite%
    Queue: []
    Deadlock: false
    Completed: 77168
Thread [name="sys-stripe-6-#7%ignite%", id=134, state=WAITING, blockCnt=0, waitCnt=68842]
        at sun.misc.Unsafe.park(Native Method)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:304)
        at o.a.i.i.util.future.GridFutureAdapter.get0(GridFutureAdapter.java:176)
        at o.a.i.i.util.future.GridFutureAdapter.get(GridFutureAdapter.java:139)
        at o.a.i.i.processors.continuous.GridContinuousProcessor.addNotification(GridContinuousProcessor.java:935)
        at o.a.i.i.processors.cache.query.continuous.CacheContinuousQueryHandler.onEntryUpdate(CacheContinuousQueryHandler.java:850)
        at o.a.i.i.processors.cache.query.continuous.CacheContinuousQueryHandler.access$700(CacheContinuousQueryHandler.java:82)
        at o.a.i.i.processors.cache.query.continuous.CacheContinuousQueryHandler$1.onEntryUpdated(CacheContinuousQueryHandler.java:413)
        at o.a.i.i.processors.cache.query.continuous.CacheContinuousQueryManager.onEntryExpired(CacheContinuousQueryManager.java:429)
        at o.a.i.i.processors.cache.GridCacheMapEntry.onExpired(GridCacheMapEntry.java:3046)
        at o.a.i.i.processors.cache.GridCacheMapEntry.onTtlExpired(GridCacheMapEntry.java:2961)
        at o.a.i.i.processors.cache.GridCacheTtlManager$1.applyx(GridCacheTtlManager.java:61)
        at o.a.i.i.processors.cache.GridCacheTtlManager$1.applyx(GridCacheTtlManager.java:52)
        at o.a.i.i.util.lang.IgniteInClosure2X.apply(IgniteInClosure2X.java:38)
        at o.a.i.i.processors.cache.IgniteCacheOffheapManagerImpl.expire(IgniteCacheOffheapManagerImpl.java:1007)
        at o.a.i.i.processors.cache.GridCacheTtlManager.expire(GridCacheTtlManager.java:198)
        at o.a.i.i.processors.cache.GridCacheTtlManager.expire(GridCacheTtlManager.java:160)
        at o.a.i.i.processors.cache.GridCacheUtils.unwindEvicts(GridCacheUtils.java:854)
        at o.a.i.i.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1073)
        at o.a.i.i.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:561)
        at o.a.i.i.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:378)
        at o.a.i.i.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:304)
        at o.a.i.i.processors.cache.GridCacheIoManager.access$100(GridCacheIoManager.java:99)
        at o.a.i.i.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:293)
        at o.a.i.i.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1556)
        at o.a.i.i.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1184)
        at o.a.i.i.managers.communication.GridIoManager.access$4200(GridIoManager.java:126)
        at o.a.i.i.managers.communication.GridIoManager$9.run(GridIoManager.java:1097)
        at o.a.i.i.util.StripedExecutor$Stripe.run(StripedExecutor.java:483)
        at java.lang.Thread.run(Thread.java:745)

最佳答案

strip 池负责消息处理。此警告告诉您某些条纹没有任何进展。这可能是由于网络连接不良或将大量对象放入缓存或队列时发生的。

您可以在这些线程中找到有关它的更多信息:

http://apache-ignite-users.70518.x6.nabble.com/Possible-starvation-in-striped-pool-td14892.html

http://apache-ignite-users.70518.x6.nabble.com/Possible-starvation-in-striped-pool-message-td15993.html

关于ignite:使用 igniteCache 时 strip 池中可能出现饥饿,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46215642/

相关文章:

java - Apache Ignite 和 Yardstick

linux - 为什么我程序中的这个线程会挨饿?

asp.net-core - 了解 PerfView 中的 BLOCKED_TIME

java - Apache Ignite - 如何发展带注释的类的架构/属性

linux - linux进程调度器如何防止进程饥饿

java - 链表节点的线程安全切换,无需锁定整个链表

c++ - 如何防止线程饥饿

java - Ignite Marshaller 不使用二进制或优化的

java - Apache Ignite 的示例(Ignite JDBC 驱动程序)无法连接,因为没有找到适合 url 的驱动程序(jdbc :mysql://***)

c# - 如何使用 c# .net 在 Apache Ignite 中停止服务器(节点)