LongMsg - CORBA Performance with Massive Data Amount

Description:

One of the most common concerns is the performance of remote calls transferring massive amounts of data.
This example demonstrates the perfomance using a long string and a long array of bytes.

Source:

\Demo\LongMsg

Goal:

Show the performance of a call to a remote CORBA object.
Show the performance of data transport with CORBA.


Example

Step 1. The IDL (LongMsg.idl):

    module LongMsg
    {
        interface Greetings
        {
            typedef sequence  TByteLst;
            
            TByteLst longByteSeq( in TByteLst oParam);    
            string   longString( in string strParam);
        };
    };
    

(Will be compiled into LongMsg.cs)

Step 2. The Server Implementation (within LongMsgSrv.cs):

Both operations will just return the passed in parameter:

    public class GreetingsImpl: LongMsg.GreetingsPOA
    {
        public override string longString(  string a_strParam  )
        {
            string strRet = a_strParam;
            System.Console.WriteLine("Function 'longString' ParameterLen '{0}'", a_strParam.Length);
            return strRet;
        }
        
        public override byte[] longByteSeq(  byte[] a_oParam  )
        {
            byte[] oRet = a_oParam;
			System.Console.WriteLine("Function 'longByteSeq' ParameterLen '{0}'", a_oParam.Length);
			return oRet;		
		}
	} 

Step 3. The Client (LongMsgClt.cs):

Sending a string with 5000 characters to the server:

    public void TestString()
    {
        uint uiStrLen = 5000;
        System.Console.WriteLine("\n\nCreate string with {0} char's.", uiStrLen);
        string strMsgBase = "0123456789";
        string strMsg ="";
        uint uiLoopLen = uiStrLen/10;
        
        for( int i = 0; i < uiLoopLen; i++)
        {
            strMsg += strMsgBase;
        }
        
        System.Console.WriteLine("Remote call with string-len:{0}", uiStrLen);
        System.DateTime oStartTime = System.DateTime.Now;
        
        string strRetMsg = m_oIGreetings.longString( strMsg);
        
        System.TimeSpan oTs = System.DateTime.Now.Subtract( oStartTime);
        System.Console.WriteLine( "2-Way Operation with a String (String-Len:{0})", uiStrLen);
        System.Console.WriteLine( "Duration: Sec:{0}: Msec:{1}", oTs.Seconds, oTs.Milliseconds);    
    }
    

Sending a byte array of 100.000 bytes to the server:

    public void TestByte()
    {
        uint uiArrayLen = 1*100000;
        System.Console.WriteLine("\n\nCreate Array of Bytes with {0} bytes.", uiArrayLen);       
        byte[] arMsg = new byte[uiArrayLen];
        
        for( uint i = 0, x= 0; i < uiArrayLen; i++)
        {
            arMsg[i] = (byte)(x++);
            if(x>9)	x = 0;
        }
        
        System.Console.WriteLine("Remote call with Array size:{0}", uiArrayLen);
        System.DateTime oStartTime = System.DateTime.Now;
        
        byte[] arMsgRet = m_oIGreetings.longByteSeq( arMsg);
        
        System.TimeSpan oTs = System.DateTime.Now.Subtract( oStartTime);
        System.Console.WriteLine( "2-Way Operation with a Array of Bytes (Len:{0})", uiArrayLen);        
        System.Console.WriteLine( "Duration: Sec:{0}: Msec:{1}", oTs.Seconds, oTs.Milliseconds);
    }
    

Step 4. Run the example

a.) Start the Server.

b.) Start the Client.