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.
Show the performance of a call to a remote CORBA object.
Show the performance of data transport with CORBA.
module LongMsg
{
interface Greetings
{
typedef sequence |
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;
}
} |
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);
}
|
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);
}
|
a.) Start the Server.
b.) Start the Client.