disruptor-pattern

Using Hazelcast map with LMAX disruptor - performance impact

我与影子孤独终老i 提交于 2020-01-06 06:09:09
问题 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. 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. Now the only

Using disruptor in the Java Servlet and handling multiple events [closed]

牧云@^-^@ 提交于 2020-01-05 09:13:11
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago . I am using the LMAX disruptor in my web application which takes the http request parameters and handle them to the ringbuffer. 3 event-handlers handle and process data, the final one, saves it to the database. Initialize the ringbuffer once, when the servlet is instantiated.

should I synchronize access to disruptor Next/Publish methods?

放肆的年华 提交于 2020-01-02 11:24:10
问题 I'm not providing full listing as below code is enough for those who familar with disruptor. The question is if calling Next and Publish methods is thread-safe. Between examples below what would be the correct one? Note that Attach can be called from different threads at the same time. And I have multiple consumers. Example1. Lock everything: private object attachLock = new object(); // can be called from parallel threads public void Attach(OrdersExecutor oe) { lock (attachLock) { long

should I synchronize access to disruptor Next/Publish methods?

雨燕双飞 提交于 2020-01-02 11:24:09
问题 I'm not providing full listing as below code is enough for those who familar with disruptor. The question is if calling Next and Publish methods is thread-safe. Between examples below what would be the correct one? Note that Attach can be called from different threads at the same time. And I have multiple consumers. Example1. Lock everything: private object attachLock = new object(); // can be called from parallel threads public void Attach(OrdersExecutor oe) { lock (attachLock) { long

Performance cost of serialization and compress a Object in Java

纵饮孤独 提交于 2019-12-23 23:08:55
问题 The application keeps receiving objects named Report and put the objects into Disruptor for three different consumers. With the help of Eclipse Memory Analysis, the Retained Heap Size of each Report object is 20KB on average. The application starts with -Xmx2048 , indicating the heap size of the application is 2GB. However, the number of the objects is around 100,000 at a time, which means that the total size of all the object is roughly 2GB. The requirement is that all 100,000 objects should

Disruptor: Gating Sequence

戏子无情 提交于 2019-12-22 18:34:29
问题 I am studying Disruptor in Java. I do not understand what's meaning of gating sequence. I know it core part is ring buffer and every buffer is associated with a sequence number. 回答1: The purpose of gating sequences is to gate publishers to prevent the RingBuffer from wrapping. 回答2: Actually the core part of LMAX's implementation is the Sequencer and its Sequence s. And so the ringBuffer implement those. The gatingSequences that you are referring to act as a cursor to each Sequencer that is

Can the LMAX Disruptor be ported to C#?

℡╲_俬逩灬. 提交于 2019-12-22 09:19:56
问题 I know some people are working on a C++ port. Is a C# port possible? In particular I'm thinking about the limitations around volatile fields being only 32-bit in C#. If that's the only problem, does anything think it worthwhile to write that ring buffer to only have the number of slots allowed in 32-bits. That's many many fewer events in the lifetime of the system. Do I have this right? Can we wrap back to 0 at some point? Thank you in advance. 回答1: It already has been ported to C#: http:/

Disruptor example with 1 publisher and 4 parallel consumers

為{幸葍}努か 提交于 2019-12-20 15:16:11
问题 In this example https://stackoverflow.com/a/9980346/93647 and here Why is my disruptor example so slow? (at the end of the question) there is 1 publisher which publish items and 1 consumer. But in my case consumer work is much more complicated and takes some time. So I want 4 consumers that process data in parallel. So for example if producer produce numbers: 1,2,3,4,5,6,7,8,9,10,11.. I want consumer1 to catch 1,5,9,... consumer2 to catch 2,6,10,... consumer3 to catch 3,7,11,... consumer4 to

disruptor onEvent handler appears to be too fast for java synchronized lock

孤街醉人 提交于 2019-12-12 03:59:30
问题 I am publishing 2 or more different events to an output disruptor at the same time (one right after the other) and the disruptor onEvent is usually sending only the last to be published event to the IO session. Basically the event data is overwritten. Whereas I want to see a copy of each event on the session layer. I have tried synchronizing the session layer on a lock but the publisher is usually still too fast even for the lock (sometimes it is working but most of the time it's not). Here's

Observable to batch like Lmax Disruptor

[亡魂溺海] 提交于 2019-12-10 23:55:45
问题 Those who are familiar with lmax ring buffer (disruptor) know that one of the biggest advanatages of that data structure is that it batches incomming events and when we have a consumer that can take advantage of batching that makes the system automatically adjustable to the load, the more events you throw at it the better. I wonder couldnt we achieve the same effect with an Observable (targeting the batching feature). I've tried out Observable.buffer but this is very different, buffer will