Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remoting performance degrades over the time

I'm working on a client-server solution that uses .NET 2.0 Remoting (server activation, binary formatting over TCP channel, Vista Ultimate) for communication purposes. Currently I'm profiling the application and run everything on the same machine. I noticed that if I start the application, everything works just fine for several minutes and then suddenly each remote call takes several seconds to execute. I have logging on both ends and clock every call. Server side's implementation takes only fraction of a second to execute, while the whole remote call is slow. Further profiling showed that remoting degrades on the server side: while inner working of the remote service execute within a fraction of a second, the responses are very slow. If I restart server everything backs to normal for several minutes again.

Did anyone experience something like that?

Thanks!

UPDATE: I checked, if I configure lifetime for my remote object to, say, 1 day, I still have the same problem.

UPDATE: I'm using the pattern suggested by Ingo Ramer (HOWTO: Use Interface-based remote objects with config files) for all my remoting stuff, if this makes any difference.

Client code:

public static object CreateInstance(Type type)
{
    if (!Initialized)
        InitWellKnownTypesCache();

    WellKnownClientTypeEntry typeEntry = (WellKnownClientTypeEntry)wellKnownTypesCache[type];
    if (null == typeEntry)
        throw new RemotingException("Type not found.");

    if (string.IsNullOrEmpty(serverObjectActivationUri))
        throw new RemotingException("ServerObjectActivationUri wasn't configured. Cannot create server object instance.");

    return Activator.GetObject(typeEntry.ObjectType, string.Format(serverObjectActivationUri, typeEntry.ObjectUrl));
}

Server side has nothing but proper config file that looks like:

        <service>
            <wellknown 
                mode="Singleton" 
                type="MyDomain.SomeDomain, MyDomain" 
                objectUri="SomeDomainService"
            />

I don't do anything beyond RemotingConfiguration.Configure("MyDomainService.exe.config", false); neither in my server nor client code.

like image 675
wasker Avatar asked Dec 02 '08 13:12

wasker


1 Answers

Use some network monitoring tool like Wireshark to see if your problem is network related or server sync related.

If it proves that it is not a network issue, then try to attach a simple custom sync in the chain (just before the channel) to log and get the timing between the hooks.

like image 66
Sunny Milenov Avatar answered Nov 18 '22 03:11

Sunny Milenov