Skip to content

extracting new Azure.Functions.Rpc.Server assembly in preparation for compute separation - #11916

Merged
Brett Samblanet (brettsam) merged 3 commits into
devfrom
brettsam/extract-rpc-server
Aug 17, 2026
Merged

Brett Samblanet (brettsam) merged 3 commits into
devfrom
brettsam/extract-rpc-server

Conversation

@brettsam

@brettsam Brett Samblanet (brettsam) commented Aug 10, 2026 •

Copy link
Copy Markdown
Member

High-level this is moving our server-based Grpc functionality (including worker process management) into a new assembly called Azure.Fucntions.Rpc.Server. The base WebJobs.Grpc assembly continues to hold common functionality that we will use in a follow-up to introduce the "compute separation" functionality in an assembly called Azure.Functions.Rpc.Client.

Details are below, but only a few interfaces had to change to separate out some process-management that was baked into our lowest-level interfaces.

Summary

This PR extracts the existing host-managed Function RPC server and worker-process topology from Microsoft.Azure.WebJobs.Script.Grpc into a new Azure.Functions.Rpc.Server assembly.

The existing Grpc assembly remains the shared FunctionRpc contract, channel protocol, and ScriptHost invocation core. The implementation is intentionally dominated by repository-aware file moves; moved types retain their existing namespaces and behavior.

Assembly layout

Arrows point from consumer to dependency:

Microsoft.Azure.WebJobs.Script.WebHost
    ├──> Azure.Functions.Rpc.Server             (this PR)
    │       ├──> Microsoft.Azure.WebJobs.Script.Grpc
    │       └──> Microsoft.Azure.WebJobs.Script
    └──> Microsoft.Azure.WebJobs.Script.Grpc
                └──> Microsoft.Azure.WebJobs.Script

Azure.Functions.Rpc.Client                      (future PR)
    └──> Microsoft.Azure.WebJobs.Script.Grpc

Microsoft.Azure.WebJobs.Script.Grpc — shared core

Retains:

  • The protobuf source and sole generated FunctionRpc contract; generation remains server-only in this PR.
  • The internal WorkerChannel protocol engine, capabilities, message dispatch, events, conversions, and shared-memory helpers.
  • Process-neutral channel contracts and RPC channel state.
  • Dispatcher contracts/state, WorkerFunctionInvoker, descriptor providers, lifecycle services, and shutdown coordination.
  • HTTP/custom-handler configuration models and shared AddRpcScriptHostCoreServices registration.

Azure.Functions.Rpc.Server — standard host-managed topology

Owns:

  • The inbound ASP.NET Core gRPC server and FunctionRpcService.
  • Worker process management and process-backed gRPC/HTTP channels.
  • RPC channel managers, worker process factories, initialization, and load balancing.
  • Standard dispatchers, concurrency management, metadata discovery, and worker managers.
  • Concrete HTTP/custom-handler execution.
  • AddScriptGrpc, AddRpcScriptHostServices, and AddCommonRpcServices.

Azure.Functions.Rpc.Client — future outbound topology

A future PR will add the outbound client topology, including Grpc.Net.Client, connection/stream management, client channels, and a client dispatcher. It will reference the shared Grpc assembly, not Server.

Changes beyond relocating classes

Channel contracts are split by responsibility

  • IWorkerChannel remains in Grpc and is now process-neutral: it exposes only Id and GetWorkerStatusAsync.
  • The former broad IRpcWorkerChannel contract is renamed to IFunctionRpcChannel and remains in Grpc with its protocol members unchanged.
  • Server introduces IWorkerProcessChannel, which adds WorkerProcess and StartWorkerProcessAsync.
  • Server's IRpcWorkerChannel composes IFunctionRpcChannel and IWorkerProcessChannel.
  • IHttpWorkerChannel moves to Server and inherits IWorkerProcessChannel.

WorkerChannel now implements IFunctionRpcChannel and no longer requires every future channel topology to expose or launch a local process. It retains WorkerProcessId, resource-disposal hooks, and the complete protocol/disposal implementation.

GrpcWorkerChannel implements the Server composite interface. Its process-start and disposal bodies are unchanged; only the now-unnecessary override modifiers were removed from the process members.

DI registration movement is minimized

Registration methods that reference Server-owned concrete types must move to Server. To keep this mechanical:

  • AddScriptGrpc moves with its existing class, namespace, method name, and call sites unchanged.
  • The original RpcServiceCollectionExtensions class moves to Server with AddRpcScriptHostServices and AddCommonRpcServices unchanged.
  • Only the newly separated shared registrations receive a new Grpc-owned class/method: RpcScriptHostCoreServiceCollectionExtensions.AddRpcScriptHostCoreServices.
  • Existing call sites and registration ordering remain unchanged.

Package ownership follows implementation ownership

  • Server now directly owns Grpc.AspNetCore, Mono.Posix.NETStandard, and Microsoft.Azure.WebJobs.Rpc.Core.
  • Grpc directly owns Google.Protobuf, Grpc.Core.Api, and private Grpc.Tools, because it owns protobuf generation.
  • Grpc.Net.Client is not introduced in this PR.

Temporary visibility preserves a mechanical extraction

Microsoft.Azure.WebJobs.Script and Microsoft.Azure.WebJobs.Script.Grpc temporarily grant Server internal access. This avoids promoting broad implementation details to public API or introducing a large host-adapter abstraction during the move. Existing test-equivalent friend access is mirrored for moved internal types.

Build and runtime wiring includes the new assembly

  • WebHost directly references Server and Grpc.
  • Server is added to the solution and official package build.
  • Runtime assembly policies, generated runtime metadata, and the WebHost deps baseline include Azure.Functions.Rpc.Server.
  • Package direction is Server -> Grpc, with no Grpc -> Server dependency.

Why Azure.Functions.Rpc.Server?

Microsoft.Azure.WebJobs.* is an existing legacy product identity. New assemblies should not introduce additional WebJobs-named components when the functionality is part of the Azure Functions runtime rather than the WebJobs programming model.

Azure.Functions.Rpc.Server:

  • Describes the assembly by its topology role: the inbound server and local worker-process implementation.
  • Establishes a consistent future family with Azure.Functions.Rpc.Client.
  • Avoids expanding the legacy WebJobs assembly/package naming surface.
  • Makes the Server/Client dependency boundary visible at the assembly level.

Moved classes intentionally retain their existing Microsoft.Azure.WebJobs.Script.* namespaces for now. Renaming them in the same PR would obscure the assembly-boundary review, reduce rename detection, and create unnecessary source churn. The new package, assembly, and root namespace use Azure.Functions.Rpc.Server; class namespace alignment can be handled separately if desired.

Scope and behavior

This PR does not add Client, outbound transport, composition, channel handles, type forwarding, or a new Host/Worker product. The protobuf contract stays in Grpc, and standard WebHost remains the only executable topology.

No worker startup, invocation, shutdown, or disposal behavior is intended to change.

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)

Comment thread src/WebJobs.Script.Grpc/IWorkerChannel.cs
Comment thread src/WebJobs.Script/Properties/AssemblyInfo.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extracts the host-managed Function RPC server topology (ASP.NET Core gRPC server + worker process management + dispatchers/channel managers) from Microsoft.Azure.WebJobs.Script.Grpc into a new assembly/package Azure.Functions.Rpc.Server, leaving Microsoft.Azure.WebJobs.Script.Grpc as the process-neutral shared RPC/channel core in preparation for a future client topology.

Changes:

  • Introduces src/Functions.Rpc.Server project and wires it into WebHost, solution, packaging, runtime-assembly metadata, and test projects.
  • Splits channel/process responsibilities by making IWorkerChannel process-neutral in Grpc and introducing server-side process channel contracts in Server.
  • Moves/centralizes shared ScriptHost RPC registrations into RpcScriptHostCoreServiceCollectionExtensions.AddRpcScriptHostCoreServices.

Reviewed changes

Copilot reviewed 30 out of 87 changed files in this pull request and generated no comments.

Show a summary per file
File Description
WebJobs.Script.sln Adds the new Server project to the solution.
tools/ExtensionsMetadataGenerator/test/ExtensionsMetadataGeneratorTests/ExistingRuntimeAssemblies.txt Adds Server assembly to runtime assembly test baseline.
tools/ExtensionsMetadataGenerator/src/ExtensionsMetadataGenerator/runtimeAssemblies.txt Adds Server assembly to runtime assembly list.
test/WebJobs.Script.Tests/WebJobs.Script.Tests.csproj References the new Server project.
test/WebJobs.Script.Tests/Microsoft.Azure.WebJobs.Script.WebHost.deps.json Updates deps baseline to include Server and moved deps.
test/WebJobs.Script.Tests/DependencyTests.cs Excludes Server dll from dependency drift checks.
test/WebJobs.Script.Tests.Shared/WebJobs.Script.Tests.Shared.csproj References the new Server project.
test/WebJobs.Script.Tests.Integration/WebJobs.Script.Tests.Integration.csproj References the new Server project.
src/WebJobs.Script/runtimeassemblies.json Adds Server to runtime assembly resolution policy list.
src/WebJobs.Script/runtimeassemblies-relaxed.json Adds Server to relaxed runtime assembly list.
src/WebJobs.Script/Properties/AssemblyInfo.cs Grants Server InternalsVisibleTo access.
src/WebJobs.Script.WebHost/WebJobs.Script.WebHost.csproj References the new Server project.
src/WebJobs.Script.WebHost/DependencyInjection/DependencyValidator/DependencyValidator.cs Updates expected type assembly for WorkerConcurrencyManager.
src/WebJobs.Script.Grpc/WebJobs.Script.Grpc.csproj Moves server-only packages out; retains protobuf-generation-related packages.
src/WebJobs.Script.Grpc/Rpc/IFunctionRpcChannel.cs Renames/reshapes IRpc channel contract to be process-neutral core (IFunctionRpcChannel).
src/WebJobs.Script.Grpc/Properties/AssemblyInfo.cs Grants Server InternalsVisibleTo access.
src/WebJobs.Script.Grpc/IWorkerChannel.cs Makes channel contract process-neutral (removes process members).
src/WebJobs.Script.Grpc/Hosting/RpcScriptHostCoreServiceCollectionExtensions.cs Adds new shared DI registrations method in Grpc core.
src/WebJobs.Script.Grpc/Channel/WorkerChannel.cs Adjusts WorkerChannel to implement the new process-neutral core interface.
src/Functions.Rpc.Server/Functions.Rpc.Server.csproj New Server project/package definition.
src/Functions.Rpc.Server/Properties/AssemblyInfo.cs Friend assemblies for tests and DynamicProxyGenAssembly2.
src/Functions.Rpc.Server/GrpcServiceCollectionsExtensions.cs Adds DI extension for inbound RPC server + channels in Server.
src/Functions.Rpc.Server/WorkerFunctionMetadataProvider.cs Server-side worker metadata provider implementation (moved).
src/Functions.Rpc.Server/WorkerConcurrencyManager.cs Server-side dynamic concurrency manager (moved).
src/Functions.Rpc.Server/WorkerChannelThrottleProvider.cs Server-side throttle provider scaffold.
src/Functions.Rpc.Server/RpcWebHostWorkerManager.cs WebHost worker manager implementation for Server topology.
src/Functions.Rpc.Server/RpcScriptHostWorkerManager.cs ScriptHost worker manager implementation for Server topology.
src/Functions.Rpc.Server/IWorkerProcessChannel.cs New server-side contract for channels that manage a worker process.
src/Functions.Rpc.Server/Hosting/RpcServiceCollectionExtensions.cs Moves ScriptHost/WebHost RPC DI registrations into Server.
src/Functions.Rpc.Server/Hosting/HttpScriptHostRecycleOptionsSetup.cs Server-side hosted option setup for HTTP worker recycle behavior.
src/Functions.Rpc.Server/Channel/RpcWorkerChannelExtensions.cs Adds helper to shutdown + dispose channels.
src/Functions.Rpc.Server/Channel/GrpcWorkerChannelFactory.cs Server-side gRPC worker channel factory (moved).
src/Functions.Rpc.Server/Channel/GrpcWorkerChannel.cs Server composite RPC worker channel implementation.
src/Functions.Rpc.Server/Rpc/IRpcServer.cs Server-side IRpcServer contract.
src/Functions.Rpc.Server/Rpc/RpcInitializationService.cs Server startup/shutdown orchestration for RPC server/channels.
src/Functions.Rpc.Server/Rpc/IWebHostRpcWorkerChannelManager.cs Server-side WebHost channel manager contract.
src/Functions.Rpc.Server/Rpc/WebHostRpcWorkerChannelManager.cs Server-side WebHost channel manager implementation.
src/Functions.Rpc.Server/Rpc/IJobHostRpcWorkerChannelManager.cs Server-side JobHost channel manager contract.
src/Functions.Rpc.Server/Rpc/JobHostRpcWorkerChannelManager.cs Server-side JobHost channel manager implementation.
src/Functions.Rpc.Server/Rpc/IRpcWorkerChannel.cs Server composite channel contract (FunctionRpc + process channel).
src/Functions.Rpc.Server/Rpc/IRpcWorkerChannelFactory.cs Server-side RPC worker channel factory contract.
src/Functions.Rpc.Server/Rpc/IRpcWorkerProcessFactory.cs Server-side process factory contract for RPC workers.
src/Functions.Rpc.Server/Rpc/IRpcWorkerChannelDictionary.cs Server-side concurrent dictionary wrapper for channels.
src/Functions.Rpc.Server/Rpc/RpcWorkerProcessFactory.cs Creates RPC worker processes tied to the inbound server URI.
src/Functions.Rpc.Server/Rpc/RpcWorkerProcess.cs RPC worker process implementation (moved).
src/Functions.Rpc.Server/Rpc/RpcWorkerContext.cs RPC worker process context/args for startup.
src/Functions.Rpc.Server/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs Server-side RPC dispatcher implementation (moved).
src/Functions.Rpc.Server/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcherLoadBalancer.cs Server-side load balancing across channels.
src/Functions.Rpc.Server/Rpc/FunctionRegistration/IRpcFunctionInvocationDispatcherLoadBalancer.cs Server-side load balancer contract.
src/Functions.Rpc.Server/FunctionInvocationDispatcherFactory.cs Chooses HTTP vs RPC dispatcher implementation for Server topology.
src/Functions.Rpc.Server/Server/Startup.cs ASP.NET Core gRPC server Startup for inbound FunctionRpc.
src/Functions.Rpc.Server/Server/AspNetCoreGrpcHostBuilder.cs HostBuilder for inbound gRPC server.
src/Functions.Rpc.Server/Server/AspNetCoreGrpcServer.cs Inbound gRPC server implementation.
src/Functions.Rpc.Server/Server/FunctionRpcService.cs gRPC service implementation for event stream.
src/Functions.Rpc.Server/Server/ExtensionsCompositeEndpointDataSource.cs Extension endpoint composition/initialization for server routing.
src/Functions.Rpc.Server/ProcessManagement/IWorkerProcess.cs Worker process contract (moved).
src/Functions.Rpc.Server/ProcessManagement/IWorkerProcessFactory.cs Process factory contract (moved).
src/Functions.Rpc.Server/ProcessManagement/IProcessRegistry.cs Process registry contract (moved).
src/Functions.Rpc.Server/ProcessManagement/WorkerContext.cs Base worker process context (moved).
src/Functions.Rpc.Server/ProcessManagement/WorkerProcess.cs Base worker process implementation (moved).
src/Functions.Rpc.Server/ProcessManagement/WorkerProcessUtilities.cs Worker process logging helpers (moved).
src/Functions.Rpc.Server/ProcessManagement/WorkerProcessExitException.cs Worker process exit exception type (moved).
src/Functions.Rpc.Server/ProcessManagement/DefaultWorkerProcessFactory.cs Default process start implementation (moved).
src/Functions.Rpc.Server/ProcessManagement/EmptyProcessRegistry.cs No-op registry implementation (moved).
src/Functions.Rpc.Server/ProcessManagement/JobObjectRegistry.cs Windows job object registry for child-process cleanup (moved).
src/Functions.Rpc.Server/Http/IHttpWorkerService.cs HTTP worker service contract (moved).
src/Functions.Rpc.Server/Http/DefaultHttpWorkerService.cs Default HTTP worker invocation/ping implementation (moved).
src/Functions.Rpc.Server/Http/IHttpWorkerChannel.cs HTTP worker channel contract moved to Server and made process-capable.
src/Functions.Rpc.Server/Http/IHttpWorkerChannelFactory.cs HTTP worker channel factory contract (moved).
src/Functions.Rpc.Server/Http/HttpWorkerChannelFactory.cs HTTP worker channel factory implementation (moved).
src/Functions.Rpc.Server/Http/IHttpWorkerProcessFactory.cs HTTP worker process factory contract (moved).
src/Functions.Rpc.Server/Http/HttpWorkerProcessFactory.cs HTTP worker process factory implementation (moved).
src/Functions.Rpc.Server/Http/HttpWorkerProcess.cs HTTP worker process implementation (moved).
src/Functions.Rpc.Server/Http/HttpWorkerContext.cs HTTP worker process context (moved).
src/Functions.Rpc.Server/Http/HttpWorkerConstants.cs HTTP worker constants (moved).
src/Functions.Rpc.Server/Http/HttpWorkerFunctionProvider.cs Generates function metadata from configured HTTP routes.
src/Functions.Rpc.Server/Http/RpcScriptInvocationContextExtensions.cs Converts ScriptInvocationContext to HTTP invocation payload.
src/Functions.Rpc.Server/Http/HttpScriptInvocationContext.cs HTTP invocation request model (moved).
src/Functions.Rpc.Server/Http/HttpScriptInvocationContextExtensions.cs Converts HTTP invocation context to HttpRequestMessage.
src/Functions.Rpc.Server/Http/HttpScriptInvocationResult.cs HTTP invocation response model (moved).
src/Functions.Rpc.Server/Http/HttpScriptInvocationResultExtensions.cs Converts HTTP worker results back to ScriptInvocationResult.
src/Functions.Rpc.Server/Http/HttpOutputBindingResponse.cs Model for http output binding responses.
src/Functions.Rpc.Server/HttpFunctionInvocationDispatcher.cs HTTP dispatcher moved into Server assembly.
release_notes.md Adds a release note entry for the extraction.
eng/ci/templates/official/jobs/build-artifacts-windows.yml Ensures Server project is packed in official builds.
Directory.Packages.props Adds package versions for Protobuf/Grpc tooling now owned by Grpc core project.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@brettsam Brett Samblanet (brettsam) added the compute-separation Compute separation / external worker support label Aug 11, 2026
Comment thread src/Functions.Rpc.Server/IWorkerProcessChannel.cs
Comment thread src/Functions.Rpc.Server/Functions.Rpc.Server.csproj
Comment thread src/Functions.Rpc.Server/Functions.Rpc.Server.csproj
Comment thread src/Functions.Rpc.Server/Functions.Rpc.Server.csproj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compute-separation Compute separation / external worker support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants