将Hazelcast映射与LMAX干扰器配合使用-对性能的影响 [英] Using Hazelcast map with LMAX disruptor - performance impact

查看:139
本文介绍了将Hazelcast映射与LMAX干扰器配合使用-对性能的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于弹性考虑,我们需要运行订单管理器应用程序的Active-Active实例.在我们的团队中,Hazelcast是用于在弹性实例之间共享状态的首选分布式缓存.

We have a requirement to run Active-Active instances of an order manager application for elasticity. Within our team, Hazelcast is the preferred distributed cache for sharing state across elastic instances.

在应用程序中,我正在使用单写程序模式以及LMAX干扰程序库.因此,基本上,我只有一个繁忙的旋转主线程,该线程从干扰器(环形缓冲区)读取传入的订单事件,并快速处理该事件,而无需进行任何阻塞操作.

Within the application I am using single-writer pattern along with LMAX disruptor lib. So basically I have a single busy spinning main thread which reads incoming order events from the disruptor (ring buffer) and quickly processes it without involving any blocking operation.

现在唯一的问题是,一旦我的主线程接收到一个事件,它就会首先在Hazelcast分布式映射中执行查找(以获取当前订单的状态),并且hazelcast查找相对较慢(约5个操作) 10毫秒).我想了解:

Now the only issue is that, as soon as my main thread receives an event, it first performs a lookup in a Hazelcast distributed map (to fetch current order’s state), and hazelcast lookup is relatively a slow operation (~5-10 millis). I wanted to understand:

1)如果这仍然可以接受,即使用LMAX干扰器时从分布式地图读取

1) if this is still an acceptable thing I.e. reading from a distributed map when using LMAX disruptor

2)加上Hazelcast调用是涉及分布式锁的线程安全线程,并且LMAX专家建议避免在主业务线程中使用线程相关的锁,以使CPU优化的代码高速缓存保持高温,这确实使Lzelcast调用成为LMAX Disruptor的反模式主处理线程?

2) plus since Hazelcast calls are thread safe involving distributed locks and LMAX guys suggest avoiding thread related locks in the main business thread so that CPU optimized code caches remain hot, does making a call to hazelcast an anti-pattern from LMAX Disruptor’s main processing thread?

有人可以为此加2美分吗?

Could someone add their 2 cents on this?

推荐答案

我会说这是不可接受的. IMap不仅会无限期地阻塞,而且还会进行网络调用.

I would say it's not acceptable, of course. IMap is not only blocking for indefinite time, it also doing network calls.

我认为要走的路是

  • 将IMap访问权限拆分为另一个线程并进行通信 在单独的环形缓冲区中使用异步事件来处理它
  • 或订阅IMap条目侦听器并将数据存储在内存中(如果合适).
  • either split off the IMap access into another thread and communicate with it using async events in separate ring buffers
  • or subscribe to IMap entry listener and store data in the memory (if it fits).

这篇关于将Hazelcast映射与LMAX干扰器配合使用-对性能的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆