Summary
Learn how to calculate block size using the Pure Storage PowerShell SDK, now updated with the latest FlashArray PowerShell SDK 2.16, improved cmdlets, and enhanced performance metrics for more efficient storage management.
The Pure Storage PowerShell SDK covers all aspects of management and automation for the FlashArray FA-400 series and the FlashArray//m series. In many of the discussions with our customers, they are most interested in reporting. On several occasions customers have asked how can I get the specific block size to create their own custom graph reports. In this blog article I’ll provide the details on how to calculate the block size by creating a custom cmdlet that leverages the PowerShell SDK.
Below are the results from a 1 hour workload test using the below command. The test below test sets a defined read block size of 32,768 and a write block size of 16,384. I did this to ensure that the calculations can be validated using known block sizes to verify against what we are showing in the Pure Storage web management interface.
nohup pureload -i pct=.6,op=read,size=32768 -i pct=.4,op=write,size=16384,dtype=h20 -m maxoff=1
,initthreads=10,maxthreads=10,interval=86400,warmup=1,status=1,maxlat=20000 /dev/pslun-Barkz-PURELOAD
The screenshot below shows a 1 hour view of the above workload. To fully understand the calculation we will pinpoint a specific time 14:46:02pm. At this specific time Read = 30.28K, Write = 20.14K and Average R/W IO Size = 25.61KB.
The management interface does all of the calculations both in the Dashboard and Analysis tabs for quick review. But what if you want to pull the live data yourself? I thought you’d never ask!
In the Pure Storage PowerShell SDK there is a cmdlet, Get-PfaVolumeIOMetrics that can be used to pull data from the FlashArray based on a time range. The example code below retrieves 1 hours worth of I/O data from the volume named Barkz-PURELOAD.
$Creds = Get-Credential
$FlashArray = New-PfaArray -EndPoint ‘csg-fa420-2’ -Credentials $Creds -IgnoreCertificateError
Get-PfaVolumeIOMetrics -Array $FlashArray -VolumeName ‘Barkz-PURELOAD’ -TimeRange 1h |
Select-Object reads_per_sec, writes_per_sec, output_per_sec, input_per_sec, time |
Format-Table –AutoSize
Below are the results from the code above. I am only displaying 5 results. You can see from the results we provide information every 30 seconds.
reads_per_sec writes_per_sec output_per_sec input_per_sec time
————- ————– ————– ————- —-
34633 23063 1134839945 377860915 2015-08-21T21:45:02Z
31068 20734 1018022025 339712956 2015-08-21T21:45:32Z
31238 20803 1023590400 340836352 2015-08-21T21:46:02Z
31343 20901 1027057254 342446353 2015-08-21T21:46:32Z
34290 22803 1123602705 373610906 2015-08-21T21:47:02Z
The data above is the same data that we use to calculate what is displayed in the management interface. The basic calculation that our web management interfaces uses is the following:
((output_per_sec + input_per_sec)/(reads_per_sec + writes_per_sec))/1024
Using the time we pinpointed, 14:46:02pm, we can calculate the block size.
((1023590400 + 340836352)/(31238 + 20803))/1024 = 25.60KB
The calculation above uses 1024 as the division because we know the IO size in this case is in Kilobytes. The management interface dynamically calculates the correct unit based on the raw number. For example is an IO size happens to be in the Megabytes then it would use “1024*1024”; the same applies to GB “1024*1024*1024”. Keep this in mind as you create custom calculations in Microsoft Excel or other tools.
More on PowerShell
The above shows how to calculate that one specific data point, now let’s retrieve the full hours worth of data and export as a CSV to be used with Microsoft Excel 2013. Building on the sample code from above, we add Export-Csv to the pipeline and can export as a CSV.
$Creds = Get-Credential
$FlashArray = New-PfaArray -EndPoint ‘csg-fa420-2’ -Credentials $Creds -IgnoreCertificateError
Get-PfaVolumeIOMetrics -Array $FlashArray -VolumeName ‘Barkz-PURELOAD’ -TimeRange 1h | `
Export-Csv –Path ‘C:TEMPPureStorage-BlockSize-1HR.csv’ –NoTypeInformation
Opening up the PureStorage-BlockSize-1HR.csv file with Microsoft Excel will show all of the data collection points for the past hour. With a few quick steps in Excel you can create a table and add the basic calculation.
Select cell A1, CTRL+T will automatically create a table. In column “I” add Block Size and that will automatically extend the table to include the newly added column. With a table created the calculation can be created using the column names as follows:
Once the calculation has been created in cell “I2” it will automatically be added to all subsequent cells. Now once that is completed you can get as creative as you want with graphs. For example below is a simple graph that shows the block size calculations for the 1 hour we exported above.
Updated Information:
To align with the latest advancements, users are encouraged to adopt the updated PowerShell SDK. Below are the steps to install and utilize the new features for calculating block sizes:
1. Installation of the Latest SDK:
- Prerequisites:
- Ensure that PowerShell 5.1 or later is installed on your system.
- Installation via PowerShell Gallery:powershellCopyEdit
Install-Module -Name PureStorage.FlashArray -Force -AllowClobber
This command installs the latest version of the Pure Storage FlashArray PowerShell SDK.
2. Connecting to the FlashArray:
1 2 3 |
powershellCopyEdit<code># Establish a connection to the FlashArray $FlashArray = Connect–PfaArray –EndPoint “your_flasharray_ip” –UserName “your_username” –Password “your_password” |
3. Calculating Block Size:
With the updated SDK, you can retrieve volume performance metrics, including block sizes, more efficiently:
1 2 3 4 5 6 7 8 |
powershellCopyEdit<code># Retrieve performance metrics for a specific volume $VolumeName = “your_volume_name” $Metrics = Get–PfaVolumePerformance –Array $FlashArray –VolumeName $VolumeName # Calculate average block size $AverageBlockSize = $Metrics.WriteBytesPerSec / $Metrics.WriteOpsPerSec Write–Output “Average Write Block Size: $AverageBlockSize bytes” |
Note: Replace "your_flasharray_ip"
, "your_username"
, "your_password"
, and "your_volume_name"
with your FlashArray’s IP address, credentials, and the target volume name, respectively.
Benefits of Updating:
- Enhanced Functionality: The latest SDK versions provide improved cmdlets that simplify complex tasks.
- Improved Performance: New cmdlets are optimized for better performance and reliability.
- Comprehensive Documentation: Access to updated help files and examples enhances the user experience.
For more detailed information and additional examples, refer to the official Pure Storage blog post announcing the FlashArray PowerShell SDK version 2.16.
By updating to the latest PowerShell SDK, users can leverage enhanced features and improved performance for managing Pure Storage FlashArray systems.