Home
 

Simple Interaction

Chapter 4. Simple Interaction

"Simple Interaction" refers to the client/server architecture: A single server and a single client are used. These results are necessary to understand and predict the more complex interactions.

Basic Data Types

The first analysis concerns the basic data types, namely void, boolean, int and float. Both, synchronous and asynchronous performance is tested.

Method

For this we simply call the method for the corresponding data type 1000 times.

        ...
        long t1 = 0;
        long t2 = 0;
        if (method.equals("sync_VV")) {
            t1 = System.currentTimeMillis();

            for (int i=0; i<1000; i++)
                rtt.sync_VV();

            t2 = System.currentTimeMillis();
        }
        ...
        else if (method.equals("sync_LL")) {
            org.omg.CORBA.IntHolder tmp_L =
                new org.omg.CORBA.IntHolder();

            t1 = System.currentTimeMillis();

            for (int i=0; i<1000; i++)
                rtt.sync_LL(42, tmp_L);

            t2 = System.currentTimeMillis();
        }
        ...
        else {
            System.out.println("Unknown method: " + method);
        }

        System.out.println(t2-t1);

Figure 4-1. RTT Calls for the Basic Data Types

Results

Figure 4-2. Basic Data Types RTT (Synchronous Calls)

As can be seen in Figure 4-2 there are some differences in transferring the basic data types. First we should take a look at the transferred data.

void

No data is transferred. This is the minimum call time.

boolean

Transfer of 1 byte, as specified in the GIOP (General Inter-ORB Protocol, [5]).

int

Transfer of 4 bytes, as specified in the GIOP.

float

Transfer of 4 bytes, as specified in the GIOP.

The transfer of void, boolean and int work as expected: Marshaling and transfer of more data takes more time. The difference between int and float remains unexplained because there is no obvious difference in GIOP. Most likely, the byte access to ints is more expensive than to floats, but this is a speculation.

Figure 4-3. Basic Data Types RTT

Figure 4-3 shows a comparison between synchronous and asynchrounous calls. Not surprisingly, the asynchronous calls are quite faster than their synchronous counterparts.

The standard deviation is between 200ms and 300ms for all tests.

Note: This comparison is not absolutely fair since we return the same amout of data in the synchronous version and nothing in the asynchronous. Returning something in the synchronous version seemed more practical.