TCP UDP and RMI Throughput
It is interesting to see the performance evaluation of TCP, UDP and RMI. This article shows the simple scenario to test their performance by looking at latency and throughput. The test result shows that RMI has poor performance compares to TCP and UDP. TCP and UDP has comparable result though UDP gains slightly higher than TCP.
From this work, I can draw conclusion that RMI is easy to implement the function based program but it is not good for intensive exchange packets. UDP and TCP are good for packet transmissions but they are hard to implement protocol. Though UDP has less overhead, it is not guarantee the packet delivery. At last, TCP is good for almost scenario with good administration.
Continue Reading »
Java RMI Database Application
Java RMI has been introduced to reduce the complexity in developing protocol that relies on UDP and TCP. Java RMI provides a simpler mechanism to invoke method remote. Here I will discuss the development of Java RMI with database application. This sample application is layered into 3 tier: client, RMI server or middleware, and database.
Client is very thin and lightweight. Here client is only responsible for user interface while large business processes are handed over to RMI middleware. The middleware contains server objects distributed in registry service. The client will lookup the entire object from the registry service and invoke methods remotely. Database server stands on another layer that will be accessed by the data accessors in RMI middleware.
If you do not understand what Java RMI is, better to have a look on these articles:
Continue Reading »
Stub and Skeleton
Java RMI is powerful middleware that replaces raw request/reply method as UDP and TCP. The core technology to make it works is Stub and Skeleton function. Stub is located on the client side while Skeleton is located on server side. The role of stub and skeleton is to do marshalling and unmarshalling meaning that it will squash the argument and return value of a method to be a standard format for storing in a file or transferring over the network. Without Stub and Skeleton, java RMI cannot work.
Note on Stub and Skel files (Skeleton)
- Java JDK 1.6 does not require to have Stub and Skeleton file (Skel for short) as it takes advantage of reflection to accomplish the task
- Java JDK 1.5, it requires only Stub file at the client. To generate stub file:
PowerServer_Stub.class will be generated
- Java JDK prior to 1.4 (not quite sure), it requires both Stub and Skel files
rmic -vcompat PowerServer
PowerServer_Skel.class will be generated
There is a tricky in getting Java RMI works and runs. First, you need to understand the Overview of Java RMI and know how to implement it. Java RMI relies on 3 components–client, server and registry service.
Note: This article refers to the code developed in How to Implement Java RMI.
There are 2 ways to deal with registry service.
rmiregistry command in Dos prompt or Console if it is not created in the code
- Create RMI registry service in the code
Registry registry = LocateRegistry.createRegistry(1099);
- It needs interface class(
IPower.java) created in Step 1 of How to Implement Java RMI article
- It also needs interface class (
- Be sure that you pointed to the right server’s registry service