Saturday, March 15, 2014

NetApp Storage: The importance of reallocation (defragmentation)

If you have a NetApp, chances are you will need to reallocate volumes from time to time in order to keep your system running well.

While it's nowhere near a direct comparison, in general think about reallocation on a NetApp as to defragging a desktop computer's hard drive.  It doesn't need it every day, but it can help from time to time.

Here are a few reasons when/why you should:
  • The addition of a new raid group to an aggregate - ALWAYS
  • If the aggregate gets above 80% full, if you have "hot spots"
  • If your volume has been around a long time
The addition of a new raid group to an aggregate
If you have just added a new RG to an aggregate, you need to reallocate.  Failure to do this will result in an disproportionate amount of writes going to the new set of disks (especially if the aggregate was close to full - which is usually why you add new disks).  This way, you will not get the full speed of all disks if the data was sequentially written.

It is indisputable, you need to reallocate every time you add new disks to an aggregate.

If the aggregate is 80% full, if you have "hot spots"
I read a long time ago that when an aggregate is full - and you are writing a lot of data - WAFL is not always able to write data in the optimal place.  Therefore, data may be written in a location on disk that is not ideal.  If this happens, you can get hot spots - blocks of data that are read often but not located in an ideal area - causing an expensive read operation (disk heads have to move far to get to the data).

If you have hot spots (you'll know from a reallocation measurement) or your aggregate has been above 80% full for quite some time, you'll likely need to reallocate.

Age of the volume
If the volume has been around a long time, chances are it has had a lot of data read and written.  Over time - especially if the space has fluctuated, your data may not be laid out in the best manner.

A reallocation measure will scan the volume and give you a rating.  This rating/measurement will tell you if you need to reallocate or not.


Performing the reallocation
You should do a physical (-p) reallocate.  This will do a one-time reallocation.  It can take a long time for large volumes, I've seen some take over a week to complete.  However, your data will be optimally distributed across all disks.

You need to perform this for each volume in an aggregate.  This is a one-time operation, and it will not show up when you check reallocation status after the job is complete.

reallocate start -f -p /vol/<volname>

Measuring for reallocation
If you want to see if reallocation can help, perform a measurement.  This will perform a one-time measurement (-o).

reallocate measure -o /vol/<volname>

If you want to reallocate measure on a schedule, you can set an internal (-i)

reallocate measure -i 30d /vol/<volname>

Checking the optimization level
Once you have set the measurements, you can check the status by typing:

reallocate status

You will see an response similar to this:

/vol/volname: 
        State: Idle
     Schedule: n/a
     Interval: 1 day
 Optimization: 3

The optimization level is the level of fragmentation, or how well the data is split across all the disks in the aggregate.  Generally speaking, a level of 1-3 is excellent, with 1 being the best.  Anything higher than a 5 is pretty bad.

Scheduling reallocation
If you want to reallocate your volumes on a schedule, Data ONTAP will handle this for you.  There is a threshold that will determine whether or not to actually reallocate.

-s is for schedule, the schedule format is "minute hour dayofthemonth dayoftheweek"  Day of the week is 0-6, Sunday being 0.

reallocate schedule -s "0 22 * 5" /vol/<volname>

This will schedule the reallocation job for every Friday night at 10pm.

Alternatively, you can just schedule a job to run on an interval, instead of a schedule.

reallocate start -i 7d /vol/volname

This will have the volume reallocate every 7 days.

No comments:

Post a Comment

Featured Post

Remove 3D Objects and other annoying folders on Windows 10

 Microsoft just keeps adding more crap to clutter up the navigation in Windows 10.  Seriously, who needs a 3D Objects folder?  The tiny perc...