Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / January 2004

Tip: Looking for answers? Try searching our database.

TransparentProxy

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jacek He?ka - 05 Jan 2004 14:12 GMT
I use something like "inteligent references" in my application. I
implemented it with RealProxy/TransparentProxy mechanism, but it's quite
inefficient. Is there better way?
How can I create objects similar to TransparentProxy withot reflection and
.NET remoting?
"Ying-Shen Yu[MSFT]" - 06 Jan 2004 06:19 GMT
Hi Jacek,

Thanks for your post!

I'm not very clear about what the "intelligent references" you refer to.
Could you give some more description or sample on your purpose and the
scenario of your problem?
From my understanding now ,you are using .NET Remoting mechanism in your
app and find it's not very effecient.
.NET remoting is designed for distributed computing, it will do marshaling
between two appdomains. It might cause some performance issue if not tuning
well, here is an article
for performance tuning in .NET, it has a .NET remoting section and provided
some guideline on this. Hope this will be helpful to you.

<Performance Considerations for Run-Time Technologies in the .NET Framework>
http://msdn.microsoft.com/netframework/using/understanding/perf/default.aspx
?pull=/library/en-us/dndotnet/html/dotnetperftechs.asp#dotnetperftechs_topic
7

Also here is some performance couter for .NET Remoting, it will help you
investigate this problem.

<Remoting Performance Counters>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
ml/gngrfremotingperformancecounters.asp

If your app needn't communication between appdomains, maybe the best way is
avoiding using .NET Remoting.

Please be free to reply this thread if you have any further questions on
this issue.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
Jacek He?ka - 06 Jan 2004 06:50 GMT
Inteligent references, or smart pointers are special kind of objects.
They simulate other objects and add some special functionality.
TransparentProxy is a kind of inteligent reference - it adds remoting
features to proxied object.
I used TransparentProxy to implement lazy load mechanism in my O/R mapping
framework, but I probably need something more efficient.
I think, that RealProxy/TransparentProxy mechanism is very efficient if you
use it in distributed applications.

Tahnk you for your replay,
Jacek.

> Hi Jacek,
>
[quoted text clipped - 12 lines]
>
> <Performance Considerations for Run-Time Technologies in the .NET Framework>

http://msdn.microsoft.com/netframework/using/understanding/perf/default.aspx

?pull=/library/en-us/dndotnet/html/dotnetperftechs.asp#dotnetperftechs_topic
> 7
>
> Also here is some performance couter for .NET Remoting, it will help you
> investigate this problem.
>
> <Remoting Performance Counters>

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/ht
> ml/gngrfremotingperformancecounters.asp
>
[quoted text clipped - 14 lines]
> This mail should not be replied directly, "online" should be removed before
> sending.
"Ying-Shen Yu[MSFT]" - 07 Jan 2004 08:44 GMT
Hi Jacek,

Thanks for your reply!

Probably, you misunderstand my meaning. I want to know what the
"Intelligent Reference" referrs to in your O/R mapping framework scenario.

From my understanding now, you are writing an O/R mapping framework and you
are using the .NET Remoting to implement the lazy load mechanism. the O/R
mapping framework needn't support the cross app-domain situation.

The advice on this issue is largly depends on the your design, so I need
know more info on your O/R mapping framework, and especially how you use
the transparent proxy in the lazy load mechanism?

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
Jacek Hełka - 07 Jan 2004 10:44 GMT
Hi Ying-Shen,

My lazy loading mechanism works as follows.
I defined subclass of RealProxy with. It's Invoke() method checks, wheather the real object was read into memory. If not, it reads it.

public override IMessage Invoke(IMessage msg)
{
   if(persistentObject == null)
       persistentObject = ReadObject();
   IMethodCallMessage mtd = (IMethodCallMessage)msg;
   object result = mtd.MethodBase.Invoke(, mtd.Args);
   return new ReturnMessage(
       result,
       mtd.Args,
       mtd.ArgCount,
       mtd.LogicalCallContext,
       mtd);
}

Then I create TransparentProxy object simulating underlying persistent object. When you use persistence framework you can access persistent objects only through proxies.
This is very comfortable for users, because the lazy loading is transparent.

Regards,
Jacek.

> Hi Jacek,
>
[quoted text clipped - 22 lines]
> This mail should not be replied directly, "online" should be removed before
> sending.
"Ying-Shen Yu[MSFT]" - 08 Jan 2004 09:18 GMT
Hi Jacek,

Thanks for your reply.

If you would like to make the lazy load mechanism completely transparent to
the object, I couldn't find a way other than TransparentProxy/RealProxy
approach. Unfortunately, the TransparentProxy was created by CLR Execution
Engine, we are not able to implement our own transparent proxy. You may try
investigating the cause of the inefficiency using some profilering tool,
.NET remoting will pass the IMessage reference direct to the remote object
if both of them are in the same AppDomain, so I guess the problem might not
be the serialize issue, however the message dispatching might cost some
time. you may also take a look at the SSCLI rotor to see more detail
implementation in this part, maybe you can manage the remoteobject in your
real proxy on the client side and call it directly to bypass some message
sinks.

Hope it helpful,Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
Jacek He?ka - 08 Jan 2004 11:41 GMT
Hi,

> Hi Jacek,
>
[quoted text clipped - 9 lines]
> be the serialize issue, however the message dispatching might cost some
> time.

Yes, I know, that serialization is used only between AppDomains.

> you may also take a look at the SSCLI rotor to see more detail
> implementation in this part, maybe you can manage the remoteobject in your
> real proxy on the client side and call it directly to bypass some message
> sinks.

Thank you, I will try.

> Hope it helpful,Thanks!
>
> Best regards,
>
> Ying-Shen Yu [MSFT]

Regards,
Jacek

> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> This mail should not be replied directly, "online" should be removed before
> sending.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.