This demonstrates the problem.

Build and run the attached code with:
  mcs -t:library -out:thing.dll thing.cs
  mcs -r:thing.dll -r:System.Runtime.Remoting server.cs
  mcs -r:thing.dll -r:System.Runtime.Remoting client.cs
  xterm -e mono server.exe &
  time mono client.exe
to time 200 calls.
It takes ~16seconds realtime on my machine, but with only 0.467s user
and 0.037s system time it's basically sitting there mostly doing nothing
(top shows 99% idle)!

Tried it on a couple of machines with the same results.

The code is essentially straight out of the OReilly "Programming C#" book.
The mono system itself seems to be zippy enough: I can sum a billion ints
in a couple of seconds.
mono --profile on the client.exe shows most of the 16 seconds runtime is
made up of 2800 calls at ~5.6ms each to 
System.Net.Sockets.Socket::Receive_internal


using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class Client
{
  static void Main(string[] args)
  {
    ChannelServices.RegisterChannel(new TcpChannel());
    MarshalByRefObject obj=(MarshalByRefObject)RemotingServices.Connect
      (
       typeof(Thing),
       "tcp://localhost:8080/thing"
      );
    Thing thing=obj as Thing;
    for (int i=0;i<200;i++) thing.Call();
  }
}

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

public class Server
{
  static void Main(string[] args)
  {
    ChannelServices.RegisterChannel(new TcpChannel(8080));

    Thing thing = new Thing();

    RemotingServices.Marshal(thing,"thing");

    while(true)
      {
	Console.Write('.');
	System.Threading.Thread.Sleep(1000);
      }
  }
}
using System;

public class Thing : MarshalByRefObject
{
  public Thing() {Console.WriteLine("Thing created");}
  public void Call() {Console.Write('!');}
}

Reply via email to