mirror of https://github.com/crossplane/docs.git
Document function response cache
Signed-off-by: Nic Cope <nicc@rk0n.org>
This commit is contained in:
parent
1e31df9086
commit
a21cd790df
|
|
@ -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
|
write to the pipeline context. Crossplane passes the context to all following
|
||||||
functions. When Crossplane has called all functions it discards the pipeline
|
functions. When Crossplane has called all functions it discards the pipeline
|
||||||
context.
|
context.
|
||||||
|
|
||||||
|
### Function response cache
|
||||||
|
|
||||||
|
{{<hint "note" >}}
|
||||||
|
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`.
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ at the table below.
|
||||||
| Beta | `--enable-usages` | Enable support for Usages. |
|
| Beta | `--enable-usages` | Enable support for Usages. |
|
||||||
| Beta | `--enable-realtime-compositions` | Enable support for real time compositions. |
|
| 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-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. |
|
| Alpha | `--enable-signature-verification` | Enable support for package signature verification via ImageConfig API. |
|
||||||
{{< /table >}}
|
{{< /table >}}
|
||||||
{{< /expand >}}
|
{{< /expand >}}
|
||||||
|
|
|
||||||
|
|
@ -297,6 +297,31 @@ For more details on RBAC configuration, see the
|
||||||
[Compositions RBAC documentation]({{<ref "../composition/compositions#grant-access-to-composed-resources">}}).
|
[Compositions RBAC documentation]({{<ref "../composition/compositions#grant-access-to-composed-resources">}}).
|
||||||
{{</hint>}}
|
{{</hint>}}
|
||||||
|
|
||||||
|
### Function response cache
|
||||||
|
|
||||||
|
{{<hint "note" >}}
|
||||||
|
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]({{<ref "../composition/compositions#function-response-cache">}}).
|
||||||
|
|
||||||
### Required resources
|
### Required resources
|
||||||
|
|
||||||
Operations can preload resources for functions to access:
|
Operations can preload resources for functions to access:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue