Jeremy wrote:
> Is this terribly inefficient? What I mean is - using a network socket to
> exchange objects with another app or thread on the same machine. Is there a
> more efficient way to do this? Any good reading on inter-app communication
> (or inter-thread communication within the same VM)?
>
> Thanks,
> -Jeremy
Someone already mentioned using PipedInputStream/PipedOutputStream for
inter-thread communication. Jon Cruz also alluded to the fact that the
typical TCP/IP protocol stack is smart enough to know when the source
and destination are the same machine (even with different addresses)
and can "short-circuit" the processing so that packets never actually
get transmitted on the physical interfaces.
An additional wrinkle in the *NIX environment is named pipes, accessed
using AF_UNIX in the socket call. These are usually very efficient. Of
course they're also are limited to inter-process communication on the
same host.
Always cheaper to use kernel memory, don't you know...
|