Merge dynamic manifest updates to Github (#7)

This change introduces dynamic manifest updates to asset streaming.

Asset streaming describes the directory to be streamed in a manifest, which is a proto definition of all content metadata. This information is sufficient to answer `stat` and `readdir` calls in the FUSE layer without additional round-trips to the workstation.

When a directory is streamed for the first time, the corresponding manifest is created in two steps:
1. The directory is traversed recursively and the inode information of all contained files and directories is written to the manifest.
2. The content of all identified files is processed to generate each file's chunk list. This list is part of the definition of a file in the manifest.
  * The chunk boundaries are identified using our implementation of the FastCDC algorithm.
  * The hash of each chunk is calculated using the BLAKE3 hash function.
  * The length and hash of each chunk is appended to the file's chunk list.

Prior to this change, when the user mounted a workstation directory on a client, the asset streaming server pushed an intermediate manifest to the gamelet as soon as step 1 was completed. At this point, the FUSE client started serving the virtual file system and was ready to answer `stat` and `readdir` calls. In case the FUSE client received any call that required file contents, such as `read`, it would block the caller until the server completed step 2 above and pushed the final manifest to the client. This works well for large directories (> 100GB) with a reasonable number of files (< 100k). But when dealing with millions of tiny files, creating the full manifest can take several minutes.

With this change, we introduce dynamic manifest updates. When the FUSE layer receives an `open` or `readdir` request for a file or directory that is incomplete, it sends an RPC to the workstation about what information is missing from the manifest. The workstation identifies the corresponding file chunker or directory scanner tasks and moves them to the front of the queue. As soon as the task is completed, the workstation pushes an updated intermediate manifest to the client which now includes the information to serve the FUSE request. The queued FUSE request is resumed and returns the result to the caller.

While this does not reduce the required time to build the final manifest, it splits up the work into smaller tasks. This allows us to interrupt the current work and prioritize those tasks which are required to handle an incoming request from the client. While this still takes a round-trip to the workstation plus the processing time for the task, an updated manifest is received within a few seconds, which is much better than blocking for several minutes. 

This latency is only visible when serving data while the manifest is still being created. The situation improves as the manifest creation on the workstation progresses. As soon as the final manifest is pushed, all metadata can be served directly without having to wait for pending tasks.
This commit is contained in:
chrschng
2022-11-16 11:20:32 +01:00
committed by GitHub
parent 23fcd5ef1d
commit 76bbdb01bb
32 changed files with 1286 additions and 411 deletions

View File

@@ -14,10 +14,6 @@
// This proto defines the service to stream chunks from workstations to
// gamelet instances.
//
// References:
// * (internal).0
// * (internal)
syntax = "proto3";
@@ -25,6 +21,8 @@ import "proto/manifest.proto";
package cdc_ft.proto;
// Describes the interface to fetch data from the asset streaming server running
// on the workstation.
service AssetStreamService {
// Requests the contents of a chunk by its id.
rpc GetContent(GetContentRequest) returns (GetContentResponse) {}
@@ -53,12 +51,20 @@ message SendCachedContentIdsRequest {
message SendCachedContentIdsResponse {}
// Describes the interface to receive manifest updates and prioritize processing
// of specific assets.
service ConfigStreamService {
// Streaming channel to receive continuous manifest updates.
rpc GetManifestId(GetManifestIdRequest)
returns (stream GetManifestIdResponse) {}
// Acknowledges that a specific manifest ID has been received.
rpc AckManifestIdReceived(AckManifestIdReceivedRequest)
returns (AckManifestIdReceivedResponse) {}
// Requests the server to process the given in-progress assets as soon as
// possible.
rpc ProcessAssets(ProcessAssetsRequest) returns (ProcessAssetsResponse) {}
}
message GetManifestIdRequest {}
@@ -73,3 +79,9 @@ message AckManifestIdReceivedRequest {
}
message AckManifestIdReceivedResponse {}
message ProcessAssetsRequest {
repeated string relative_paths = 1;
}
message ProcessAssetsResponse {}