If the RMI client & server are located on the same machine, what is the overhead of invoking remote method in this situation compared to a local method call? Will the call go through the entire TCP/IP stack, stub and skeleton or will it will be treated as a local invocation?
This scenario is comparable to running the RMI client and server processes in a distributed mode (with each running on a separate machine), where the communication takes place by going through the entire TCP/IP stack, stub and skeleton. Thus, RMI calls between the client and server running on the same machine will not be treated as a local invocation. The overhead here is obvious, and the performance will be relatively poor compared to socket-based communication.