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

[RFC PATCHv3 00/10] gitweb: Simple file based output caching

From
Jakub Narebski <jnareb@gmail.com>
Date
Feb 16, 2010, 19:36 UTC
Message-ID
<1266349005-15393-1-git-send-email-jnareb@gmail.com>

This 10 patches long patch series is intended (yet) as preliminary version for splitting large 'gitweb: File based caching layer (from git.kernel.org)' mega-patch by John 'Warthog9' Hawley aka J.H., by starting small and adding features piece by piece.

This is third version (third release) of this series, and is available on
http://repo.or.cz/w/git/jnareb-git.git as 'gitweb/cache-kernel-v3' branch.
Earlier versions are available there as branches 'gitweb/cache-kernel'
and 'gitweb/cache-kernel-v2'.  Previous version of this series was sent
to git mailing list as:
* [RFC PATCHv2 00/10] gitweb: Simple file based output caching
  Message-Id: <1265711427-15193-1-git-send-email-jnareb@gmail.com>
  http://thread.gmane.org/gmane.comp.version-control.git/139382
This version tries to do without 
  gitweb: Print to explicit filehandle (preparing for caching)
patch (or its equivalent).  It does it by "capturing" output by changing
default filehandle (used for "print", "printf" and "write" without explicit
filehandle) via 'select($data_fh);' to point to in-memory file.  This is
simplest possible solution, and does not require extra Perl modules.

Among other solutions are tie-ing *STDOUT to a class that captures output (similar to what CGI::Cache does), or using PerlIO layers via push_layer() / pop_layer() methods from (non-core) PerlIO::Util module (from CPAN).

This version also includes thorough (perhaps too thorough) error checking, it has much more comments, should work correctly when two clients access the same URL with an error condition (die_error is called), and it detaches background process so even with mod_perl it would not generate zombies.

This version was tested a bit running under mod_cgi: that it generates page correctly, that it gets page from cache, that cache expires correctly, that stale page is being served, that "Generating..." page is generated correctly and that it works.

There are a few KNOWN ISSUES: 'blame_incremental' action is not incremental and does not work (perhaps JavaScript-based actions should be turned off with current implementation of output cache?), and "Generating..." page somehow does not get additional "." when waiting (but it works).

The following changes since commit 7e5eb8f1834722507e2d2171a253b78b1d924458
(in the 'master' branch of git.git repository):
  Junio C Hamano (1):
        Merge branch 'maint'
are available in the git repository at:
  git://repo.or.cz/git/jnareb-git.git gitweb/cache-kernel-v3
Shortlog:
~~~~~~~~~
Jakub Narebski (10):
  gitweb: href(..., -path_info => 0|1)
  gitweb/cache.pm - Very simple file based cache
  gitweb/cache.pm - Stat-based cache expiration
  gitweb: Use Cache::Cache compatibile (get, set) output caching
  gitweb/cache.pm - Adaptive cache expiration time
  gitweb: Use CHI compatibile (compute method) caching
  gitweb/cache.pm - Use locking to avoid 'cache miss stampede' problem
  gitweb/cache.pm - Serve stale data when waiting for filling cache
  gitweb/cache.pm - Regenerate (refresh) cache in background
  gitweb: Show appropriate "Generating..." page when regenerating cache
Diffstat:
~~~~~~~~~
 gitweb/README                          |   70 ++++
 gitweb/cache.pm                        |  655 ++++++++++++++++++++++++++++++++
 gitweb/gitweb.perl                     |  321 +++++++++++++++-
 t/gitweb-lib.sh                        |    2 +
 t/t9500-gitweb-standalone-no-errors.sh |   19 +
 t/t9503-gitweb-caching.sh              |   32 ++
 t/t9503/test_cache_interface.pl        |  404 ++++++++++++++++++++
 t/test-lib.sh                          |    3 +
 8 files changed, 1486 insertions(+), 20 deletions(-)
 create mode 100644 gitweb/cache.pm
 create mode 100755 t/t9503-gitweb-caching.sh
 create mode 100755 t/t9503/test_cache_interface.pl
-- 
Jakub Narebski

git version 1.6.6.1
Next: Jakub Narebski
Message 1 of 16 in “[RFC PATCHv3 00/10] gitweb: Simple file based output caching”
  1. Jakub NarebskiFeb 16, 2010
  2. 01/10 gitweb: href(..., -path_info => 0|1)Jakub Narebski, Feb 16, 2010
  3. 02/10 gitweb/cache.pm - Very simple file based cacheJakub Narebski, Feb 16, 2010
  4. 03/10 gitweb/cache.pm - Stat-based cache expirationJakub Narebski, Feb 16, 2010
  5. 04/10 gitweb: Use Cache::Cache compatibile (get, set) output cachingJakub Narebski, Feb 16, 2010
  6. 05/10 gitweb/cache.pm - Adaptive cache expiration timeJakub Narebski, Feb 16, 2010
  7. 06/10 gitweb: Use CHI compatibile (compute method) cachingJakub Narebski, Feb 16, 2010
  8. 07/10 gitweb/cache.pm - Use locking to avoid 'cache miss stampede' problemJakub Narebski, Feb 16, 2010
  9. 08/10 gitweb/cache.pm - Serve stale data when waiting for filling cacheJakub Narebski, Feb 16, 2010
  10. 09/10 gitweb/cache.pm - Regenerate (refresh) cache in backgroundJakub Narebski, Feb 16, 2010
  11. 10/10 gitweb: Show appropriate "Generating..." page when regenerating cacheJakub Narebski, Feb 16, 2010
  12. J.H.Feb 18, 2010
  13. Jakub NarebskiFeb 19, 2010
  14. gitweb: Simple file based output caching TODO (was: Re: [RFC PATCHv3 00/10] gitweb: Simple file based output caching)Jakub Narebski, Feb 28, 2010
  15. Jakub NarebskiFeb 28, 2010
  16. Petr BaudisFeb 28, 2010

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.