클라우드 컴퓨팅 & NoSQL/IIS

IIS의 Asynchronous 처리.

Terry Cho 2010. 5. 8. 23:07
확인을 좀 해봐야알겠지 IIS의 Request 처리 메카니즘은 Java 기반의 WAS 보다 뛰어난것 같다.
일단 Asynchronous IO 처리라는 것이 되는데, 이는 WebLogic Server에서 최근에 추가된 Future Servlet과 유사한듯 하다.

보통 WAS는 Request를 받으면, 해당 Request를 처리하는 Thread가 Allocation이 되고, Response를 보낼때 까지 Thread를 잡고 있는데, DB나 외부 시스템을 호출하는 IO가 있을 경우 IO 처리 시간동안 Thread를 점유하는 비효율적인 메카니즘이 생겨나고, 이는 실제 처리할 수 있는 Request 수를 줄인다. 이를 보강하는 방법인 일단 Request를 받은 후에, 처리가 완료될때까지 Thread를 Release했다가, 처리가 끝나면 (DB IO등의) 다시 Thread가 Allocation되서 Response 처리를 하는 방법이다.

IIS에서는 Request가 오면 IIS Thread가 직접 이 요청을 받고 ASP.NET이 관리하는 Thread로 Request를 바로 넘긴다 (offload)그리고, IIS Thread는 바로 Release된다. ASP.NET이 관리하는 Thread가 요청 처리를 끝내면 Call back 메카니즘에 의해서, IIS Thread에 response를 보내는 Thread가 다시 재할당된다. 
이렇게 하면 ASP.NET쪽 AP Logic에 문제가 생겨도 IIS 가Thread 가 Stuck되는 일은 없을 것같고, 자원 처리 효율면에서도 상당히 뛰어나다.

제대로 이해했는지 모르겠는데, 예전에 적용된 아키텍쳐 치고는 상당히 앞서있는 듯..


시간 나면 디테일하게 다시한번 살펴봐야 쓰겄다.

참고 :

The ISAPI extension runs requests asynchronously. In this mode the ISAPI extension immediately returns on the calling worker process or IIS thread, but keeps the ECB for the current request alive. The ECB then includes a mechanism for letting ISAPI know when the request is complete (via ecb.ServerSupportFunction) which then releases the ECB. This asynchronous processing releases the ISAPI worker thread immediately, and offloads processing to a separate thread that is managed by ASP.NET.

ASP.NET receives this ecb reference and uses it internally to retrieve information about the current request such as server variables and POST data as well as returning output back to the server. The ecbstays alive until the request finishes or times out in IIS and ASP.NET continues to communicate with it until the request is done. Output is written into the ISAPI output stream (ecb.WriteClient()) and when the request is done, the ISAPI extension is notified of request completion to let it know that the ECB can be freed. This implementation is very efficient as the .NET classes essentially act as a fairly thin wrapper around the high performance, unmanaged ISAPI ECB.
.


그리드형