forked from dagger/dagger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make function calls cached session-wide (dagger#9621)
* make function calls cached session-wide Recently, function calls were "upgraded" from being tainted (i.e. never cached) to cached-per-client in terms of dagql caching. This helped fixed a problem with duplicated telemetry. However, we currently have two layers of caching between dagql and buildkit and this cache-per-client logic inadvertently ended up also applying to the buildkit cache key, which increased the amount of cache invalidation there. This surprisingly didn't have a super noticeable effect on performance at least as far as our tests that always run go. However, the benchmark tests Connor added did end up hitting this, specifically in BenchmarkLotsOfDeps, which creates a complicated DAG of function calls that, if not cached correctly, will have O(n^2) performance (in memory and time). The fix here changes function calls to be cached in dagql session-wide and restores the previous buildkit cache key so that we get consistent session-wide cache hits there again too. There is some complication from secrets, sockets and other client-specific resources though. They need to transfer from return values of function calls to the calling client whether or not the client hit the cache. To handle that problem, this change adds support for a "post call" callback that, if set, dagql will always execute on results whether or not they were retrieved from cache or an actual execution. The implementation is admittedly pretty kludgy and ugly right now, but I think we should go with it for now to fix this problem. We are about to embark on quite a bit of work around dagql caching so hopefully we can find a cleaner way of implementing post calls (or some equivalent replacement) at that time. Signed-off-by: Erik Sipsma <erik@sipsma.dev> * unwrap more in telemetry Signed-off-by: Erik Sipsma <erik@sipsma.dev> --------- Signed-off-by: Erik Sipsma <erik@sipsma.dev>
- Loading branch information
Showing
7 changed files
with
83 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters