short circuiting remote calls

short circuiting remote calls

Post by Abhishek Srivastav » Sat, 19 Jan 2002 23:38:02

Hello All,

In J2EE, some appservers optimize the calls between components by finding
their locations. If the two beans are deployed in the same app server then
they do not use tcp/rmi calls to invoke the methods. but make local calls

Does the .Net remoting framework also do the following optimization?

If it doesn't is there any way this can be done?



1. Extending RealProxy to Short-Circuit Cross-Network calls


I'm hoping someone with more experience of remoting can
assist me with this small problem.

I have a server-side MarshalByRefObject that I want to
place in a client-side hashtable. For functional reasons
the virtual functions GetHashCode and Equals have been
overriden in the object.  I would like to short-circuit
the remote calls to these functions so that I can obtain
better performance.

The logical approach seems to be to extend RealProxy and
cache the hash-code in the ObjRef for that object so that
it is available on the client-side.  

Examination of the source-code from Rotor indicates that
the implementation of InternalInvoke in remotingproxy.cs
(System.Runtime.Remoting.Proxies.RemotingProxy) shortcuts
the standard Object.GetHashCode, but of course the
override to GetHashCode doesn't match Object.GetHashCode
and gets passed to the server.

In addition, the implementation of RemotingProxy is
internal, so I can't inherit from it and extend its
implementation of RealProxy.Invoke.  Also, RemotingProxy
is intimately involved/entwined with the transparent proxy
and other functions so encapsulating RemotingProxy or cut-
and-pasting code from remotingproxy.cs won't work either.

Catching and handling the message later in a custom Client
Message Sink might be an alternative, however I can't
figure out how to get hold of the ObjRef for the object at
that point.

So - any suggestions on how to proceed would be gratefully
received.  I do note that there is an IntPtr on the stub
for the transparent proxy in __TransparentProxy.cs with an
indication that this is supposed to link to unmanaged code
which can help in deciding whether to short-circuit calls.
However, I have no idea how this might be accomplished.

I anticipate that this problem will repeatedly arise
within my code, and hope that a "standard" solution for
integrating "short-circuits" into the proxy object will at
some point be available.

Tim Findlow

2. 1280x1024x256 at 60 Hz with Stealth Pro

3. Call for Short Papers & Demos

4. FS2002 and Windows 2000

5. Remote object method call to return another remote object

6. letter from charter

7. Calling method on remote obj with remote obj parm

8. Disk images on OS/2 4 Win CD-ROM?

9. Proxy in calling remote web service

10. COMException: The remote procedure call failed.

11. Calling .NET component from remote VB6 app

12. Calling remote DCOM server (Unmanaged Classic COM Component) from .NET client

13. Exceptions in asynchronous remote call