[Top] [All Lists]

Re: understanding speculative preallocation

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: understanding speculative preallocation
From: Jason Rosenberg <jbr@xxxxxxxxxxxx>
Date: Sat, 27 Jul 2013 22:19:17 -0400
Cc: Ben Myers <bpm@xxxxxxx>, stan@xxxxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=squareup.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=nw4RLlDGX3lcY3XC+C41SIReUxTtuvT86uACOeZr2EU=; b=ZgMxFSEki4pXv9qUJIUtAzUFIdSiQ136So7yNa4xwbMldPVvllY2KLMJ7N7/PS70mn Q1GwzPSH4jJi3E6djr368oVfNlu6OtC/jM5T0kqLaz3y4RKmschYrm3GgA8vyZtjuHGj BksNuRzLybW2NWn+KFsMY9KAsbFI/U+R2JkT8=
In-reply-to: <20130727013024.GS13468@dastard>
References: <1374823420041-35002.post@xxxxxxxxxxxxx> <20130726115021.GO13468@dastard> <CAA+BczQesNL2VmFmrcBNKXcM-Sfx0bXkXPRP5xMx6=Bv+NWrUA@xxxxxxxxxxxxxx> <51F2CD8B.8080207@xxxxxxxxxxxxxxxxx> <CAA+BczQGYoJVL0twvz2GRhH30teFPSJOsKWtofbXBrom4_Q6hg@xxxxxxxxxxxxxx> <20130726205018.GM3111@xxxxxxx> <CAA+BczSpn7Cu2rZWJ9Q2b1-Xh0365R9ykGxKHHymtRm2Q7xCuA@xxxxxxxxxxxxxx> <CAA+BczTt-ZN7DU8gpWAY0SdL0KWL2Z_y8qKvmxMn7b+T9frK4Q@xxxxxxxxxxxxxx> <20130727013024.GS13468@dastard>
Thanks Dave,

The automatic prealloc removal, if no new writes after 5 minutes, sounds perfect for my use case.  But realistically, I'm not likely to get our org to push/find an os update just for this purpose too easily.

So, in the meantime, the question remains, assuming I have the version I have currently (dynamic preallocation, persists indefinitely until the file is closed/app quits, etc.), will this idea work (e.g. close the file after writing, then re-open read-only?).  Currently, the app does keep the files open indefinitely long after writing has stopped, and this is of course resulting in the preallocation persisting indefinitely.


On Fri, Jul 26, 2013 at 9:30 PM, Dave Chinner <david@xxxxxxxxxxxxx> wrote:
On Fri, Jul 26, 2013 at 05:11:55PM -0400, Jason Rosenberg wrote:
> Is it safe to say that speculative preallocation will not be used if a file
> is opened read-only?
> It turns out that the kafka server does indeed write lots of log files, and
> rotate them after they reach a max size, but never closes the files until
> the app exits, or until it deletes the files.  This is because it needs to
> make them available for reading, etc.   So, an obvious change for kafka
> might be to close each log file after rotating, and then re-open it
> read-only for consumers of the data.  Does that sound like a solution that
> would pro-actively release pre-allocated storage?

No need - the mainline code that has a periodic background scan that
stops buildup of unused prealocation. i.e. if the file is clean for
5 minutes, then the prealloc will be removed. Hence it doesn't
matter what the application does with it - if it holds it open and
doesn't write to the file, then the prealloc will get removed. More
will be added the next time the file is written, but until then it
won't use excessive space.


Dave Chinner

<Prev in Thread] Current Thread [Next in Thread>