Reputation: 5434
I have a c# winapp that calls a java app by tcp and sends everything back by tcp to the c#.
The reason why I'm using java is because I received a java api. So I wrote a small java app that calls that api and get all the data I need.
So I was wondering if there is another solution for this. Because it's going slow, especially with a lot of data.
Thanks
Upvotes: 5
Views: 460
Reputation: 5434
I did some profiling in the java and the method of the api I received are taking the most of the time I noticed. If I receive around the 1200 records I have a waiting time of 5 minutes. Once I receive it in c#, it only needs a few seconds to add it to objects and show me a view of the results.
So I think the problem isn't really at my end or can it be better if I used something like the JNBridge or webservice?
Upvotes: 0
Reputation: 33534
There are also commercial solutions that allow invoking Java from .NET (and vice-versa). I used JNBridge a few years ago, and it's great.
You can download a 30-day free trial at http://www.jnbridge.com/bin/downloads.php?pr=1&id=0 (no, I don't work for them).
Upvotes: 0
Reputation: 4104
I'd recommend trying to use two good Web Service stacks. It would be very interesting to hear your results. It sounds counter-intuitive but these stacks are optimized even though they have the burden of converting to text. Also, it sholdn't be much work to take the stacks in. At least its easy in C# to parallelize calling web services if that's appropriate for your situation.
Upvotes: 0
Reputation: 2079
You received a java api and you wrote a small java api ... so you know java. Why not write the rest of the application in java as well?
Sometimes is easier to rewrite the "uncompatible" parts dependeing on how much work it is.
Upvotes: 1
Reputation: 272217
Sounds to me like you need to profile this. Are you sure it's the network aspect that is slow ? Or the serialisation/deserialisation, or the actual client/server processing beyond the data transmission.
Before you address profiling solutions, you should identify the particular problem point.
Upvotes: 2
Reputation: 1062502
TCP over the local machine should be pretty fast (named pipes might be a bit faster, but may be harder to do at both ends).
The biggest bottleneck is likely to be serialization and deserialization of the data. What format are you currently using to represent the data?
Upvotes: 5