mirror of
https://github.com/suitenumerique/docs.git
synced 2026-10-17 05:35:34 +02:00
## Purpose
A connection to the collaboration server — websocket or http fallback —
can chain up to three calls to the backend: users/me, documents/{id} and
accesses/me. On the fallback poll path this repeats every few seconds per
client, and the calls bypass the backend throttling (X-Y-Provider-Key),
so a busy instance hammers the backend unthrottled.
Add an opt-in authz cache in yhub, three layers with different
invalidation physics:
- identity: users/me -> userid, in-process per replica, keyed on the
SHA-256 of the Cookie header. Nothing can invalidate it and nothing
needs to: a dead session fails closed at the abilities fetch. Kills
the users/me call on every poll and REST request.
- abilities: the documents/{id} verdict, in the shared redis per
(document, cookie hash). The one payload a stale entry would
over-grant, so reset-connections retires every verdict of the
document — a single generation write — BEFORE triggering the recheck;
the recheck then re-runs authorize against post-invalidation state
and the revocation stays immediate. The TTL is only the backstop for
a lost kick. Anonymous callers share one entry per document: what
they may do is the link configuration, and nothing about them
distinguishes one from another.
- access date: the accesses/me created_at bounding the history a user
may read. Append-mostly by design, retired by the same per-document
kick as the abilities — a stale earlier date would widen the readable
history, hence the longest TTL of the three.
All three TTLs default to 0: caching off, byte-identical behavior.
Backend refusals (401/403/404) are cached like any verdict, so a client
that lost access costs one call per TTL instead of one per poll. An
unanswered backend is never cached — an error is not a permission
decision. Keys carry only sha256 hashes, never session ids.
Warm-state connections and polls make zero backend calls. Watch
yhub_authz_cache_lookups_total{layer,result} against
yhub_backend_request_duration_seconds{route} before raising the TTLs.
Docs Documentation
Welcome to the official documentation for Docs.
This documentation is organized by topic and audience. Use the section below to quickly find what you are looking for.
Table of Contents
-
Getting started
-
Configuration
-
Architecture & design
-
Usage & operations
-
Project & product
-
Assets