Main page / CORBA with MinCor.NET page

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: 
	MinCor\Demo\LongMsg

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



Example 

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)



The Implementation (within ServerImpl.cs):

    Both operations will just return the passed in parameter:
    
    public class GreetingsImpl: LongMsg.GreetingsPOA
    {
        private ServerImpl m_oServer;
 
        public GreetingsImpl( ServerImpl a_oServer)
        {
            m_oServer = a_oServer;
        }
        
        public override string longString(  string a_strParam  )
        {
            string strRet = a_strParam;
            m_oServer.theFrm.writeLog(  "Function 'longString' ParameterLen: " + a_strParam.Length);
            return strRet;
        }
        
        public override byte[] longByteSeq(  byte[] a_oParam  )
        {
            byte[] oRet = a_oParam;
			m_oServer.theFrm.writeLog(  "Function 'longByteSeq' ParameterLen: "+ a_oParam.Length);
			return oRet;		
		}
	}
    
    
    
The Client (ClientImpl.cs):

    Sending a string with 5000 characters to the server:
    
    public static void TestString( ref string a_strMsg, LongMsg.Greetings a_oIGreetings)  
    {
        uint uiStrLen = 10000;
        string strMsgBase = "0123456789";
        string strMsg ="";
        uint uiLoopLen = uiStrLen/10;
        for( int i = 0; i < uiLoopLen; i++)
        {
            strMsg += strMsgBase;
        }
        
        a_strMsg += "\n \nRemote call, string-len:" + uiStrLen;
        System.DateTime oStartTime = System.DateTime.Now;
        
        string strRetMsg = a_oIGreetings.longString( strMsg);
        
        System.TimeSpan oTs = System.DateTime.Now.Subtract( oStartTime);
        a_strMsg += "\n--Stop--";
        a_strMsg += "\n2-Way Operation\nString (String-Len:" +  strMsg.Length +  ")";
        a_strMsg += "\nDuration:\nSec:" + oTs.Seconds.ToString() + "\nMsec:" +  oTs.Milliseconds;
    }
    
    
    Sending a byte array of 100.000 bytes to the server:
    
    public static  void TestByte( ref string a_strMsg, LongMsg.Greetings a_oIGreetings)
    {
        uint uiArrayLen = 1*10000;
        byte[] arMsg = new byte[uiArrayLen];
        
        for( uint i = 0, x= 0; i < uiArrayLen; i++)
        {
            arMsg[i] = (byte)(x++);
            if(x>9)	x = 0;
        }
        
        a_strMsg += "\n \nRemote call, Array size:" + uiArrayLen;			
        System.DateTime oStartTime = System.DateTime.Now;
        
        byte[] arMsgRet = a_oIGreetings.longByteSeq( arMsg);
        
        System.TimeSpan oTs = System.DateTime.Now.Subtract( oStartTime);
        a_strMsg += "\n--Stop--";
        a_strMsg += "\n2-Way Operation.\nArray of Bytes (Len:" + uiArrayLen + ")";
        a_strMsg += "\nDuration:\nSec:" + oTs.Seconds + "\nMsec:"+ oTs.Milliseconds;
    }