net remoting architecture. slide 2 cite 4420.net remoting topics remoting boundaries crossing the...
TRANSCRIPT
.NET Remoting .NET Remoting ArchitectureArchitecture
CITE 4420 .NET Remoting Slide 2
TopicsTopics• Remoting Boundaries• Crossing the Boundaries• Distributed Applications• Marshalling• Channels• Formatters• Object Activation• Leases
• Remoting Boundaries• Crossing the Boundaries• Distributed Applications• Marshalling• Channels• Formatters• Object Activation• Leases
CITE 4420 .NET Remoting Slide 3
Remoting BoundariesRemoting Boundaries
• Windows Process Boundary
• Application Domain Boundary
• Crossing the Boundaries
• Windows Process Boundary
• Application Domain Boundary
• Crossing the Boundaries
CITE 4420 .NET Remoting Slide 4
Windows Process BoundaryWindows Process Boundary
• Every Windows application runs in a separate process
• Each process has its own virtual address space, executable code, data
• Processes are isolated from one another – cannot access address space or code of other processes
• Every Windows application runs in a separate process
• Each process has its own virtual address space, executable code, data
• Processes are isolated from one another – cannot access address space or code of other processes
CITE 4420 .NET Remoting Slide 5
Application Domain Boundary(AppDomain)
Application Domain Boundary(AppDomain)
• Created by CLR• Each AppDomain has its own code, data,
and configuration settings• AppDomain cannot directly access code or
data of another AppDomain• Code running in one AppDomain cannot
affect other AppDomains
• Created by CLR• Each AppDomain has its own code, data,
and configuration settings• AppDomain cannot directly access code or
data of another AppDomain• Code running in one AppDomain cannot
affect other AppDomains
CITE 4420 .NET Remoting Slide 6
Crossing the BoundariesCrossing the Boundaries
• .NET Remoting namespaces enable applications to cross these boundaries
• System.Runtime.Remoting– Provides an abstraction of the ISO layers– Simple mechanism for inter-application
domain communication
• .NET Remoting namespaces enable applications to cross these boundaries
• System.Runtime.Remoting– Provides an abstraction of the ISO layers– Simple mechanism for inter-application
domain communication
CITE 4420 .NET Remoting Slide 7
Crossing the Boundaries (cont’d)Crossing the Boundaries (cont’d)
• System.Web.Services– Classes that constitute the ASP.NET
Web Services framework– Use SOAP, WSDL, UDDI– Simpler to use than .NET Remoting
• System.Web.Services– Classes that constitute the ASP.NET
Web Services framework– Use SOAP, WSDL, UDDI– Simpler to use than .NET Remoting
CITE 4420 .NET Remoting Slide 8
.NET Remoting vs. Web Services.NET Remoting vs. Web Services
• Use .NET Remoting when you have control of both end-points of a distributed application
• Use Web Services when one end-point of a distributed application is not under your control
• Use .NET Remoting when you have control of both end-points of a distributed application
• Use Web Services when one end-point of a distributed application is not under your control
CITE 4420 .NET Remoting Slide 9
Distributed ApplicationsDistributed Applications
• The dominant architecture of modern applications
• Components of the application are distributed across multiple processors, accessed via a network
• The dominant architecture of modern applications
• Components of the application are distributed across multiple processors, accessed via a network
CITE 4420 .NET Remoting Slide 10
Objectives of Distributed Applications
Objectives of Distributed Applications
• Communicate between objects that run in different AppDomains and processes
• Communicate between heterogeneous architectures
• Ensure availability in spite of resource failure
• Provide increased scalability and security
• Communicate between objects that run in different AppDomains and processes
• Communicate between heterogeneous architectures
• Ensure availability in spite of resource failure
• Provide increased scalability and security
CITE 4420 .NET Remoting Slide 11
.NET Proxy Objects.NET Proxy Objects
Client object
Server object
Proxy
Remoting System
RemotingSystem
CITE 4420 .NET Remoting Slide 12
Object MarshallingObject Marshalling
• The process of gathering and formatting data about an object for transmission across a network
• Marshall-by-Reference (MBR)
• Marshall-by-Value (MBV)
• The process of gathering and formatting data about an object for transmission across a network
• Marshall-by-Reference (MBR)
• Marshall-by-Value (MBV)
CITE 4420 .NET Remoting Slide 13
ChannelsChannels
• Provide abstraction of ISO layers programming• Objects that transport messages across remoting
boundaries• Each channel has 2 end-points• Each channel is associated with a port number• .NET Framework provides HTTP and TCP
channels
• Provide abstraction of ISO layers programming• Objects that transport messages across remoting
boundaries• Each channel has 2 end-points• Each channel is associated with a port number• .NET Framework provides HTTP and TCP
channels
CITE 4420 .NET Remoting Slide 14
HTTP ChannelsHTTP Channels
• Uses the HTTP protocol• Implemented through the classes of
System.Runtime.Remoting.Channels.Http namespace
• A channel is registered with the remoting framework
• Uses the HTTP protocol• Implemented through the classes of
System.Runtime.Remoting.Channels.Http namespace
• A channel is registered with the remoting framework
CITE 4420 .NET Remoting Slide 15
TCP ChannelsTCP Channels
• Uses TCP for establishing communication between end-points
• Implemented through the classes of System.Runtime.Remoting.Channels.Tcp
• Uses TCP for establishing communication between end-points
• Implemented through the classes of System.Runtime.Remoting.Channels.Tcp
CITE 4420 .NET Remoting Slide 16
HTTP vs. TCP ChannelsHTTP vs. TCP Channels
• HTTP: highly accessible through firewalls via port 80, bulky protocol, high overhead
• TCP: limited accessibility through firewalls, very efficient packet structure, less secure
• HTTP: highly accessible through firewalls via port 80, bulky protocol, high overhead
• TCP: limited accessibility through firewalls, very efficient packet structure, less secure
CITE 4420 .NET Remoting Slide 17
FormattersFormatters
• Objects that encode and serialize data into messages before transmission over a network
• SOAP Formatter – XML-based protocol• Binary Formatter – used only within .NET
applications
• Objects that encode and serialize data into messages before transmission over a network
• SOAP Formatter – XML-based protocol• Binary Formatter – used only within .NET
applications
CITE 4420 .NET Remoting Slide 18
Channels and FormattersChannels and Formatters
• The HTTP channel uses the SOAP formatter as its default formatter for the transport of messages across a network
• The TCP channel uses the Binary Formatter as its default
• The HTTP channel uses the SOAP formatter as its default formatter for the transport of messages across a network
• The TCP channel uses the Binary Formatter as its default
CITE 4420 .NET Remoting Slide 19
Remote Object ActivationRemote Object Activation
• Activation means instantiation• Applies only to MBR objects MBV
objects are transferred to client side)• Two categories:
– Server-activated objects– Client-activated objects
• Activation means instantiation• Applies only to MBR objects MBV
objects are transferred to client side)• Two categories:
– Server-activated objects– Client-activated objects
CITE 4420 .NET Remoting Slide 20
Server-Activated ObjectsServer-Activated Objects
• Lifetime is controlled by server• Object is instantiated by a client
request for service• Two activation modes:
– SingleCall activation mode– Singleton activation mode
• Lifetime is controlled by server• Object is instantiated by a client
request for service• Two activation modes:
– SingleCall activation mode– Singleton activation mode
CITE 4420 .NET Remoting Slide 21
SingleCall Activation ModeSingleCall Activation Mode
• Object is instantiated on server for just one call from client, then destroyed
• Does not maintain state across requests
• Allows for greater server scalability
• Object is instantiated on server for just one call from client, then destroyed
• Does not maintain state across requests
• Allows for greater server scalability
CITE 4420 .NET Remoting Slide 22
When to Use SingleCall ActivationWhen to Use SingleCall Activation
• Overhead of creating object is not great• Object is not required to maintain state• Server must support large number of
requests• Object needs to be supported in a load-
balancing environment
• Overhead of creating object is not great• Object is not required to maintain state• Server must support large number of
requests• Object needs to be supported in a load-
balancing environment
CITE 4420 .NET Remoting Slide 23
Singleton Activation ModeSingleton Activation Mode
• Only one instance of object is created, regardless of number of clients using it
• Object can maintain state information across calls
• State information is shared by all clients• Lifetime is determined by leases
• Only one instance of object is created, regardless of number of clients using it
• Object can maintain state information across calls
• State information is shared by all clients• Lifetime is determined by leases
CITE 4420 .NET Remoting Slide 24
When to Use Singleton ActivationWhen to Use Singleton Activation
• Overhead of creating object is substantial
• Object is required to maintain state over a prolonged period
• Multiple clients need to work on the shared state information
• Overhead of creating object is substantial
• Object is required to maintain state over a prolonged period
• Multiple clients need to work on the shared state information
CITE 4420 .NET Remoting Slide 25
Client-Activated ObjectsClient-Activated Objects
• Server-based objects whose lifetime is controlled by the client
• Instantiated on the server when a client requests the object to be created
• Server-based objects whose lifetime is controlled by the client
• Instantiated on the server when a client requests the object to be created
CITE 4420 .NET Remoting Slide 26
When to Use Client-Activated Objects
When to Use Client-Activated Objects
• Clients want to maintain a private session with the server object
• Clients need to have control over when the objects are created and how long they live
• Clients want to maintain a private session with the server object
• Clients need to have control over when the objects are created and how long they live
CITE 4420 .NET Remoting Slide 27
Lifetime LeasesLifetime Leases• A lease defines the period of time an object
is active in memory before destruction• Represented by an object defined in the
System.Runtime.Remoting.Lifetime namespace
• Applies only to Singleton SAO’s and CAO’s
• A lease defines the period of time an object is active in memory before destruction
• Represented by an object defined in the System.Runtime.Remoting.Lifetime namespace
• Applies only to Singleton SAO’s and CAO’s
CITE 4420 .NET Remoting Slide 28
How Leases WorkHow Leases Work• A Lease Manager is created• Each time an object receives a call, the
“CurrentLeaseTime” is renewed• When a lease expires, sponsors are
contacted for renewal• When there are no renewal requests, object
is marked for Garbage Collection
• A Lease Manager is created• Each time an object receives a call, the
“CurrentLeaseTime” is renewed• When a lease expires, sponsors are
contacted for renewal• When there are no renewal requests, object
is marked for Garbage Collection