Bug 1060251 - [RFE] systemd unit and timer for xfs_fsr
Summary: [RFE] systemd unit and timer for xfs_fsr
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: xfsprogs
Version: rawhide
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Eric Sandeen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-31 15:23 UTC by Pat Riehecky
Modified: 2014-01-31 18:24 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-01-31 16:06:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
xfs_fsr.service (171 bytes, text/plain)
2014-01-31 15:23 UTC, Pat Riehecky
no flags Details
xfs_fsr.timer (154 bytes, text/plain)
2014-01-31 15:23 UTC, Pat Riehecky
no flags Details

Description Pat Riehecky 2014-01-31 15:23:06 UTC
Description of problem:
Running xfs_fsr on highly active xfs volumes helps keep performance high.  It might be helpful to have systemd units/timers for this.  

Version-Release number of selected component (if applicable):xfsprogs-3.2.0-0.3.alpha2.fc21


How reproducible:100%


Steps to Reproduce:
1.do a bunch of random io fragementing an xfs volume
2.performance degrades
3.

Actual results:
unless you know to run xfs_fsr, performance degrades.

Expected results:
this could be run automatically

Additional info:

Comment 1 Pat Riehecky 2014-01-31 15:23:34 UTC
Created attachment 857893 [details]
xfs_fsr.service

Comment 2 Pat Riehecky 2014-01-31 15:23:54 UTC
Created attachment 857894 [details]
xfs_fsr.timer

Comment 3 Eric Sandeen 2014-01-31 16:06:12 UTC
(In reply to Pat Riehecky from comment #0)
> Description of problem:
> Running xfs_fsr on highly active xfs volumes helps keep performance high. 

No, it doesn't.  ;)

xfs_fsr has no notion of freespace, and running it periodically over the whole filesystem can lead to severe freespace fragmentation, which in turns leads to fragmentation of newly allocated files.

From the SGI CXFS admin guide (CXFS uses XFS as the filesystem):

"Defragment Filesystems with Care

The xfs_fsr tool is useful when defragmenting specific files but not filesystems in general.

Using xfs_fsr to defragment CXFS filesystems is not recommended except on read-mostly filesystems because xfs_fsr badly fragments the free space. XFS actually does best at maintaining contiguous free space and keeping files from being fragmented if xfs_fsr is not run as long as there is a moderate amount (10% or more) of free space available on the filesystem"

Comment 4 Eric Sandeen 2014-01-31 16:48:52 UTC
I should probably ask, though - what workload are you running which causes such bad fragmentation?  And what actual performance numbers do you have?

It'd be interseting to run the xfs_db "freesp" command, and see what your available free space looks like at this point.

-Eric

Comment 5 Pat Riehecky 2014-01-31 17:12:34 UTC
I'll have to get back to you on the output of xfs_db -c freesp.  The filesystem is mounted right now.

As for the workload, that is easier.

Basically I've got a bunch of various scripts that find authorized linux iso torrents (Fedora and spins, Gentoo, Arch, Scientific Linux, Debian, Ubuntu, and so on).  I pull down the torrent and seed it for more or less ever.

I've got the disk space and bandwidth at home, so why not share.

For years I'd been noticing the system get slower and slower.  I finally decided to care enough and discovered the fragmentation report had me at 99.9% fragemented.  After about 72h of xfs_fsr running (set the timer super high and at jobs to start it off again), my IO throughput went from about 7.8MB to 62.8MB.  I measured with 'dd'.  Thus the bug report

Comment 6 Eric Sandeen 2014-01-31 17:25:32 UTC
Ah, torrents can badly fragment a filesystem.  Does your torrent client preallocate space first?  If not, I'd find one that does (or configure yours to do so) and your problems should go away, assuming that you have some contiguous free space left.

Always better to avoid fragmentation up front than to fix it later...

As for the "fragmentation factor" see also:
http://xfs.org/index.php/XFS_FAQ#Q:_The_xfs_db_.22frag.22_command_says_I.27m_over_50.25._Is_that_bad.3F

99.9% probably does indicate a problem, though, that's around 1000 extents per file.

I'd look into teaching your torrent client to do a better job.  What are you using?

-Eric

Comment 7 Pat Riehecky 2014-01-31 18:07:17 UTC
I just checked the 'preallocate first' option in transmission :)

Thanks for the help!

Comment 8 Eric Sandeen 2014-01-31 18:24:04 UTC
Hopefully transmission is "doing it right" by now ;)


Note You need to log in before you can comment on or make changes to this bug.