Mailinglist Archive: opensuse-buildservice (248 mails)

< Previous Next >
Re: [opensuse-buildservice] support for http range requests
  • From: Jon Nelson <jnelson-suse@xxxxxxxxxxx>
  • Date: Wed, 14 Oct 2009 10:15:14 -0500
  • Message-id: <cccedfc60910140815m507dea33v9893e27acf586ab2@xxxxxxxxxxxxxx>
On Wed, Oct 14, 2009 at 9:44 AM, Luke Imhoff <luke@xxxxxxxx> wrote:
Michael Schroeder wrote:

On Wed, Oct 14, 2009 at 09:39:10AM -0500, Jon Nelson wrote:


bytes. Using the range header instead of several parameters is, IMO, a
more elegant solution and puts the request at the proper layer. I'd
rather see Range headers used than yet-another
range-like-thing-that-isn't-ranges. In this case, I see it as a
correction. ;-)


Yes, but I was talking about a user's point of view. I don't want
bytes, I want lines.

Cheers,
 Michael.



Does the server have to exactly respect the range request or can it round to
the line and in the return headers inform the client that it gave a slightly
different range?

The http spec is pretty clear: the server *must* return the request
bytes as request, in the order they were requested, or return an
error. The client is responsible for taking the raw data and
presenting it. This is a classic example of layering - http is about
data, the next layer up is about presentation.

Let's take for example "I want the last 200 lines". If you were to
want *exactly* 200 lines, that's not very easy to do. However, given
some leniency, and a reasonable average for "longish" lines of, say,
80 characters (bytes if using ascii), that's about 16000 bytes -
scandalously close to 16KB. So, if I were implementing a client, I'd
do this: request the last 16KB of the file (Range: bytes=-16384), and
after getting the data scan for the first CRLF (or whatever), and
start printing lines from that byte. Subsequent requests don't require
any scanning.

If using http range requests, some of the log tailing can be farmed
off entirely to the httpd instead of having to call out to *any* code,
if the log file can be located in a predictable location - this is
something that cannot be done right now because the interpretation of
the paramters requires execution of code outside of the http context
(probably ruby). Using the httpd for this is vastly less expensive.

"tailing" logs over http is also much easier using range requests, and
potentially vastly less expensive if the httpd can service the request
directly.

--
Jon
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >