fastest (low latency) method for Inter Process Communication between Java and C/C++

后端 未结 10 830
隐瞒了意图╮
隐瞒了意图╮ 2020-11-29 14:45

I have a Java app, connecting through TCP socket to a \"server\" developed in C/C++.

both app & server are running on the same machine, a Solaris box (but we\'re

相关标签:
10条回答
  • 2020-11-29 15:24

    I don't know much about native inter-process communication, but I would guess that you need to communicate using native code, which you can access using JNI mechanisms. So, from Java you would call a native function that talks to the other process.

    0 讨论(0)
  • 2020-11-29 15:25

    The question was asked some time ago, but you might be interested in https://github.com/peter-lawrey/Java-Chronicle which supports typical latencies of 200 ns and throughputs of 20 M messages/second. It uses memory mapped files shared between processes (it also persists the data which makes it fastest way to persist data)

    0 讨论(0)
  • 2020-11-29 15:28

    Oracle bug report on JNI performance: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4096069

    JNI is a slow interface and so Java TCP sockets are the fastest method for notification between applications, however that doesn't mean you have to send the payload over a socket. Use LDMA to transfer the payload, but as previous questions have pointed out, Java support for memory mapping is not ideal and you so will want to implement a JNI library to run mmap.

    0 讨论(0)
  • 2020-11-29 15:31

    Here's a project containing performance tests for various IPC transports:

    http://github.com/rigtorp/ipc-bench

    0 讨论(0)
提交回复
热议问题