[Mono-dev] Keep-alive connection with Remoting?

Ympostor ympostor at clix.pt
Thu Aug 10 14:04:22 EDT 2006


Rafael Teixeira wrote:
> You have to choose the server state-model and configure the Lifetime
> policy in the server. The default even for the singleton state-model
> is to kill the server object after a few minutes and recreate on the
> next request from the client.
> 
> It is a design-for-scalability decision MS did for remoting, as
> long-living server objects (and also connections) are some of the
> worst enemies of scalability.
> 
> As you said scalability is a concern for you, I need to warn that you
> are actively working against it by choosing persistent connections,
> and long-living server objects.
> 
> My experience is that persistent connections put a ceiling (and a
> really low one) on how much you can scale, something like a few
> hundred to a thousand simultaneous connections depending in the OS and
> network I/O efficiency of the hardware.
> 
> Long-living server objects strain memory usage and thus garbage
> collection (even causing server hiccups), when you try to scale up,
> but surely, how fast it breaks is dependent on the memory consumption
> of all the chain of objects needed by your server object to service a
> request, so it is more tied to your specific implementation than the
> persistent connections issue.
> 
> Just some facts I learned from a long life is this business, and that
> I teach my post-graduation students in return.

Very interesting numbers; but I think I am considering a "clustered" 
solution similar to the one proposed by Brian.

Anyway, I think I will give up with the Reachability library, it seems 
very unstable and I have found out that it's much slower than the 
original solution proposed by Ingo Rammer; so I am testing it, I have 
specified the same clientProviders/serverProviders parameters so as to 
make it work with FW2.0 and now I get a weird behaviour: if I try the 
demo between client and servers on the local machine, it works 
perfectly, but if I place the client on other machine (changing the URL 
of the server in the config file, of course), I get:

Called main thread 'MainThread'
---- Testing sync calls / SAO ----
Registered connection #0 as 172.16.0.43:9999. Count: 1
Registered connection #0 as bc305056-1a3c-4a4f-9d9a-5889713d8325. Count: 2
OUTGOING to 172.16.0.70:4259 --> 172.16.0.43:9999
Got sync result: Testing
---- Testing sync calls / CAO ----
Closing connection #0 to 172.16.0.43:9999
Unregistered connection #0 as bc305056-1a3c-4a4f-9d9a-5889713d8325. Count: 1
Unregistered connection #0 as 172.16.0.43:9999 . Count: 0

Unhandled Exception: 
System.Runtime.Serialization.SerializationException: Binary
  stream '0' does not contain a valid BinaryHeader. Possible causes are 
invalid stream or object version change between serialization and 
deserialization.

Server stack trace:
    at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
    at 
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(He
aderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean 
isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at 
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize
(Stream serializationStream, HeaderHandler handler, Boolean fCheck, 
Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
    at 
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryResponseMess
age(Stream inputStream, IMethodCallMessage reqMsg, Boolean bStrictBinding)
    at 
System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMess
age(IMessage msg)

Exception rethrown at [0]:
    at 
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage 
reqMsg, IMessage retMsg)
    at 
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& 
msgData, Int32 type)
    at 
System.Runtime.Remoting.Activation.IActivator.Activate(IConstructionCallMe
ssage msg)
    at 
System.Runtime.Remoting.Activation.LocalActivator.DoRemoteActivation 
(IConstructionCallMessage ctorMsg)
    at 
System.Runtime.Remoting.Activation.LocalActivator.Activate(IConstructionCa
llMessage ctorMsg)
    at 
System.Runtime.Remoting.Activation.AppDomainLevelActivator.Activate 
(IConstructionCallMessage ctorMsg)
    at 
System.Runtime.Remoting.Messaging.ClientContextTerminatorSink.SyncProcessM
essage(IMessage reqMsg)
    at System.Runtime.Remoting.Activation.ActivationServices.Activate 
(RemotingProxy remProxy, IConstructionCallMessage ctorMsg)
    at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(IMessage reqMsg)
    at 
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& 
msgData, Int32 type)
    at Service.SomeCAO..ctor()
    at Client.Client.Main(String[] args) in C:\Documents and 
Settings\Ympostor\Desktop\Software\BidirectionalTCPChannel\BidirectionalTCPChannel\TestClient\Clien
t.cs:line 70

Which seems a very strange problem because both machines are running the 
same runtime.

BTW: many thanks about the advices for sending the file. I know that 
sending the whole file in a single call would be terrific for large 
files, but I just wanted to do the proof of concept (in fact, locally, 
it worked perfectly for 8MB files!, remotelly it wouldn't receive the 
call at all, and no time-outs were involved because I was making the 
call just after launching the server and the client).

Regards.

-- 




More information about the Mono-devel-list mailing list