From 0402b1c7dbe549a7189ba8f4ab1ffb906117bfbd Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 1 Oct 2026 15:21:30 -1000 Subject: Keep clone files and oversized responses out of the cache The dumb transport reads files that already sit on the disk, so a pack copied into a slot cost that disk twice and the request a second write of every byte. A snapshot took a slot whatever its size, so a visitor naming distinct refs and ids could fill the cache root with archives. `cache-max-slot-size`, 64 MB unless set, now serves a larger response from the lock file and drops it, along with any expired copy it would have replaced. --- MANUAL.txt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'MANUAL.txt') diff --git a/MANUAL.txt b/MANUAL.txt index d1150ef..0ea60ff 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -59,6 +59,12 @@ cache-index-ttl:: version of the repository index page. See also: "The cache". Default value: "5". +cache-max-slot-size:: + Number which specifies the largest response, in kilobytes, that a cache + slot may keep. A larger response is still served but not kept, so one + archive cannot take a slot's worth of disk. Set to "0" to remove the + limit. See also: "The cache". Default value: "65536" (64 MB). + cache-root:: Path used to store the cgit cache entries. Default value: "/var/cache/cgit". See also: "Macro expansion" and the note on ownership @@ -217,7 +223,8 @@ enable-html-serving:: enable-http-clone:: If set to "1", cgit acts as a dumb HTTP endpoint for git clones. Adding "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" to clone-url exposes it. - A site that serves git repositories another way can turn this off. + The files it serves come straight off the disk and are never cached. A + site that serves git repositories another way can turn this off. Default value: "1". enable-index-links:: @@ -910,7 +917,9 @@ All cache ttl values are in minutes. Negative ttl values indicate that a page type will never expire, and thus the first time a URL is accessed, the result will be cached indefinitely, even if the underlying git repository changes. Conversely, when a ttl value is zero, the cache is disabled for that particular -page type. +page type. The files of the dumb transport are never cached, since they already +sit on the disk, and a response larger than "cache-max-slot-size" is served but +not kept. The cache directory holds one file per slot plus transient lock files, all created by cgit itself. Create the directory ahead of time, owned by the account -- cgit v2.8.0