You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/references/auth.rst
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -204,15 +204,19 @@ It goes as follows:
204
204
JWT Cache
205
205
---------
206
206
207
-
PostgREST validates ``JWTs`` on every request. Signature validation (especially asymmetric such as RSA) is slow and we can cache ``JWT`` validation results to avoid this performance overhead.
207
+
JWT signature validation (specially :ref:`asym_keys` such as RSA) is slow, we can cache ``JWT`` validation results to avoid this performance overhead.
208
208
209
-
JWT caching is automatically enabled unless the config :code:`jwt-cache-max-entries` is set to 0.
209
+
The JWT cache is bounded and uses the `SIEVE algorithm <https://cachemon.github.io/SIEVE-website>`_ for efficient eviction. The cache is enabled by default and can be configured with :ref:`jwt-cache-max-entries`.
210
210
211
-
See :ref:`jwt-cache-max-entries` for more details.
211
+
It's recommended to leave the JWT cache enabled as our load tests indicate ~20% more throughput for simple GET requests when using it. This while reducing CPU utilization in exchange for a bit more memory.
212
+
213
+
:ref:`jwt_cache_metrics` are available.
212
214
213
215
.. note::
214
216
215
-
You can use the :ref:`server-timing_header` to see the effect of JWT caching.
217
+
- If the ``jwt-secret`` is changed and the config is reloaded, the JWT cache will reset.
218
+
- Invalid JWTs (such as expired ones), are cached. This to ensure responses stays fast under failure cases.
219
+
- You can use the :ref:`server-timing_header` to see the peformance benefit of JWT caching.
0 commit comments