Skip to content

Commit d5bfb77

Browse files
authored
docs: clarify http cache filter architecture and document filesystem storage backend configuration (#40842)
Commit Message: docs: clarify http cache filter architecture; document filesystem storage backend config Additional Description: - Clarify the architecture and extension points (HTTP Cache filter vs. storage backends) and how a storage backend is selected - Add a filesystem storage backend configuration example - Add links to related API/docs in the "See also" section Partially addresses #16246. Risk Level: None (docs-only) Testing: - CI passed for this PR - Verified in the preview artifact: * the "Architecture and extension points" section appears in the page (anchor link visible) * both example blocks appear under "Example configuration" * the File System backend YAML snippet renders via `literalinclude` (slice) with line numbers matching the source * the download link for `http-cache-configuration-fs.yaml` works * the "See also" links resolve Docs Changes: - docs/root/configuration/http/http_filters/cache_filter.rst - docs/root/configuration/http/http_filters/_include/http-cache-configuration-fs.yaml (new) - docs/BUILD (added FS include path to `configs` exclude list) --------- Signed-off-by: Renin John <[email protected]>
1 parent a3f6c1c commit d5bfb77

File tree

3 files changed

+97
-1
lines changed

3 files changed

+97
-1
lines changed

docs/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ filegroup(
2222
"root/operations/_include/traffic_tapping_*.yaml",
2323
"root/configuration/http/http_filters/_include/checksum_filter.yaml",
2424
"root/configuration/http/http_filters/_include/dns-cache-circuit-breaker.yaml",
25+
"root/configuration/http/http_filters/_include/http-cache-configuration-fs.yaml",
2526
"root/configuration/other_features/_include/dlb.yaml",
2627
"root/configuration/other_features/_include/hyperscan_matcher.yaml",
2728
"root/configuration/other_features/_include/hyperscan_matcher_multiple.yaml",
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
static_resources:
2+
listeners:
3+
- address:
4+
socket_address:
5+
address: 0.0.0.0
6+
port_value: 8000
7+
filter_chains:
8+
- filters:
9+
- name: envoy.filters.network.http_connection_manager
10+
typed_config:
11+
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
12+
codec_type: AUTO
13+
stat_prefix: ingress_http
14+
route_config:
15+
name: local_route
16+
virtual_hosts:
17+
- name: backend
18+
domains:
19+
- "*"
20+
routes:
21+
- match:
22+
prefix: "/service/1"
23+
route:
24+
cluster: service1
25+
- match:
26+
prefix: "/service/2"
27+
route:
28+
cluster: service2
29+
http_filters:
30+
- name: envoy.filters.http.cache
31+
typed_config:
32+
"@type": type.googleapis.com/envoy.extensions.filters.http.cache.v3.CacheConfig
33+
typed_config:
34+
"@type": type.googleapis.com/envoy.extensions.http.cache.file_system_http_cache.v3.FileSystemHttpCacheConfig
35+
manager_config:
36+
thread_pool:
37+
thread_count: 2
38+
cache_path: /var/cache/envoy
39+
max_cache_size_bytes: 1073741824
40+
- name: envoy.filters.http.router
41+
typed_config:
42+
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
43+
44+
clusters:
45+
- name: service1
46+
type: STRICT_DNS
47+
lb_policy: ROUND_ROBIN
48+
load_assignment:
49+
cluster_name: service1
50+
endpoints:
51+
- lb_endpoints:
52+
- endpoint:
53+
address:
54+
socket_address:
55+
address: service1
56+
port_value: 8000
57+
- name: service2
58+
type: STRICT_DNS
59+
lb_policy: ROUND_ROBIN
60+
load_assignment:
61+
cluster_name: service2
62+
endpoints:
63+
- lb_endpoints:
64+
- endpoint:
65+
address:
66+
socket_address:
67+
address: service2
68+
port_value: 8000

docs/root/configuration/http/http_filters/cache_filter.rst

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ For HTTP Responses:
3636
HTTP Cache delegates the actual storage of HTTP responses to implementations of the ``HttpCache`` interface. These implementations can
3737
cover all points on the spectrum of persistence, performance, and distribution, from local RAM caches to globally distributed
3838
persistent caches. They can be fully custom caches, or wrappers/adapters around local or remote open-source or proprietary caches.
39-
Currently the only available cache storage implementation is :ref:`SimpleHTTPCache <envoy_v3_api_msg_extensions.http.cache.simple_http_cache.v3.SimpleHttpCacheConfig>`.
39+
Built-in cache storage backends include :ref:`SimpleHttpCacheConfig <envoy_v3_api_msg_extensions.http.cache.simple_http_cache.v3.SimpleHttpCacheConfig>` (in-memory) and :ref:`FileSystemHttpCacheConfig <envoy_v3_api_msg_extensions.http.cache.file_system_http_cache.v3.FileSystemHttpCacheConfig>` (persistent; LRU).
40+
41+
Architecture and extension points
42+
---------------------------------
43+
44+
Envoy’s HTTP caching is split into:
45+
46+
* **HTTP Cache filter** (extension name ``envoy.filters.http.cache``, category ``envoy.filters.http``) — configured via ``CacheConfig`` to apply HTTP caching semantics.
47+
* **Cache storage backends** (extension category ``envoy.http.cache``) — the filter delegates object storage/retrieval to a backend, selected via a nested ``typed_config`` in ``CacheConfig``.
4048

4149
Example configuration
4250
---------------------
@@ -50,7 +58,26 @@ Example filter configuration with a ``SimpleHttpCache`` cache implementation:
5058
:lineno-start: 29
5159
:caption: :download:`http-cache-configuration.yaml <_include/http-cache-configuration.yaml>`
5260

61+
Example filter configuration with a ``FileSystemHttpCache`` cache implementation:
62+
63+
.. literalinclude:: _include/http-cache-configuration-fs.yaml
64+
:language: yaml
65+
:start-at: http_filters:
66+
:end-before: envoy.filters.http.router
67+
:linenos:
68+
:lineno-match:
69+
:caption: :download:`http-cache-configuration-fs.yaml <_include/http-cache-configuration-fs.yaml>`
70+
5371
.. seealso::
5472

5573
:ref:`Envoy Cache Sandbox <install_sandboxes_cache_filter>`
5674
Learn more about the Envoy Cache filter in the step by step sandbox.
75+
76+
:ref:`HTTP Cache filter (proto file) <envoy_v3_api_file_envoy/extensions/filters/http/cache/v3/cache.proto>`
77+
``CacheConfig`` API reference.
78+
79+
:ref:`In-memory storage backend <envoy_v3_api_file_envoy/extensions/http/cache/simple_http_cache/v3/config.proto>`
80+
``SimpleHttpCacheConfig`` API reference.
81+
82+
:ref:`Persistent on-disk storage backend <config_http_caches_file_system_http_cache>`
83+
Docs page for File System Http Cache; links to ``FileSystemHttpCacheConfig`` API reference.

0 commit comments

Comments
 (0)