Script to Display FC Queue Depth Settings
AnthonyEnglish 270000RKFN Comments (6) Visits (20197)
My compatriot Chris Gibson highlighted a great performance tuning attribute for Fibre Channel adapters in this blog post. I was so excited that I dusted off my blog-writing skills (much neglected) and got fired up enough to put Chris' advice into practice via a script.
First, the advice - which came originally from IBM's Dan Braden - is to display the number of command elements - num_cmd_elems - on a Fibre Channel adapter.
On AIX (and on the Virtual I/O Server) there is an attribute on Fibre Channel adapters call
For more of Dan Braden's advice, check out his document on AIX
So, onto applying the advice in your environment.
Three Key Values
There are three values that you're interested in knowing here:
On a Fibre Channel adapter, you can get these settings using the following commands;
Default value for num_cmd_elems
You get the default value with the lsattr command.
lsattr -Dl fcs0 -a num_cmd_elems -F value
Here is an explanation of those flags:
Now on to the actual value - the value which is in effect.
Actual value for num_cmd_elems
Now, if you've changed the value for your adapter (most likely by increasing it), then you need to see what it is currently set to. Same command as above, except you use the -E to show the Effective value:
lsattr -El fcs0 -a num_cmd_elems -F value
High Water Mark
Now it's time to find out exactly what the High Water Mark is for the adapter. You can do that using the fcstat command with the new (and currently undocumented) flag -D.
Look at the FC SCSI Adapter Driver statistics, where you will find the High water mark of active commands. This example
Alright. We now have three values: default, effective and high-water-mark.
Note from a kind reader:
The num_cmd_elems should be equal to High water mark of active commands + High water mark of pending commands. “High water mark of pending commands” indicates the maximum number of commands that were pending on the virtual FC stack at any point in time on the running system.
Now, Chris has provided this formula which he got from Dan Braden:
Now as you may have a number of fibre channel adapters, and you may have to do this for a number of AIX environments, it probably calls for a script.
The following script displays the three values we're after: the current (effective) num_cmd_elems, the default setting for the adapter, and the high water mark you've actually reached. It then displays the command to run (chdev) to set the num_cmd_elems to the High Water Mark or the default setting for the adapter, if the current setting is less than both of those.
The script does not run the chdev command, which requires a reboot anyway.
The usual disclaimers apply: run this script at your own risk. it should be run in a non-critical environment etc.
#!/bin/ksh # set_
A tip of ye olde hat to Chris Gibson and to Dan Braden for providing this information. And my thanks for David Tansley for assistance with the script.