Sockets and RMI

Sockets are the assembly language of TCP/IP data transfer, whereas other mechanism, such as RMI is the high-level languages. Just as high-level languages – in principle – run faster and use memory more efficiently than high level languages, sockets offer better performance than other transfer mechanisms.

Sockets programs are more difficult and expensive to write than an equivalent high-level language. Sockets model network data transfer as stream of bytes. When your data is simple sockets are ideal choices. But when data is complex, you should consider other options like RMI. However high level protocols do not transfer data as efficiently as sockets. When the volume of data to be transferred is small, this inefficiency posses no problem, however when an application must transfer large volumes of data, the choice of data transfer protocol is complicated.

Several factors guide your choice

My suggestion is to use a high level protocol like RMI, by using a high level protocol you operate on a higher level of abstraction – one closer to the users problems than to the technology applied to solve it. You are therefore more likely to build a correct application – one that actually solves the users problems. Socket programming may confront you with many technology-oriented choices that you may lose sight of the users problem.

Once you have built the working system you can then measure the performance of the system. You may find that the performance of the final system is acceptable and that you have made a right choice. On the other hand the performance of system many not be that acceptable, which case you can replace some or part of the system, to improve in the performance of the system. In either way RMI servers as a initial platform, on the bases of which you can develop a better system.