简体   繁体   English

Java Disruptor模式和低延迟

[英]Java Disruptor pattern and low latency

Q1) Does anyone familiar with the Java Disruptor pattern know the size of messages they benchmarked their results against? Q1)熟悉Java Disruptor模式的人是否知道他们对结果进行基准测试的消息大小? I am writing a similar system (out of pure interest) and when I read the description of their testing there is no mention of the message size sent? 我正在编写一个类似的系统(出于纯粹的兴趣),当我阅读他们的测试描述时,没有提到发送的消息大小?

http://code.google.com/p/disruptor/wiki/PerformanceResults http://code.google.com/p/disruptor/wiki/PerformanceResults

Q2) Is the disruptor for computer to computer communications, or inter-process? Q2)是计算机与计算机通信或进程间的破坏者吗? I originally had the impression it was for computer to computer but their work is labelled "inter thread" messaging library? 我最初的印象是计算机到计算机,但他们的工作被标记为“inter thread”消息库?

Disruptor is not just within the same machine, it is withing a single process. Disruptor不仅仅在同一台机器内,它只需要一个进程。 When they say "inter-thread", they mean that it is for sending messages between threads of one process. 当他们说“线程间”时,它们意味着它用于在一个进程的线程之间发送消息。

The message size is actually almost irrelevant because the messages don't get copied. 消息大小实际上几乎无关紧要,因为消息不会被复制。 The messages are all fixed at the beginning and reused, so it doesn't really matter how big they are. 消息在开始时都是固定的并且可以重复使用,所以它们的大小并不重要。

Although Im not entirely familiar, just exploring it... 虽然我不完全熟悉,只是探索它...

1) It looks like from the perf test folder in the src that they are using the ValueEvent class, which just holds a long, there is also some other xxxEvent classes that are used in other perf tests that are slightly bigger but from what i can gather so far, only a long is used within the ring buffer. 1)从src中的perf测试文件夹看起来它们正在使用ValueEvent类, 它只包含一个long,还有一些其他的xxxEvent类在其他性能测试中使用稍微大一点但是我可以到目前为止,在环形缓冲区内只使用了很长的时间。

2) I would assume it is for completely same machine inter thread comms. 2)我认为这是完全相同的机器间线程通信。 the latency & uncertainty of comms across machines would make it extremely slow. 跨机器的通信的延迟和不确定性会使它非常慢。 (relatively) and then the project would also need to deal with socket comms, which I haven't seen in this lib. (相对)然后该项目还需要处理套接字通信,我在这个库中没有看到。

1,Disruptor not care the size of message. 1,Disruptor不关心消息的大小。 but result should be linearly down by size of message(workload increased, the speed decreased) 但结果应该根据消息的大小线性下降(工作量增加,速度下降)

In deed it's not care the message. 在行动中,它并不关心这个消息。

The KEY of the library is the ID of buffer. 库的KEY是缓冲区的ID pointer, position, cursor, indicator, all both mean the same. 指针,位置,光标,指示器,都意味着相同。 Disruptor self call it as " sequence " Disruptor自称为“ 序列

Once the ID got, the whole world only owned by you!:) so ONLY one writer . 一旦身份证拿到,整个世界只归你所有!:)所以只有一个作家 the real key point.:) 真正的关键点。:)

2,not C2C, nor P2P:). 2,不是C2C,也不是P2P :)。 just T2T. 只是T2T。 the T is thread. T是线程。 peter-lawrey have a great library Java-Chronicle , can be used in P2P case. peter-lawrey有一个很棒的Java-Chronicle库 ,可以用于P2P案例。 a new article on java dzone: http://java.dzone.com/articles/ultra-fast-reliable-messaging 关于java dzone的新文章: http ://java.dzone.com/articles/ultra-fast-reliable-messaging

3, the core pattern should be capable to clone to cross boundary use cases. 3,核心模式应该能够克隆到跨界用例。 every thing is ID. 每件事都是身份证。 As to the message, customerized. 至于信息,定制化。

4, another important point, is the cache of volatile . 4,另一个重点,就是volatile缓存 a great example on github github上的一个很好的例子

5, JDK8 intro a new annotation @Contended , seems sexy. 5,JDK8介绍一个新的注释@Contended ,看起来很性感。 details about contended 有关竞争的细节

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

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