We seen to be having an issue whereby our database server
<div>gets to 90% or higher fragmentation.  When it gets to this point </div><div>we would need to remove form production and defrag using the </div><div>xfs_fsr tool.  The server does get a lot of writes and reads.  Is</div>

<div>there something we can do to reduce the fragmentation or could</div><div>this be a result of hard disk tweaks we use or mount options?</div><div><br></div><div>here is some fo the tweaks we do:</div><div><br></div><div>

<div>/bin/echo &quot;512&quot; &gt; /sys/block/sda/queue/read_ahead_kb</div><div>/bin/echo &quot;10000&quot; &gt; /sys/block/sda/queue/nr_requests</div><div>/bin/echo &quot;512&quot; &gt; /sys/block/sdb/queue/read_ahead_kb</div>

<div>/bin/echo &quot;10000&quot; &gt; /sys/block/sdb/queue/nr_requests</div><div>/bin/echo &quot;noop&quot; &gt; /sys/block/sda/queue/scheduler</div><div>/bin/echo &quot;noop&quot; &gt; /sys/block/sdb/queue/scheduler</div>

</div><div><br></div><div><br></div><div>Adn here are the mount options on one of our servers:</div><div><br></div><div> xfs     rw,noikeep,allocsize=256M,logbufs=8,sunit=128,swidth=2304 </div><div><br></div><div>the sunit and swidth vary on each server based on disk drives.</div>

<div><br></div><div>We do use LVM on the volume where the mysql data is stored</div><div>as we need this for snapshotting.  Here is an example of a current state:</div><div><br></div><div><div>xfs_db -c frag -r /dev/mapper/vgmysql-lvmysql</div>

<div>actual 42586, ideal 3134, fragmentation factor 92.64%</div></div><div><br></div><div><br></div><div><br></div><div>Regards,</div><div>David Fuller</div><div><br></div>