diff --git a/content/master/composition/compositions.md b/content/master/composition/compositions.md index 81e71152..0bdba343 100644 --- a/content/master/composition/compositions.md +++ b/content/master/composition/compositions.md @@ -774,3 +774,35 @@ that isn't desired state. Functions can use context for this. Any function can write to the pipeline context. Crossplane passes the context to all following functions. When Crossplane has called all functions it discards the pipeline context. + +### Function response cache + +{{}} +Function response caching is an alpha feature. Enable it by setting the +`--enable-function-response-cache` feature flag. +{{< /hint >}} + +Crossplane can cache function responses to improve performance by reducing +repeated function calls. When enabled, Crossplane caches responses from +composition functions that include a Time-To-Live (TTL) value. + +The cache works by: +- Storing function responses on disk based on a hash of the request +- Only caching responses with a non-zero TTL +- Automatically removing expired cache entries +- Reusing cached responses for identical requests until they expire + +This feature is particularly useful for functions that: +- Perform expensive computations or external API calls +- Return stable results for the same inputs +- Include appropriate TTL values in their responses + +#### Cache configuration + +Control the cache behavior with these Crossplane pod arguments: + +- `--xfn-cache-max-ttl` - Maximum cache duration (default: 24 hours) + +The cache stores files in the `/cache/xfn/` directory within the Crossplane pod. +For better performance, consider using an in-memory cache by mounting an +emptyDir volume with `medium: Memory`. diff --git a/content/master/get-started/install.md b/content/master/get-started/install.md index be1aa667..ef9f8e65 100644 --- a/content/master/get-started/install.md +++ b/content/master/get-started/install.md @@ -108,6 +108,7 @@ at the table below. | Beta | `--enable-usages` | Enable support for Usages. | | Beta | `--enable-realtime-compositions` | Enable support for real time compositions. | | Alpha | `--enable-dependency-version-upgrades ` | Enable automatic version upgrades of dependencies when updating packages. | +| Alpha | `--enable-function-response-cache` | Enable caching of composition function responses to improve performance. | | Alpha | `--enable-signature-verification` | Enable support for package signature verification via ImageConfig API. | {{< /table >}} {{< /expand >}} diff --git a/content/master/operations/operation.md b/content/master/operations/operation.md index bdd69c02..94ffc761 100644 --- a/content/master/operations/operation.md +++ b/content/master/operations/operation.md @@ -297,6 +297,31 @@ For more details on RBAC configuration, see the [Compositions RBAC documentation]({{}}). {{}} +### Function response cache + +{{}} +Function response caching is an alpha feature. Enable it by setting the +`--enable-function-response-cache` feature flag. +{{< /hint >}} + +Operations can benefit from function response caching to improve performance, +especially for operations that: +- Call the same functions repeatedly with identical inputs +- Use functions that perform expensive computations or external API calls +- Run frequently through CronOperation or WatchOperation + +The cache works the same way as for Compositions - function responses with +time to live values are cached and reused for identical requests until +they expire. + +This is particularly useful for Operations that: +- Validate configurations using expensive checks +- Query external systems for status information +- Perform complex calculations that don't change frequently + +For cache configuration details, see the +[Function response cache documentation]({{}}). + ### Required resources Operations can preload resources for functions to access: