java – Hazelcast分区计数和线程并发

前端之家收集整理的这篇文章主要介绍了java – Hazelcast分区计数和线程并发前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在“17.4.1.分区感知操作”下的Master Hazelcast电子书中,它指出:

To execute partition-aware operations,an array of operation threads is created.

A single operation thread executes operations for multiple partitions;

Each partition belongs to only 1 operation thread.

假设我在一个17节点集群上有默认的271个分区,每个集群有16个分区线程.在集群中分配分区,这意味着所有分区都有一个与之关联的线程,每个线程只有1个分区(对我来说似乎是最佳情况).

忽略备份和近缓存,当我创建一个IMap实例时,这是否意味着我只能在整个集群的每个映射分区上执行1个并发的put / get操作?更进一步,如果我附加一个MapStore,这是否意味着我只能对我的后端数据库运行271个并发操作,因为没有办法制作异步MapStore?

我之所以提出这个问题,是因为我有一个高度并发的Web应用程序,而且我最近将数据存储区切换为与Hazelcast IMap一起运行.应用程序接受数千个并发连接,几乎每个请求至少执行分布式映射的get操作.我看到很多这些错误

com.hazelcast.core.OperationTimeoutException:20000毫秒无响应.中止调用调用{serviceName =’hz:impl:mapService’,op = com.hazelcast.map.impl.operation.GetOperation {identityHash = 1003806362,serviceName =’hz:impl:mapService’,partitionId = 244,replicaIndex = 0,callId = 55212219,invocationTime = 1462913274676(2016年5月10日星期二20:47:54),waitTimeout = -1,callTimeout = 10000,name = …,name = …},tryCount = 250,tryPauseMillis = 500,invokeCount = 1,target = Address [10.0.2.221]:5701,backupsExpected = 0,backupsCompleted = 0,connection = Connection [/10.0.2.219:5701 – > /10.0.2.221:14565],endpoint =地址[10.0.2.221]:5701,alive = true,type = MEMBER}未收到任何回复! backup-expected:0 backup-completed:0

这可能只是由于MapStore在尝试从数据库获取时阻塞了分区线程吗?我还应该注意到虽然它表示没有响应20000毫秒,但20秒还没有过去.

我在Java 8上运行Hazelcast 3.6.2.

最佳答案

gnoring backups and near-caches,when I create an IMap instance,does this mean I can only ever have 1 concurrent put/get operation executing on every map partition across the cluster?

正确.因此,映射a和映射b的分区25可能正忙于处理映射b的操作,因此映射a的操作需要等待.

Going further,if I attach a MapStore,does this mean I can only ever have 271 concurrent operations running against my backend database,since there is no way of making async MapStores?

对于通过mapstore的写入 – >是.但我不是那种带有writebehind(异步)mapstores线程模型的familair.

Could this simply be caused by the MapStore blocking the partition thread while it’s trying to fetch from the database? I should also note that while it says No response for 20000 ms,20s has not elapsed.

这很可能是原因.

原文链接:https://www.f2er.com/java/437303.html

猜你在找的Java相关文章