简体   繁体   English

将 Hazelcast 地图与 LMAX 干扰器一起使用 - 性能影响

[英]Using Hazelcast map with LMAX disruptor - performance impact

We have a requirement to run Active-Active instances of an order manager application for elasticity.我们需要运行订单管理器应用程序的 Active-Active 实例以实现弹性。 Within our team, Hazelcast is the preferred distributed cache for sharing state across elastic instances.在我们的团队中,Hazelcast 是用于跨弹性实例共享状态的首选分布式缓存。

Within the application I am using single-writer pattern along with LMAX disruptor lib.在应用程序中,我使用单编写器模式和 LMAX 干扰器库。 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.所以基本上我有一个繁忙的旋转主线程,它从干扰器(环形缓冲区)读取传入的订单事件并快速处理它而不涉及任何阻塞操作。

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).现在唯一的问题是,一旦我的主线程接收到事件,它首先在 Hazelcast 分布式地图中执行查找(以获取当前订单的状态),而 Hazelcast 查找操作相对较慢(~5-10 毫秒) . I wanted to understand:我想明白:

1) if this is still an acceptable thing Ie reading from a distributed map when using LMAX disruptor 1)如果这仍然是可以接受的,即在使用 LMAX 干扰器时从分布式地图中读取

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) 另外,由于 Hazelcast 调用是涉及分布式锁的线程安全,并且 LMAX 人员建议避免在主业务线程中使用与线程相关的锁,以便 CPU 优化的代码缓存保持热状态,因此从 LMAX Disruptor 的主处理线程调用 hazelcast 是一种反模式?

Could someone add their 2 cents on this?有人可以为此增加 2 美分吗?

I would say it's not acceptable, of course.当然,我会说这是不可接受的。 IMap is not only blocking for indefinite time, it also doing network calls. IMap 不仅会无限期地阻塞,还会进行网络调用。

I think a way to go is to我认为一种方法是

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

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

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