简体   繁体   English

Hazelcast 不使用它自己的分区操作线程导致缺乏秩序

[英]Hazelcast not using it's own partition-operations threads resulting in lack of order

I would like some support with the management of partition-aware operations.我想要对分区感知操作的管理提供一些支持。 I am not able to see use of partition-operation threads within eclipse debugger (see attached images).我无法在 eclipse 调试器中看到分区操作线程的使用(参见附图)。 Only ForkJoinPool workers are ever used.仅使用 ForkJoinPool worker。

This is applicable to the following operations:这适用于以下操作:

  1. map.submitToKey(strategyId, new TriggerUpdateEntryProcessor(update)); map.submitToKey(strategyId, new TriggerUpdateEntryProcessor(update)); This is using a Offloadable implementation (but not readonly) therefore should be processed in blocking mode, but it does not.这是使用 Offloadable 实现(但不是只读),因此应该以阻塞模式处理,但事实并非如此。
  2. executorService.executeOnKeyOwner(triggerUpdateTask, strategyId); executorService.executeOnKeyOwner(triggerUpdateTask, strategyId); It's also meant to be possible to submit a partition-aware task https://docs.hazelcast.com/imdg/4.2/performance/data-affinity#partitionaware but this doesn't work either.这也意味着可以提交分区感知任务https://docs.hazelcast.com/imdg/4.2/performance/data-affinity#partitionaware但这也不起作用。

Also, regardless of submitTo or executeOn, both act the same.此外,无论是 submitTo 还是 executeOn,两者的行为都是一样的。

Should I see threads running under partition-operations?我应该看到在分区操作下运行的线程吗? Is this a configuration issue.这是配置问题吗。

I am assuming that executorService functionality is correct in that it's only partition-aware in terms of running the thread on the right member but not running on a partition-operation thread, though would still expect it to run on a generic-operation thread.我假设 executorService 功能是正确的,因为它只在正确的成员上运行线程而不是在分区操作线程上运行,但仍然期望它在通用操作线程上运行。

This is confusing in the documentation as there are limited examples of partition operations and “partition” it seems is used to refer to both literal partition threading and member location.这在文档中令人困惑,因为分区操作的示例有限,而且“分区”似乎用于指代文字分区线程和成员位置。

• The only examples are IMap.get is and executor.submitToMember is not. • 仅有的例子是IMap.get 是而executor.submitToMember 不是。 But executor also has submitToKeyOwner so will get processed on the right partition but will it be by that member's generic-operation thread instead of partition-operation... • Data Affinity topic states "Data affinity ensures that related entries exist on the same member. If related data is on the same member, operations can be executed without the cost of extra.network calls and extra wire data. This feature is provided by using the same partition keys for related data."但执行者也有 submitToKeyOwner,因此将在正确的分区上进行处理,但它是由该成员的通用操作线程而不是分区操作... • 数据亲和力主题指出“数据亲和力确保相关条目存在于同一成员上。如果相关数据在同一成员上,则可以执行操作而无需额外的网络调用和额外的线路数据。此功能是通过对相关数据使用相同的分区键来提供的。”

观察

空闲线程

If you implement Offloadable the entry processor will NOT run on the partition thread.如果您实现Offloadable ,入口处理器将不会在分区线程上运行。 From the Javadoc:来自 Javadoc:

If the EntryProcessor implements the Offloadable interface the processing will be offloaded to the given ExecutorService allowing unblocking the partition-thread, which means that other partition-operations may proceed.如果 EntryProcessor 实现了 Offloadable 接口,处理将被卸载到给定的 ExecutorService,从而允许解除分区线程的阻塞,这意味着其他分区操作可以继续进行。 The key will be locked for the time-span of the processing in order to not generate a write-conflict.为了不产生写入冲突,密钥将在处理的时间跨度内被锁定。 In this case the threading looks as follows:在这种情况下,线程看起来如下:

partition-thread (fetch & lock)分区线程(获取和锁定)
execution-thread (process)执行线程(进程)
partition-thread (set & unlock, or just unlock if no changes)分区线程(设置和解锁,或者如果没有变化就解锁)

If you want to run the entry processor on the partition thread then just don't implement Offloadable .如果您想在分区线程上运行入口处理器,那么就不要实现Offloadable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM