git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH 3/3] gitweb: Fill project details lazily when caching

From
Jakub Narebski <jnareb@gmail.com>
Date
Mar 18, 2008, 09:12 UTC
Message-ID
<200803181012.11273.jnareb@gmail.com>
In-Reply-To
<20080318031406.GH10335@machine.or.cz>
On Tue, 18 March 2008, Petr Baudis wrote:
Show 21 quoted lines
> On Mon, Mar 17, 2008 at 04:09:30PM +0100, Jakub Narebski wrote:
>>
>> If caching is turned on project details can be filled in already from
>> the cache.  When refreshing project info details for all project (when
>> cache is stale and has to be refreshed) generate projects info only if
>> modification time (as returned by lstat()) of projects repository
>> gitdir changed.
>> 
>> This way we can avoid hitting repository refs, object database and
>> repository config at the cost of additional lstat.
>> 
>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
>> ---
>> This is an idea for further improvement of 'projects list caching'.
>> Could you please: 
>> 
>>  1.) comment if it is a good idea, or why it works, or why it
>>      couldn't work :),  
> 
> The idea is nice, but I'm surely missing something obvious again - why
> do you use lstat() as opposed to stat()?

Because in my home installation of gitweb (for tests) I have /home/local/scm/git.git symlinked to /home/jnareb/git/.git And I want to follow changes in repository; link itself doesn't change.

> And more importantly, the mtime 
> of projects repository unfortunately does not reflect almost any
> changes per se; you would need to check mtime of description file,
> config file and the refs instead.

Well, I had hopes that because git uses "write to temporary file, rename temporary file to final name" to have atomic file writes any change in git repository would be reflected in mtime of topdir / GIT_DIR. I have checked it superficially... by doing a fetch, and a commit. But while both fetch and commit manipulate files in top dir (FETCH_HEAD, ORIG_HEAD, COMMIT_EDITMSG) it is not the case for push, unfortunately. If all pushes would result in pack transfer, it would be enough to watch for GIT_DIR/objects/pack/ directory.

I think that nothing short of inotify or equivalent would work: it is just too many files/directories to watch for changes... I hope I am mistaken here...

-- 
Jakub Narebski
Poland
Previous: Petr BaudisNext: Frank Lichtenheld
Message 11 of 12 in “gitweb: Support caching projects list”
  1. 0/3 gitweb: Support caching projects listJakub Narebski, Mar 17, 2008
  2. 1/3 gitweb: Separate @projects population into git_get_projects_details()Jakub Narebski, Mar 17, 2008
  3. 2/3 gitweb: Support caching projects listJakub Narebski, Mar 17, 2008
  4. Frank LichtenheldMar 17, 2008
  5. Jakub NarebskiMar 17, 2008
  6. Frank LichtenheldMar 17, 2008
  7. Jakub NarebskiMar 17, 2008
  8. 2/3 gitweb: Support caching projects listJakub Narebski, Mar 17, 2008
  9. 3/3 gitweb: Fill project details lazily when cachingJakub Narebski, Mar 17, 2008
  10. Petr BaudisMar 18, 2008
  11. Jakub NarebskiMar 18, 2008
  12. Frank LichtenheldMar 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.