最高效 - 性能明智 - 用于JVM间通信 [英] Most Efficient - Performance wise - for inter JVM communication

查看:180
本文介绍了最高效 - 性能明智 - 用于JVM间通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java应用程序,需要在不同进程之间进行通信。进程可以在相同的JVM或不同的JVM中运行,但是在同一台机器上运行。

I have a Java application that require communication between different process. Process could run in same JVM or different JVM, but runs on the same machine.

我的应用程序需要向另一个进程(相同或不同的JVM)提交消息和忘了它。类似于IBMMQ之类的消息传递队列,但是简单,只使用内存,没有IO到硬盘以获得性能提升。

My application need to submit "messages" to another process (same or different JVM) and forgot about it. similar to messaging queue like IBM "MQ", but simple, and only use memory, no IO to hard disk for performance gains.

我不确定Performance prescriptive的最佳方法是什么。

I'm not sure what is the best approach from Performance prescriptive.


  • 我想知道RMI在性能方面是否有效,我认为它需要一些开销。

  • 使用本地主机的TCP / IP套接字怎么样?

还有其他想法吗?

推荐答案


我想知道RMI在性能方面是否有效,我认为它需要一些开销。

I wonder if RMI is efficient in terms of Performance, I think it require some overhead.

RMI对其功能有效。它比大多数人需要的要多得多,但通常足够快。你应该能够获得每秒1-3 K消息的顺序,延迟大约1毫秒。

RMI is efficient for what it does. It does much more than most people need, but is usually more than faster enough. You should be able to get of the order of 1-3 K messages per second with a latency around 1 milli-second.


怎么样使用本地主机的TCP / IP套接字?

What about TCP/IP socket using local host?

这总是一个选项,但使用普通Java序列化这不会比使用它快得多RMI。如何进行序列化和反序列化对于提高性能至关重要。

That is always an option but with plain Java Serialization this will not be a lot faster than using RMI. How you do the serialization and deserialization is critical for high performance.

一个重要的注意事项是大部分时间都花在了序列化和消除消息,大多数传输都无法帮助您,因此如果您想要获得最佳性能,则必须考虑有效的编组策略。大多数传输协议仅对原始字节进行基准测试。

An important note is that much of the time is spent serializing and deserilizing the message, something most transports don't help you with, so if you want maximum performance you have to consider an efficient marshalling strategy. Most transport protocols only benchmark raw bytes.

具有讽刺意味的是,如果您愿意使用磁盘,它可能比TCP或UDP(如ZeroMQ)更快,并且您可以获得持久性免费。

Ironically if you are willing to use disk, it can be faster than TCP or UDP (like ZeroMQ) plus you get persistence for "free".

这个库(我是作者)可以在进程间每秒执行数百万条消息,延迟低至100纳米 - 秒(比ZeroMQ低350倍) https://github.com/peter-lawrey/Java-Chronicle 优点是

This library (I am the author) can perform millions of messages per second between processes with latency as low as 100 nano-second (350x lower than ZeroMQ) https://github.com/peter-lawrey/Java-Chronicle Advantages are


  • 超快速序列化和反序列化,大多数传输基准测试都避免包含这一点,因为它通常需要比传输成本更长的时间。

  • 是您可以在邮件发送后随时监控队列之间发生的事情。

  • 重播所有邮件。

  • 生产者可以是消费者之前的任何数据量,可以优雅地处理微爆,达到磁盘空间的大小。例如消费者可能落后于TB。

  • 支持通过TCP进行复制。

  • 重新启动消费者或生产者很大程度上是透明的。

  • ultra fast serialization and deserialization, something most transport benchmarks avoid including this as it often takes much longer than the transport costs.
  • is that you can monitor what is happening between queues any time after the message was sent.
  • replay all messages.
  • the producer can be any amount of data ahead of your consumer to handle micro-burst gracefully up to the size of your disk space. e.g. the consumer can be TBs behind.
  • supports replication over TCP.
  • restart of either the consumer or producer is largely transparent.

这篇关于最高效 - 性能明智 - 用于JVM间通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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