TCP UDP and RMI Performance Evaluation

22 Mar 2011 by

TCP UDP and RMI Throughput

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 »

6 responses so far

Java RMI Database Application

20 Mar 2011 by

Java RMI Database Application

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 »

21 responses so far

Stub and Skeleton

11 Mar 2011 by

Stub and Skeleton

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:
    • rmic PowerServer
    • 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_Stub.class and PowerServer_Skel.class will be generated

2 responses so far

How to Implement Java RMI?

10 Mar 2011 by

Java RMI Implementation

Java RMI Implementation

Implement Java RMI could be ever easier if you follow my rule strictly. You need to understand Java RMI Overview before you can catch the code.

According to the above figure, there are 4 steps need to be involved in Java RMI development. I will give you an example of creating Java RMI application dealing with Fibonacci and Factorial calculation using badly recursive algorithm. These two methods will be available for invocation at the server side. I will call the server program as PowerServer and client program as PowerClient.

Continue Reading »

2 responses so far

Marshalling and Serialization

08 Mar 2011 by

Marshal object to a file

Marshal object to a file

In practice, the terms marshalling and serialization are used interchangeably to describe the process of squashing data types into a well-defined intermediate format that is suitable for transmission on a network or for storage in a file. You might be familiar with Remote Procedure Call (RPC) as the core stub function needs to marshal the argument and return value of a method before they are actually transmitted over the network.

This article, I will show you with an example of marshalling and unmarshalling a Java object. Be reminded that:

  • Not all data types can be serialized
  • User-defined class must implement Serializable interface
  • Attempt to marshal or serialize a non-serializable object will throw an Exception in Java

Continue Reading »

No responses yet

Multicast Programming with Java

06 Mar 2011 by

Multicast Overview

Multicast Overview

Multicast is a special feature of UDP protocol that enable programmer to send message to a group of receivers on a specific multicast IP address and port. Multicast has advantage in this scenario.

Let us say I want to send “Hello” message to 100 computers on my network. Perhaps, my first solution is to send the “Hello” message to each of them via UDP or TCP.

What a problem is this scenario?

There are 3 generic problems:

  • Consume a lot of processing power on sender as it needs to send to every receiver
  • Bandwidth flooding
  • The arrival time is not the same for every receiver

Continue Reading »

10 responses so far

TCP Programming with Java

04 Mar 2011 by

TCP Programming has been developed for the sake of reliability in data transmission. Unique feature of TCP is Acknowledgment scheme, Packet ordering and congestion control. These make TCP more popular in network transmission control protocol. Nowadays, the protocol dominant in the Internet is HTTP but be remembered that it relies on TCP architecture. There are several variant of TCP protocols that have been extensively researched. For example, TCP Tahoe, TCP Reno, TCP New Reno, TCP Westwood, TCP Vegas, etc. In contrast with UDP Programming, TCP is much easier.

Continue Reading »

4 responses so far

UDP Programming with Java

02 Mar 2011 by

Resource on UDP Programming is limited and even rare for some programming languages. For TCP Programming, I guess, there is a lot and many languages support it. For example, Java, C, C++, C#, WinSock, etc. So this article is to contribute to those limitation by taking an advantage of java.net package that supports UDP programming interface. The understanding of UDP and TCP is required.

Continue Reading »

6 responses so far