Search code examples
javacrpc

What is the best approach in java to call a C function running on another server?


What is the best approach in java to call a C function running on another server? My application written in Java and running on an application server on server 'A' and I need to call a C function running on another server 'B' that doesn't have java installed.

Should we build a web service on server B to accept requests from my Web application on server A? or just call it remotely using RPC? and what is the performance of both?


Solution

  • First of all:

    Just call it using RPC

    There is no such thing as "just" when talking RPC. Unless you already have some CORBA or whatever solution in place, you will have to invest a serious amount of time to get this working.

    Using a web service adds multiple layers of abstraction, which can affect latency. But of course, that is the more flexible solution.

    I think it is fair (in 2018) to state: a reasonable architecture would provide some sort of (restful) HTTPS service on B. You should only look into other options if there are hard pressing reasons.