Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANCM in-proc hosting scenario #5403

Closed
Rick-Anderson opened this issue Feb 8, 2018 · 5 comments
Closed

ANCM in-proc hosting scenario #5403

Rick-Anderson opened this issue Feb 8, 2018 · 5 comments
Assignees
Labels

Comments

@Rick-Anderson
Copy link
Contributor

aspnet/AspNetCoreModule#265

see aspnet/Announcements#288

@Rick-Anderson Rick-Anderson added this to the 2018 - Quarter 1 milestone Feb 8, 2018
@guardrex guardrex added the 2.1 label Feb 14, 2018
@scottaddie scottaddie added the Help wanted Up for grabs. We would accept a PR to help resolve this issue label Mar 2, 2018
@guardrex guardrex removed the Help wanted Up for grabs. We would accept a PR to help resolve this issue label Mar 15, 2018
@guardrex guardrex added 2.2 and removed 2.1 labels Apr 11, 2018
@guardrex guardrex modified the milestones: 2018 - Quarter 2, Backlog Apr 11, 2018
@guardrex
Copy link
Collaborator

Adding the blurb from the 2.1-preview2 roadmap blog post:

Version agility

Since ANCM is a global singleton, it can’t version or ship with the same agility as the rest of the ASP.NET Core. In 2.1, we’ve refactored ANCM into two pieces: the shim and the request handler. The shim will continue to be installed as a global singleton, but the request handler will ship as part of the new Microsoft.AspNetCore.Server.IIS package which can be referenced directly by your application. This will allow you to use different versions of ANCM with different app deployments.

In-process hosting

In 2.1, we’re adding a new in-process mode to ANCM for .NET Core based apps where the runtime and your app are both loaded inside the IIS worker process (w3wp.exe). This removes the performance penalty of proxying requests over the loopback adapter. Our preliminary tests show performance improvements of around ~4.4x compared to running out-of-process. Configuring your app to use to use the in-process model can be done using web.config, and will be eventually be the default for new applications targeting 2.1:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" hostingModel="inprocess" />

Alternatively, you can set a project property in your project file:

<PropertyGroup>
  <AspNetCoreModuleHostingModel>inprocess</AspNetCoreModuleHostingModel>
</PropertyGroup>

@guardrex guardrex changed the title ANCM in-proc hosting - 6x the throughput on IIS! Better startup error handling ANCM in-proc hosting scenario Jul 21, 2018
@guardrex guardrex added the Pri1 label Sep 4, 2018
@guardrex guardrex modified the milestones: Backlog, Sprint 141 (9/3 to 9/21) Sep 4, 2018
@guardrex guardrex mentioned this issue Sep 4, 2018
32 tasks
@guardrex
Copy link
Collaborator

guardrex commented Sep 21, 2018

@Tratcher @jkotalik How do I describe ANCM's role now for requests coming from IIS on their way to IISHttpServer? (Step 3)

  1. Requests arrive from the web to the kernel-mode HTTP.sys driver.
  2. The HTTP.sys driver routes the requests to IIS on the website's configured port.
  3. WHAT happens here? ... passes the request to a custom IServer implementation, IISHttpServer.
  4. After IISHttpServer picks up the request, the request is pushed into the ASP.NET Core middleware pipeline.
  5. The middleware pipeline handles the request and passes it on as an HttpContext instance to the app's logic.
  6. The app's response is passed back to IIS, which pushes it back out to the HTTP client that initiated the request.

Does ANCM still handle the request?

ancm-inprocess

@Tratcher
Copy link
Member

That about covers it. ANCM serves two roles for in-proc:

  1. it does the app initialization, loads the CLR, calls Program.Main, etc..
  2. it's the native module in the IIS pipeline that surfaces requests to IISHttpServer.

@jkotalik
Copy link
Contributor

For 3, the native HttpContext is converted into a managed http context, which is routed through the IISHttpServer.

ANCM handles the lifetime of the native request, which managed code pinvokes into to call certain methods, ex: ReadRequestBody, WriteResponseHeaders, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants