Remoting performance and inner workings of MarshalByRefObject?

잠김 Remoting performance and inner workings of MarshalByRefObject?

  • 2012년 7월 26일 목요일 오후 2:45
     
      코드 있음

    I'm trying to get my head around remoting and MarshalByRefObject in .NET.  Whereas I think I have a reasonable understanding how this works using more "standard" WCF (TcpChannel, etc.), I don't really understand remoting.  I have a situation in which I need to make an informed choice between running an object in a separate application domain versus running in the same application domain.  I won't go into all the details, but we would prefer to run in a separate application domain.  However, we're finding it to be considerably slower, so I'd like to understand better what's going on and/or to get tips on how to speed it up.

    I have a very simple server that looks like this:

    IpcChannel serverChannel = new IpcChannel(CHANNEL_PORT);
    
    ChannelServices.RegisterChannel(serverChannel, false);
    
    RemotingConfiguration.RegisterWellKnownServiceType(typeof(ProjectInfo), "ProjectInfo.rem", WellKnownObjectMode.Singleton);

    My "ProjectInfo" class inherits from "MarshalByRefObject".  It has a method that returns a very large dataset (> 50MB) in a two-dimensional array (e.g. double[,] GetData()).  If I run the object in the same application domain, it takes in the neighborhood of 2.5 seconds.  If I run in a different application domain using the above server, it takes on average about 12.5 seconds.

    So here are my questions:

    1. How can I make this faster?
    2. What's really going on across the application domain boundary?  Is the dataset being serialized/deserialized?  If so, can this be controlled/tweaked?  Is it just the marshalling, security checking, etc. that's taking so long?

    Any help with this would be much appreciated!

    Thanks!

    Brad.

    P.S. Yes, this question was previously posted in the WCF forum, but I was advised to post it here instead.

모든 응답

  • 2012년 7월 31일 화요일 오후 8:42
     
     답변됨

    Whereas I never actually got an answer, I went with WCF and that has solved the performance problem I was having with Remoting. You can see my solution in the WCF forum here.

    Brad.

    
    • 답변으로 표시됨 Pletzky 2012년 7월 31일 화요일 오후 8:42
    •