mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kenny Simpson <theonetruekenny@yahoo.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Peter Staubach <staubach@redhat.com>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: nfs question - ftruncate vs pwrite
Date: Thu, 8 Dec 2005 08:15:25 -0800 (PST)	[thread overview]
Message-ID: <20051208161525.88155.qmail@web34104.mail.mud.yahoo.com> (raw)
In-Reply-To: <1134017608.8002.55.camel@lade.trondhjem.org>

--- Trond Myklebust <trond.myklebust@fys.uio.no> wrote:
> That is as expected. The ftruncate() causes an immediate change in
> length of the file on the server, and so reads will. In the case of
> pwrite(), that is cached on the client until you fsync/close, and so the
> server returns short reads.
> 
> > Since this is using the buffer cache (not opened with O_DIRECT), and since we know we are
> > extending the file... is it strictly necessary to read in pages of 0's from the server?
> 
> Possibly not, but is this a common case that is worth optimising for?

I am attempting to write a low-latency logger.  'Low' meaning a system call is too slow (measured
at 0.3 microseconds) for each message.  So I am trying to use the page cache to handle the
background scheduling of bulk writes to the server, and as an extra layer of reliability in the
event of a program crash.  The use of pwrite seems to be the best option at this time as spending
a few milliseconds for an ftruncate to a show-stopper.

I could also just write locally into a shared memory region, and have my own background copy to
the server, but this seems a bit wasteful when the page cache does most of this already, and can
optimize page-sized writes.

-Kenny


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

      parent reply	other threads:[~2005-12-08 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07 20:46 Kenny Simpson
2005-12-07 21:14 ` Peter Staubach
2005-12-07 21:50   ` Kenny Simpson
2005-12-08  4:53     ` Trond Myklebust
2005-12-08  5:00       ` Trond Myklebust
2005-12-08 16:15       ` Kenny Simpson [this message]

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=20051208161525.88155.qmail@web34104.mail.mud.yahoo.com \
    --to=theonetruekenny@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=staubach@redhat.com \
    --cc=trond.myklebust@fys.uio.no \
    /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

all inboxes | Powered by JetHome®