Thursday, November 12, 2009

Remoting

What is Remoting?
The process of communication between different operating system processes, regardless of whether they are on the same computer. The .NET Remoting system is an architecture designed to simplify communication between objects living in different application domains, whether on the same computer or not, and between different contexts, whether in the same application domain or not.

.NET Remoting Architecture?

• Methods that will be called from the client are implemented in a remote object class.
• Client uses a proxy to call a remote object.
• Remote objects runs inside a process that is different from the client process
• For the client, the proxy looks like the real object with the same public methods.
• When the methods of the proxy are called, messages are created.
• Messages are serialized using a binary formatter class, and are sent into a client channel.
• The client channel communicates with the server part of the channel to transfer the message across the network.
• The server channel uses a formatter to deserialize the message, so that the methods can be dispatched to the remote object.
• The formatter and the proxy is supplied automatically.

How does .NET remoting work?
.NET remoting involves sending messages along channels. Two of the standard channels are HTTP and TCP.
TCP is intended for LANs only -
HTTP can be used for LANs or WANs internet).

Support is provided for multiple message serializarion formats. Examples are SOAP (XML-based) and binary. By default, the HTTP channel uses SOAP (via the .NET runtime Serialization SOAP Formatter), and the TCP channel uses binary (via the .NET runtime Serialization Binary Formatter). But either channel can use either serialization format.
There are a number of styles of remote access:
SingleCall. Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished.
Singleton. All incoming requests from clients are processed by a single server object.
Client-activated object. This is the old stateful (D)COM model whereby the client receives a reference to the remote object and holds that reference (thus keeping the remote object alive) until it is finished with it.
Distributed garbage collection of objects is managed by a system called 'leased based lifetime'. Each object has a lease time, and when that time expires the object is disconnected from the .NET runtime remoting infrastructure. Objects have a default renew time - the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.

Advantage over Web Services?

1.It works using purely Commmon Type System.
2.It supports high speed binary over tcp/ip communication.


Advantage over COM/DCOM?
1.It does not have extra interface language (IDL)
2.It Works using purely managed code
3.It's using Common Type System.. No Safearrays etc


Disadvantages
1.It is not an open standard like web services.
2.It is not as widespread and established ad DCOM.
3.Less support for transactions,load balancing compared with DCOM.

No comments:

Post a Comment