cmogstored dev/user discussion/issues/patches/etc
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: mogile@googlegroups.com, David Birdsong <david.birdsong@gmail.com>
Cc: cmogstored-public@bogomips.org
Subject: Re: cmogstored response header
Date: Mon, 4 Apr 2016 00:29:45 +0000	[thread overview]
Message-ID: <20160404002945.GA29666@dcvr.yhbt.net> (raw)
In-Reply-To: <CABJfL5jjr7m8g+DC39UmHuVmbUwriwxdhY18=4vWjM0gU1S6PA@mail.gmail.com>

David Birdsong <david.birdsong@gmail.com> wrote:
> Hi, I'm using nginx in front of cmogstored and trying to use nginx to
> measure time-to-first-byte w/ the $upstream_header_time variable.
> 
> I'd like to use this measurement as a way to keep an eye on device I/O and
> request saturation.
> 
> Does cmogstored start writing response headers before successfully opening
> the file or does it write the header only after a successful stat?

Successful stat(), or more accurately: open/openat() + fstat().
cmogstored needs to know the size + mtime before writing the
response header.  So yes, relying on the header response time
should give you a good idea of seek latency...

Under Linux, we use MSG_MORE with send() in an attempt to bundle
the first chunk of the response body into the same packet of the
response header; so you may need to take that into account, too.

TCP_NOPUSH is used under FreeBSD for a similar effect.
We used to use TCP_CORK under Linux, but send(..., MSG_MORE) is
fewer syscalls...

<tangent>
Theoretically, we could use the iovecs with the *BSD sendfile
implementation to reduce syscalls under *BSD; but I'm hesitant
to complicate the code for OSes I rarely use.  Handling
partial writes with iovecs in *BSD sendfile can get tricky.
</tangent>

           reply	other threads:[~2016-04-04  0:29 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CABJfL5jjr7m8g+DC39UmHuVmbUwriwxdhY18=4vWjM0gU1S6PA@mail.gmail.com>]

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

  List information: https://yhbt.net/cmogstored/README

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

  git send-email \
    --in-reply-to=20160404002945.GA29666@dcvr.yhbt.net \
    --to=e@80x24.org \
    --cc=cmogstored-public@bogomips.org \
    --cc=david.birdsong@gmail.com \
    --cc=mogile@googlegroups.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.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/cmogstored.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).