dotnet / crank

Benchmarking infrastructure for applications
MIT License
988 stars 106 forks source link

Add agent files cache #688

Open sebastienros opened 9 months ago

sebastienros commented 9 months ago

The build and output files that are sent to the agent could be cached on the server by sending a custom etag header in the request which would contain the CRC32 of the file being uploaded.

The JobsController.SaveBodyAsync method could check if the header is set. If it is then it would seek a file named with this CRC32 value, and copy it instead of streaming the content from the client. Then stopped prematurely the request with a success code that indicates the content was cached (304). The controller would then log this result to show that the content was already found on the server.

The agent needs to use a folder that is reused across agent instances. This could be in {_buildPath}/.filecache. The agent can check the contents of this file on startup and remove older files when a customizable quotas is reached (argument). A good default could be 10GB (to allow files of 1GB so be kept locally).