.NET Remoting에서 remote object의 lifetime은 type에 따라서 잘 설명되는 것을 볼 수 있다.
http://msdn.microsoft.com/en-us/library/ms973864.aspx의 비교표
| Single Call/Singleton Objects | Client-Activated Objects |
Client side- activation code (Code required on the client side) For more information see the section on configuration files | a) Activator.GetObject() b) new() with CFG file Client's CFG file references the URL: | a) Activator.CreateInstance() b) new() with CFG file Client's CFG file references the URL. For example
|
Activation of the server object | No activation message is sent over the network until the first method call is made. | Activation message is sent to the server machine when the client creates the object and a proxy is created on the client side. Constructors with parameters are supported. |
Lifetime of the server object | Lifetime is dictated by the configuration on the server. Could be either SingleCall or Singleton. Singleton objects are also subject to lifetime management. | Lifetime is the earlier of these two events: a) Lease expires b) When the client loses its reference on the server object |
Server side registration | a) Use configuration file to specify the type (SingleCall or Singleton). b) Use RegisterWellKnownServiceType() api to register the type. | Use configuration file to export the client-activated object. For more information see the section on configuration files. |
Advantages of the models | a) Clients can be compiled against server component's base class or interface definition Common Language Runtime metadata. b) Useful to perform finite operations on the server side. c) Single call objects can be easily deployed in a Load Balanced system, as they don't hold state. d) Singleton Objects can maintain state information across client objects. | a) Classic COM "coclass" like invocation of the server object. b) Gives clients more flexibility to govern the server object's lifetime. c) Client can pass constructor parameters to the created object. d) Server Objects can hold state for its specific client between method calls. |
그런데 remote object이 HTTP/HTTPS channel을 사용할때 이 HTTP connection은 remote object과 어떤 구조로 연결되며 lifetime은 어떨까?
이의 의문을 해결하기 위해 검색하다보니 다음 문서를 찾게 되었다.
Secure Your .NET Remoting Traffic by Writing an Asymmetric Encryption Channel Sink
http://msdn.microsoft.com/en-us/magazine/cc300447.aspx
Support for HTTPS
In conversations about remoting, the word "channel" is used frequently. Its definition can vary, but in general, a channel is the series of sinks through which a remoting call is made. The HTTP channel for .NET is actually a combination of two channels, one used by the client and one used by the server. Each has its own set of sinks, referred to as a "sink chain." The client sink chain ends with the HttpClientTransportSink, which uses the HttpWebRequest and HttpWebReponse classes from the System.Net namespace to handle all HTTP traffic. This brings with it a bonus—since HttpWebRequest and HttpWebResponse support HTTPS, so too does the HTTP client channel. This means that if the server channel supported SSL, you'd be all set.
이 문장의 의미를 해석하기 위해 다음의 architecture 구조가 도움이 된다. 즉, client쪽과 server쪽은 각각 sink chain 구조를 가지는데, client chain 중 마지막 단계인 Transport Sink에서 .NET의 HttpWebRequest class와 HttpWebResponse class를 사용하게 되고 이들의 instance가 바로 HTTP traffic을 담당한다는 얘기다. HttpWebRequest class와 HttpWebResponse classs는 HTTPS도 지원하므로 서버쪽에서 SSL을 지원한다면 그것으로 SSL이 이뤄진다는 말이다.
.NET Remoting Architecture (http://man.ddvip.com/web/bsaspnetapp/LiB0096.html)
Figure 11.1 on the next page shows the basic .NET Remoting architecture when a remote object is hosted within ASP.NET. An ASP.NET host, coupled with the HTTP channel for communication, is the recommended approach if security is the key concern, because it allows the remote object to utilize the underlying security services provided by ASP.NET and IIS.

Figure 11.1: The .NET remoting architecture
그런데 이 HTTP connection은 언제 끝나게 될까? 이는 실제 .NET Remoting 구현에서 디버깅을 해보면 가장 정확하겠지만 다음 언급으로 대략 짐작이 간다.
Architecting And Building Enterprise Solutions With Com+ & .Net 책 인용,
Whenver the client destroys the reference to remote object, the HTTP connection is closed
http://www.dotnet247.com/247reference/msgs/5/27261.aspx
In fact, the overhead occurs mostly on the _first_ method call to the remote host. During this first call the HTTPS connection will be established and keys will be "negotiated". After this, the calls should be quite fast and "small".
>> remote host로 첫 method cal 일 경우에만 HTTPS connection이 establishe되면서 overhaed가 있고 이후 call에는 빠르다는 것은 connection이 remote object에 대한 client reference가 내려갈 때가지 유지한다는 얘기..
실제 구현에서 다른 경우가 혹 나오면 다시 note할 예정.


최근 덧글