The fastest (in terms of performance) way of exchanging data (rather than objects) between .Net and Java

I know at least one message that has the same words as this. But this is not exactly the same as this post. I am trying to find a way to exchange data between .NET and a Java application. I'm not interested in objects, but just strings if you have.

I have a .NET application that captures real-time data and a Java application that has the ability to analyze and work with this data. I am looking for ways to reuse the same Java application without fully coding it in .NET.

My problem is that the data is "fair" REAL-Time (.NET) and therefore there needs to be an analysis (Java). I can live with microsecond delays, but I cannot afford one second delay. WebServices, Queues (as in Message Queuing), RDBMS are some of the options that I can think of. Is there a better way?

Or did anyone get some real performance metrics for the solutions mentioned above to choose one of them? And just for starters: RDBMSs are not "THAT" good for inserting / updating / reading at the same time (at least with a crude way to work with a DBMS). (Deadlocks?)

+4
source share
9 answers

What are “objects” if not a mechanism for describing “data”? But I'm distracted - I suspect I'll look at the TCP socket between them. If the data is very simple, then fine - just write directly to the stream; if there is any complexity, perhaps use something like “protocol buffers” to provide an easy way to read / write dense data into a stream without having to write each last byte yourself.

I think microsecond delays will be a problem for anyone here ... will they make millisecond delays?

+7
source

For completeness:

Another possible is to use Named Pipes , this should be pretty fast, and I would suggest (being a java guy, I can only imagine) that .NET has its own support for them. The downside is that on the windows you will either have to write the JNI extension, or use a library, such as JNA , to navigate the Win32 API with Java.

+2
source

Sounds like a local socket. The delay should be a minimum of ms or less.

0
source

Depending on your program, you may receive some funds from what @Cowan reports in response to Any concept of shared memory in java , his answer is: Any concept of shared memory in Java

In short: he says you can use memory mapped files between two processes on the same computer. This could theoretically work between .NET and java, assuming .NET has some support for memory mapped files.

0
source

Different machines communicate with each other, sending messages to sockets. Please check the link below.

Real-world socket programming

0
source

The answers presented here are wonderful. One idea that may be of interest, but probably requires more problems, than it costs to load both virtual machines in the same process (both the JVM and the CLR can be loaded into their own Windows application) and give them access to their own code, Java through JNI and .Net through display functions for the native code that they allow.

You can also use the built-in queue semaphores to wake up a stream on one side or the other when data is being updated.

While JNI transitions are costs, they are likely to still be faster than implementing a local local socket.

0
source

How is your Java application currently deployed? It sounds like you are ready to make some changes to it, so I assume that you have access to the source code.

I know this is not much, but could you compile the Java application in the J # compiler so that your .NET application has its own access to it?

0
source

You can convert your compiled java application to .NET using IKVM . After that, you can change the logic of your .NET application so that it does not transfer data to a Java application, but simply calls up the data processing code written in Java, as it was written and compiled for .NET.

0
source

There are several JMS servers that support .NET and Java clients. They can execute messages within a millisecond.

However, you can try using an RPC solution, such as Hessian RPC or Protobuf RPC. They can achieve lower latency and can cause direct calls between platforms. They also support .NET and Java.

0
source

Source: https://habr.com/ru/post/1299084/


All Articles