tickets

gitoria.worldapi.org #25

README loads slowly again: the earlier hl:web fix was never deployed

progress

opened by Atlas · assigned to Atlas

opened · updated

Creator: "also loading the readme takes forever, thats already been fixed. now its back. this should take milliseconds, whats going on here?"

Findings (Atlas worker RD, 2026-10-24, diagnosis only, nothing changed):

  • Measured live: the mpackdb README sends its first byte after 0.26 to 0.41 s and the text is visible in Chrome after 0.3 to 0.65 s (1280 and 390 px). Clicking the Readme tab takes 0.25 to 0.7 s, once 6.6 s under heavy machine load. The long antcolony README takes 1.2 to 1.8 s, nearly all of it on the server.
  • Live code equals main b279f53, so the compact blocks (B1) and the README cache (G3) are deployed. But the vendored Hybriel is 5406d146 from 22 Oct 12:03, and the hl:web fix for slow README tabs (076081bb, 22 Oct 18:20) is not in it. That fix was never deployed, which is why it feels as if it came back.
  • Proposed fix, not done: (1) re-vendor gitoria to current Hybriel master to get that fix, expected long README 1.2 s to about 0.5 s; (2) Arachne removes the repeated copies of the Markdown blocks in hl:web, another 100 to 200 ms; (3) gitoria caches the finished README HTML per text so a repeat view needs under 50 ms.
  • Not covered: the signed-in view, and a server-side profile. Report: /media/STORAGE/claude-scratch/atlas/RD/REPORT.md

Blocked by

  • donehybriel #374Live gitoria RSS grows about 11 MB/h while its reachable GC heap stays near 40 MB

History

  1. Atlas opened the ticket
  2. 3 comments

    1. Atlas
        Write…
      • Atlas
          Write…
        • Atlas
          edited

          Edited once

          1. Atlas worker G25b, status: deployed to gitoria.worldapi.org (commit 5b0b4b9, gitoria and mpackdb.gitoria.worldapi.org answer 200).
            
            What you saw: opening a repo's README is slow again.
            
            The cause: two things. Every README request ran git ls-tree and git cat-file and parsed the Markdown again (about 21 ms of server time each time), and the framework (hl:web) built the whole page from scratch, which for a big README is most of the time. The live server also still ran the old framework build without the speedups.
            
            What changed: (1) gitoria now runs Hybriel master c09538bb, which has the faster README rendering (batch 21) and the new render cache (W141); the Markdown component uses it. (2) The README of a repo is now kept in memory per commit (the key is the repo plus the commit id of the main branch, at most 64 repos, least recently used out first). A repeat request needs only one cheap git call to learn the commit id. A push gives a new commit id, so the new README shows at once. (3) A new deploy check, tests/readme-cache.mjs, counts the git calls: a repeat request must not read the tree or the file again, and after a push the new README must show. It fails on the old code (3 of 10 checks) and passes now. The cached page is byte for byte the page that was built, checked on copies of all 14 real repos (the only difference to the old code are two invisible markers the framework puts around the cached Markdown). Browser check 261 passed twice (Firefox included), security 70 passed, theme check 0 problems.
            
            Times (first byte, seconds). On a copy of the real data on this machine, warm, median of 25 requests: antcolony README 0.195 before, 0.144 after (best case 0.161 to 0.068); ident 0.123 before, 0.118 after; mpackdb 0.055 before, 0.050 after. The cold first request after a start is about 0.1 to 0.3 s for both. Live over the internet, 5 requests each, average: antcolony 0.42 before, 0.32 after; ident 0.35 before, 0.28 after; mpackdb 0.21 before, 0.24 after (the live numbers jump between 0.1 and 0.5 s because of the network and the loaded server, so mpackdb is within noise).
            
            Honest result: big READMEs are clearly faster, small ones barely, and it is not milliseconds yet. What is left is the framework building the page and writing its state into the HTML: even a repo without any README takes 0.01 to 0.1 s, and a 180 KB README page about 0.05 s of server work after this change. Getting to a few milliseconds needs a framework change (serve the finished page of a repo without building the component tree again). I will route that to Arachne as a follow-up.
            
            Two older gate scripts, tests/push.mjs and tests/ssh.mjs, crash at the login button with the current ident on the old code too; deploy does not run them, I did not touch them.
            
            How to try it: open a repo page, for example https://antcolony.gitoria.worldapi.org/, twice and compare the second load; then push a README change and reload: the new text shows at once.
            Write…
        • Atlas assigned the ticket to Caramboleyo
        • Atlas changed the state review
        • 1 comment

          1. Atlas
            edited

            Edited once

            1. This is not done yet, so I moved it back to progress. Big READMEs are now clearly faster (antcolony about 0.42 s down to 0.32 s live), and a repeat view no longer reads the README from git again. But you asked for milliseconds, and we are not there. The time left is the framework rebuilding the whole page on every request, even for a repo without a README. Arachne gets the next step: serve the finished page from a cache without rebuilding it. Then a worker brings it to gitoria and measures again.
              Write…
          2. Atlas changed the state progress
          3. 4 comments

            1. Atlas
                Write…
              • Atlas
                edited

                Edited once

                1. Your ruling, via Apollo: keeping the render cache and the page cache for speed is fraud, because a cached server rebuild hides the concept violation. So the plan changes. Arachne removes both caches after her concept fixes. gitoria is then measured without any cache. If the first load is slow, it gets fixed by sending less, not by caching. The gitoria code that uses the caches (the README cache per commit and the page key) comes out with that change. This ticket stays in progress until gitoria is fast without them.
                  Write…
                • Atlas
                  edited

                  Edited once

                  1. The leftover cache code is removed from gitoria (live commit a487248, deployed with the standby hand-over, 574 checks of / and /api/repos during the deploy were all 200).
                    
                    What was removed, one line each:
                    - lib/pagekey.hl and the pageKey on the / route: a page-build cache (the finished Readme page was served again for the same repository commit).
                    - cacheKey = textHash in the Markdown component and the textHash binding in the readme page: a page-build cache (hl:web built the Markdown component once per key).
                    - The finished-homepage cache per commit in lib/homepage.hl: a value cache (the result of git ls-tree, cat-file and the Markdown parse).
                    - The parsed-blocks cache in lib/markdown.hl: a value cache (Markdown text to blocks, keyed by the text hash).
                    - tests/readme-cache.mjs and its line in deploy.sh: it only tested those caches. README, STATUS and the G25b report now say they were removed and why. The last two were not on the list, but they are the same kind of cache, and without removing them the numbers below would not be cache-free.
                    
                    Gates on the cache-free code: check-theme 49 files 0 problems, signin-return 3/0, browser 261/0, security 70/0 (and again inside deploy-init).
                    
                    Timings, curl first byte, five requests each, no caches. Local = a copy of live storage: main page 0.003 to 0.005 s; antcolony 0.16 to 0.19 s (1.26 MB); mpackdb 0.03 to 0.06 s (215 KB); ident 0.08 to 0.10 s (640 KB). Where the time goes locally on antcolony: the page shell about 0.008 s, the code page with branch and file list 0.02 to 0.04 s, and the Readme render about 0.15 s, so the Markdown render is almost all of it.
                    Live before the change (with caches): main 0.10 to 0.31 s, antcolony 5.9 s first and then 0.12 to 0.70 s, mpackdb 0.11 to 0.47 s, ident 0.11 to 0.48 s. Live after: main 0.10 to 0.13 s, antcolony 0.39 to 0.62 s, mpackdb 0.29 to 0.40 s, ident 0.24 to 0.72 s. So on live the big README pages are slower than the cached best case of about 0.12 s, which is the honest cost; the live machine is also slower than my local copy.
                    
                    Ship less (proposals only, nothing implemented): (1) Almost half of every Readme page is the same Markdown sent twice, once as HTML and once as hydration data (antcolony 560 KB of 1.26 MB, ident 310 KB of 640 KB, mpackdb 124 KB of 215 KB). Render the Readme on the server only, without sending its blocks as data. (2) Show the first part of a long Readme (for example the first 40 blocks, antcolony has 1954 code spans) and load the rest on request. (3) antcolony and ident could start with the Readme headings and the first sections only. (4) The code page already costs little; the branch list is not the problem.
                    
                    This ticket stays in progress.
                    Write…
                  • Atlas
                    edited

                    Edited once

                    1. Two of the value caches that the first cleanup removed are back in gitoria (live commit 90b4f72, deployed through deploy-init with the standby hand-over, 436 checks of / and /api/repos during the deploy were all 200). Apollo's rule: a cache keyed by an immutable commit or content hash may stay, but only if it stores data and never rendered HTML or page output. I read both before restoring them, and neither stores HTML or page output.
                      
                      Back, one line each:
                      - Homepage cache (lib/homepage.hl): it stores the homepage result, which is the list of files with path, whether it is in the docs folder, the sha256 of the text and the parsed Markdown blocks (plain data). Its key is the repository slug plus the commit id of the main branch, so a push is a new key. It stays because the key is an immutable commit id and the value is data only; it is bounded (64 entries, 8 million characters, least recently used leaves first).
                      - Parsed-blocks cache (lib/markdown.hl): it stores the parsed Markdown blocks (plain data, the Markdown component turns them into elements on every request). Its key is the sha256 of the text. It stays because the key is a content hash and the value is data only; it is bounded (32 texts, 4 million characters, least recently used leaves first).
                      
                      Stay removed, one line each:
                      - The page key on the / route (lib/pagekey.hl, pageKey): it made the framework serve the finished Readme page again, so it cached page output.
                      - The framework readme key (readmeKey in lib/pagekey.hl): the function that built that page key, so it goes with it.
                      - The cache key textHash on the Markdown component (cacheKey = textHash): it made the framework keep the built component, so it cached rendered output.
                      Also still gone: tests/readme-cache.mjs, which only tested the removed page key. I also deleted the two leftover files lib/pagekey.hl and tests/readme-cache.mjs from the server, which the deploy copy does not remove.
                      
                      Gates on the restored code: check-theme 49 files 0 problems, signin-return 3/0, browser 261/0, security 70/0 (and again inside deploy-init).
                      
                      Live timings after the restore, first byte in seconds, five requests each (the first request of each page is cold for the restored caches):
                      - main page: 0.31, 0.27, 0.26, 0.25, 0.10
                      - antcolony: 0.63, 0.47, 0.47, 0.36, 0.32
                      - mpackdb: 0.32, 0.39, 0.30, 0.13, 0.24
                      - ident: 0.47, 0.52, 0.20, 0.36, 0.22
                      For comparison, the cache-free live numbers from the first cleanup were: main 0.10 to 0.13, antcolony 0.39 to 0.62, mpackdb 0.29 to 0.40, ident 0.24 to 0.72. The machine was busier during this run, so the gain from the two data caches is small on these samples; the larger pages stay dominated by the Markdown render, as the earlier ship-less proposals said.
                      
                      This ticket stays in progress.
                      Write…
                  • Atlas unassigned the ticket (was Caramboleyo)
                  • Atlas assigned the ticket to Atlas
                  • 13 comments

                    1. Gitoria
                        Write…
                      • Caramboleyo
                          Write…
                        • Caramboleyo
                            Write…
                          • Gitoria
                              Write…
                            • Gitoria
                                Write…
                              • Caramboleyo
                                  Write…
                                • Caramboleyo
                                    Write…
                                  • Caramboleyo
                                      Write…
                                    • Gitoria
                                        Write…
                                      • Caramboleyo
                                          Write…
                                        • Gitoria
                                            Write…
                                          • Caramboleyo
                                              Write…
                                            • Gitoria
                                                Write…
                                            • 3 comments

                                              1. Gitoria
                                                  Write…
                                                • Gitoria
                                                    Write…
                                                  • Gitoria
                                                      Write…

                                                  Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.