List for cgit developers and users
 help / color / mirror / Atom feed
Subject: Caching
Date: Thu, 18 Apr 2013 22:03:33 +0200	[thread overview]
Message-ID: <51705195.7050503@necoro.eu> (raw)

Hi all,

serving huge files through cgit does not really play well with lighttpd
-- lighty's RAM consumption skyrockets, because it seems to have to load
the file into memory and is not freeing it thereafter, especially with
multiple concurrent requests.

Fortunately a couple of servers implement the X-Sendfile extension (or
synonyms thereof) that allow to pass a path to the webserver which then
serves it directly like every other static file.

Lighty even implements an X-Sendfile2 extension that enables us to pass
a _range_ of a file to serve, which is ideal to serve cgit cache files
directly. So quite some time ago I wrote a patch for cgit that uses
X-Sendfile2. As the patch was clumsy and hard to understand, I tried to
rewrite it, but then noticed that I was doing a wrong thing all along:
If I understood the caching code correctly (which I most likely haven't)
this might fail, as the cache file to serve might be replaced by some
new content (read: might even be some complete other page) inbetween
sending the path to the server and the server sending the file.

So my questions are:

a) Is it possible to use X-Sendfile2 with the current cache implementation?
b) If not: Is it worthwhile to figure out a new scheme to do so, i.e.
where it can be guaranteed that a cache file is not altered between
sending the response and the server serving it?
c) If yes: Should one remove the cache-key from the file, s.t. one can
use "normal" X-Sendfile to serve the file as-is?

My current view is pessimistic, because from my understanding the
answers are:

a) no, there is no lock on simple serving
b) no, because if there were a lock, there would be no possibility to
remove it, as a CGI application does not get feedback from the server (a
'request-handled' message)

I'd be very glad if anyone could tell me I'm wrong :)

Regards,
Ren?




             reply	other threads:[~2013-04-18 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 20:03  [this message]
2013-04-18 20:24 ` Caching 
2013-04-18 21:13   ` Caching dpmcgee
2013-04-26 13:47 ` Caching Jason
2013-04-26 14:39   ` Caching 

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51705195.7050503@necoro.eu \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).