HighTechTalks DotNet Forums  

Client-side vs Server-side objects - how to mix for performance?

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss Client-side vs Server-side objects - how to mix for performance? in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Todd Beaulieu
 
Posts: n/a

Default Client-side vs Server-side objects - how to mix for performance? - 10-11-2006 , 03:04 PM






I'm designing a remoting C/S application. I want to obtain references to
"business" objects created on the server side to enable invoking methods that
will run on the server side. In order to make it more chunky, I want to
enable the serialization, transportation of copies of the objects so that I
can then inspect the various properties and data of the objects on the client
side. In other words, I'm trying to get the best of both worlds with server
side execution and data retrieval and then compressing/returning the results
for the bulk of the data retrieval on the client side, eliminating the round
trips. Some of these objects will have a good amount of data, so I'm
expecting a substantial performance improvement by compressing the objects
for transmittal over the wire).

In my prototype, I can only seem to get local copies of the objects, rather
than references to them. Logging in the class makes it clear where each
method is being executed (client or server).

I am creating a remoting object to the "main" object on the server and using
that class to create and return business objects. It's unclear to me how to
have that class return references to server-side business objects that are
created on demand for the client.

Let me try to make this more clear with a simple example:

1. Ask server remoting object for a new "log file" object.
2. The server returns a reference to an object living on the server.
3. Invoking the Clear method would cause the server-side obj to clear the
logs.
4. Asking the server-side object for a copy would result in a client-side
copy of the object (Thinking of a implementing a comrpessed XML stream to
serialize/de-serialize the object across the wire).
5. Querying any of the properties of this client-side object would be super
fast, as it's all local. Of course, I couldn't execute the methods on the
local object.

Are there are "patterns"/ common approaches to this design?

Thank you.


Reply With Quote
  #2  
Old   
James Westgate
 
Posts: n/a

Default Re: Client-side vs Server-side objects - how to mix for performance? - 10-11-2006 , 04:47 PM






We have extensively looked into a pattern for this scenario for our new
object persistence component framework which we will be launching shortly.

My recommendation is to make the the shared data objects marshal by
value - that is serializable by the .NET framework by eg implementing
ISerializable. In .NET framework 2.0 onwards these can be placed in a
collection that is also serializable , no native support for compression
but unless you are shifting huge no's of records at a time a
BinaryFormatter should suffice. The object or collection of objects acts
as your message (note a normal Dataset also suffices here). Otherwise an
open source gzip library and some custom serialization should do the trick.

Manipulate the data objects on the server using a Manager class. This
retrieves and updates the data objects update etc and is a MarshalByRef
object which can then implement a shared interface for distribution
whilst critical logic is located in this object only and is not shared.
A reference to this object is passed to the client. Ideally it is
stateless and is instantiated as a singlecall object for scalability
reasons.

This is the pattern Ingo Rammer follows in his book on remoting which I
recommend. There are a few gotchas with shared interfaces, constructors
etc so I also recommend his website for up to date information.

Best wishes
James Westgate

http://www.crainiate.net

Todd Beaulieu wrote:
Quote:
I'm designing a remoting C/S application. I want to obtain references to
"business" objects created on the server side to enable invoking methods that
will run on the server side. In order to make it more chunky, I want to
enable the serialization, transportation of copies of the objects so that I
can then inspect the various properties and data of the objects on the client
side. In other words, I'm trying to get the best of both worlds with server
side execution and data retrieval and then compressing/returning the results
for the bulk of the data retrieval on the client side, eliminating the round
trips. Some of these objects will have a good amount of data, so I'm
expecting a substantial performance improvement by compressing the objects
for transmittal over the wire).

In my prototype, I can only seem to get local copies of the objects, rather
than references to them. Logging in the class makes it clear where each
method is being executed (client or server).

I am creating a remoting object to the "main" object on the server and using
that class to create and return business objects. It's unclear to me how to
have that class return references to server-side business objects that are
created on demand for the client.

Let me try to make this more clear with a simple example:

1. Ask server remoting object for a new "log file" object.
2. The server returns a reference to an object living on the server.
3. Invoking the Clear method would cause the server-side obj to clear the
logs.
4. Asking the server-side object for a copy would result in a client-side
copy of the object (Thinking of a implementing a comrpessed XML stream to
serialize/de-serialize the object across the wire).
5. Querying any of the properties of this client-side object would be super
fast, as it's all local. Of course, I couldn't execute the methods on the
local object.

Are there are "patterns"/ common approaches to this design?

Thank you.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.