Re: Bad side effect of "newdirpref"

Previous thread: per page fingerprinting for verified exec by Brett Lymn on Monday, August 21, 2006 - 6:26 am. (1 message)

Next thread: Throttling IO Requests in NetBSD via Congestion Control by Sumantra Kundu on Monday, August 21, 2006 - 12:16 pm. (30 messages)
From: Charles M. Hannum
Date: Monday, August 21, 2006 - 7:04 am

This shouldn't really surprise anyone, but I'll point out that "newdirpref"
causes a really annoying side effect.  I noticed this because two processes
were simultaneously writing medium-size (10-100MB) files, and then attempting
to burn them to DVD.

In the Old Days, before the web, FFS would tend to put new directories in the
least full CG.  This had the effect of (usually) balancing out the CGs.  If I
created two files in separate directories, they usually ended up in different
CGs.  I could write to them at the same time, and they would end up
relatively linear on disk, because their blocks were allocated from different
pools.  (Note that this effect also helps a little with SMP, not that
NetBSD's SMP is anything to write home about.)

This is no longer the case.  Rather, "newdirpref" tends to fill up some CGs
first -- often a contiguous chunk, even.  This has the effect of reducing the
pool of CGs that these large files can come from.  Worse, because the full or
nearly-full CGs tend to be in a contiguous region, as the disk fills,
the "rehashing" mechanism in blockpref ends up hitting an even smaller number
of CGs frequently.  Worse, the policy itself tends to blindly put new
directories (and thus their files) in the same CG much of the time anyway. The
result of all this is that we have really bad contention, and rather often the
two processes I referred to above end up writing files to the same CG,
interleaving their blocks (because the block rotor is also just that dumb).

And this culminates in me being unable to write the data faster than 4x to my
DVD drive, because reading it back from the hard disk is just too damned
slow.  Even though I've tested my DVD drive at 16x and it works just fine.

This sucks.


From: Thor Lancelot Simon
Date: Monday, August 21, 2006 - 9:19 am

I wonder if this effect might not be greatly reduced if the number of
CGs were greatly reduced.  SGI did some profiling on this early in XFS
development and periodically as disk sizes increased, and I am pretty
sure that their overall recommendation is still one allocation group
per processor, maximum.

They do spread new directories over allocation groups (or did last I
looked) though using an algorithm very different from that in FFS.

Yes, I'm aware that a huge blocksize is required to get less cylinder
groups, with the current FFS datastructures.  You could always use
LFS. ;-) (Actually, LFS is working well enough now that we use it as a
root file system on one of the autobuild machines).

-- 
  Thor Lancelot Simon	                                     tls@rek.tjls.com

  "We cannot usually in social life pursue a single value or a single moral
   aim, untroubled by the need to compromise with others."      - H.L.A. Hart


From: Charles M. Hannum
Date: Monday, August 21, 2006 - 10:57 am

Did you even process what I wrote, or did you just rapid-fire your stock
response?

Given the simplistic "block rotor" used for block allocation, reducing
the number of CGs can *only* make the problem worse.


From: Thor Lancelot Simon
Date: Monday, August 21, 2006 - 11:59 am

I don't think that's necessarily the case: consider the extreme case
where there's only one CG.  Clearly, the problem is not worse.  For a
disk of the same size, less CGs means less likelihood that any given
CG is full; obviously, there's a balance against the longer seek to the
next CG that a larger CG yields, but I don't think the result is as
blindingly obvious as you do.

The other possibility, of course, is that I'm mistaken or stupid; it
would hardly be the first time.

-- 
  Thor Lancelot Simon	                                     tls@rek.tjls.com

  "We cannot usually in social life pursue a single value or a single moral
   aim, untroubled by the need to compromise with others."      - H.L.A. Hart


From: Thomas E. Spanjaard
Date: Monday, August 21, 2006 - 12:23 pm

I think mycroft's argument is that a concurrent process busy in the same 
CG dramatically reduces I/O throughput available for te DVD burner. 
Which is not unfeasible, as in the late nineties CD-R(W) burners had 
issues with buffer underruns because the host machines couldn't handle 
the I/O throughput necessary. As DVD 1x is about CD 9x, it's not hard to 
imagine  this having an influence.

Cheers,
-- 
         Thomas E. Spanjaard
         tgen@netphreax.net
From: Jason Thorpe
Date: Monday, August 21, 2006 - 2:10 pm

I don't think the concurrent I/O is as much as a problem as the  
interleaving of two files' blocks as stated in his example.  That  
prevents the data from being streamed back to the host effectively  
because the file system is forced to issue a bunch of small reads  
instead of large ones.

-- thorpej



From: David Laight
Date: Monday, August 21, 2006 - 12:14 pm

That would require redefining the valid disk layouts to allow the
allocation bitmaps to be larger than one filesystem block in each CG.

	David

-- 
David Laight: david@l8s.co.uk


Previous thread: per page fingerprinting for verified exec by Brett Lymn on Monday, August 21, 2006 - 6:26 am. (1 message)

Next thread: Throttling IO Requests in NetBSD via Congestion Control by Sumantra Kundu on Monday, August 21, 2006 - 12:16 pm. (30 messages)