how to use fstrim?
Hi,
what is the right way to use fstrim on top of XFS? just doing fstrim -v -m 4194304 /
results sometimes (might depend on disk i/o) to hanging tasks and stack traces - fstrim needs > 5 min in these cases.
Thanks!
Greets,
Stefan
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Stefan Priebe
Hi,
what is the right way to use fstrim on top of XFS? just doing fstrim -v -m 4194304 /
results sometimes (might depend on disk i/o) to hanging tasks and stack traces - fstrim needs > 5 min in these cases.
As always, it's better to include things like the actual stack traces you got, so we have some idea what's going on ...
How fast it goes probably depends quite a lot on the storage underneath.
So including storage information as well would also help us give you a meaningful answer...
And kernel version... etc.
http://xfs.org/index.php/XFS_FAQ#Q:_What_information_should_I_include_when_reporting_a_problem.3F
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Stefan Priebe
Hi,
what is the right way to use fstrim on top of XFS? just doing fstrim -v -m 4194304 /
results sometimes (might depend on disk i/o) to hanging tasks and stack traces - fstrim needs > 5 min in these cases.
It does indeed depend on disk IO. XFS walks all the free space and issues discards on it, so runtime is always O(freespace). And while it is walking an AG discarding the free space, it will hold the AG locked so that free space doesn't change. This can hang other operations for the length of time it takes to discard all the free space in the AG.
IOWs, the behaviour of fstrim on XFS is entirely dependent on the speed of the block layer and hardware implementations of discards.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Am 27.07.2013 03:50, schrieb Dave Chinner:
Quoted 9 lines · Stefan Priebe
Quoted 7 lines
Hi,
what is the right way to use fstrim on top of XFS? just doing fstrim -v -m 4194304 /
results sometimes (might depend on disk i/o) to hanging tasks and stack traces - fstrim needs > 5 min in these cases.
Quoted 8 lines
It does indeed depend on disk IO. XFS walks all the free space and issues discards on it, so runtime is always O(freespace). And while it is walking an AG discarding the free space, it will hold the AG locked so that free space doesn't change. This can hang other operations for the length of time it takes to discard all the free space in the AG.
IOWs, the behaviour of fstrim on XFS is entirely dependent on the speed of the block layer and hardware implementations of discards.
Yes OK i understand that but is there any way to prevent getting the whole server crash when I/O is too much?
For example splitting whole disk or even AGs into subparts? Or set a timeout for the fstrim command?
Greets,
Stefan
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 19 lines · Stefan Priebe
Am 27.07.2013 03:50, schrieb Dave Chinner:
Quoted 9 lines · Stefan Priebe
Quoted 7 lines
Hi,
what is the right way to use fstrim on top of XFS? just doing fstrim -v -m 4194304 /
results sometimes (might depend on disk i/o) to hanging tasks and stack traces - fstrim needs > 5 min in these cases.
Quoted 8 lines
It does indeed depend on disk IO. XFS walks all the free space and issues discards on it, so runtime is always O(freespace). And while it is walking an AG discarding the free space, it will hold the AG locked so that free space doesn't change. This can hang other operations for the length of time it takes to discard all the free space in the AG.
IOWs, the behaviour of fstrim on XFS is entirely dependent on the speed of the block layer and hardware implementations of discards.
Quoted 2 lines
Yes OK i understand that but is there any way to prevent getting the whole server crash when I/O is too much?
Sorry, what crash are you talking about? IO being slow because you ran fstrim isn't a crash....
Quoted 2 lines
For example splitting whole disk or even AGs into subparts? Or set a timeout for the fstrim command?
You can split fstrim up into smaller sections yourself by using the range parameters.
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs
Quoted 2 lines · Dave Chinner
IOWs, the behaviour of fstrim on XFS is entirely dependent on the speed of the block layer and hardware implementations of discards.
And on a lot of SSDs, trim seems to act like a cache flush so it can hit performance hard. It should be scheduled for off-peak times afaik. It's not critical to run hourly or even daily. If you can schedule it once a week when other i/o is light that should be enough for most workloads.
Greg
--
Greg Freemyer
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Greg Freemyer
Quoted 2 lines · Dave Chinner
IOWs, the behaviour of fstrim on XFS is entirely dependent on the speed of the block layer and hardware implementations of discards.
And on a lot of SSDs, trim seems to act like a cache flush so it can hit performance hard.
That's because TRIM on SATA3 is an unqueued command. It basically causes the pipeline to be emptied before it can be issued, and no further IO can be issued until it completes. SATA3.1 is supposed to add a queued TRIM command, but it might be some time before we see that appearing in hardware...
Quoted 4 lines
It should be scheduled for off-peak times
afaik. It's not critical to run hourly or even daily. If you can schedule it once a week when other i/o is light that should be enough for most workloads.
I run it once every couple of months on my SSDs, if ever. Most modern SSDs have background defragmentation so if they are left idle for a couple of hours they clean themselves up pretty well without needing TRIM...
Cheers,
Dave.
Signature · 7 lines
Dave Chinner [email protected] _______________________________________________ xfs mailing list [email protected] http://oss.sgi.com/mailman/listinfo/xfs