1.Introduction
...
ActivationService is a GRPC service implementation for the scheduler that communicates with the container proxy.
It's implemented with Akka gRPC framework which uses protobuf service descriptor, and requests and responses will be streamed over an HTTP/2 connection.
Client To communicate between the schedule and the container proxy, the GRPC client is located in ContainerProxy, and the server is located in on the scheduler side.
As far as we know,in upstream logic, activationMessage In the upstream code (without scheduler), the activation message is pushed to the ContainerProxy, but herein the scheduler, the containerProxy using pull mode to get the activationMessage actively via Activation pulls the activation message actively via this ActivationService (akka-grpc service).
2.Architecture Diagram
- ContainerProxy sends ActivationRequest via fetchActivation method (Akka-grpc)
- ActivationService delegates the ActivationRequest to QueueManager.
- QueueManager responds with ActivationResponse to ActivationService.
- ActivationService responds with ActivationResponse to ContainerProxy
...
it is better for the performance to keep the created container rather than deleting or pausing it and reuse it, so if ContainerProxy uses pull mode can satisfy this.
Protobuf specification
1. rpc Below is the proto file including one method only: `rpc FetchActivation (FetchRequest) returns (FetchResponse) {}`
FetchActivation rpc is for fetching activation in the memory queue.
- FetchRequest includes two 7 fields
1: 1. fqn: the serialized content of FullyQualifiedEntityName
2. 2:rev: the serialized content of DocRevision, because one action can be updated, so need to provide corresponding DocRevision as well
- FetchResponse includes one field only
1 1. activationMessage, the serialize content of ActivationMessage
2. rpc RescheduleActivation (RescheduleRequest) returns (RescheduleResponse) {}
RescheduleActivation rpc is for rescheduling when the container proxy cannot process messages.
Code Block | ||
---|---|---|
| ||
//#services service ActivationService { //ContainerProxy call this grpc method to get ActivationMessage rpc FetchActivation (FetchRequest) returns (FetchResponse) {} rpc RescheduleActivation (RescheduleRequest) returns (RescheduleResponse) {} } //#services //#messages // The request message message FetchRequest { //initiator string invocationNamespace = 1; //the serialize content of FullyQualifiedEntityName string fqn = 2; //the serialize content of DocRevision string rev = 3; //the container id string containerId = 4; //the requested container is warmed or not bool warmed = 5; //duration of last invoked activation google.protobuf.Int64Value lastDuration = 6; //the requested container is alive or not bool alive = 7; } // The response message message FetchResponse { //the serialize content of ActivationMessage string activationMessage = 1; } message RescheduleRequest { string invocationNamespace = 1; string fqn = 2; string rev = 3; //the serialize content of ActivationMessage //message will be rescheduled by scheduler string activationMessage = 4; } message RescheduleResponse { // if reschedule request is failed, then it will be `false` bool isRescheduled = 1; } |
...