forked from pmem/CacheLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Baremetal script for running batch expriments with background evictio…
…n promotion and DML. Includes json parsing and metric aggregation for analysis and plotting
- Loading branch information
Showing
9 changed files
with
55,162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Bare-metal Testing Scripts | ||
|
||
|
||
> ### accelConfig.sh | ||
> | ||
>> Set up DSA devices using accel-config. | ||
>> - OPTIONAL Arg-1: DSA device id. Default: 0 | ||
>> - OPTIONAL Arg-2: Enable/Disable DSA device. Default: yes | ||
>> - OPTIONAL Arg-3: SHARED WQ id. Default: 1 | ||
>> - OPTIONAL Arg-4: ENGINE count. Default: 4 | ||
>> - OUTPUT Verify DSA devices set up is correct using accel-config | ||
|
||
> ### runTestAndConvertToJson.py | ||
> | ||
>> Run a single test and convert the output TXT to CSV. | ||
>> This script uses numactl to bind all threads to node 0. | ||
>> Run with **sudo** | ||
>> - REQUIRED Arg-1: Cachebench config file path from root directory | ||
>> - REQUIRED Arg-2: DSA device count | ||
>> - REQUIRED Arg-3: Number of background evictors | ||
>> - REQUIRED Arg-4: Eviction batch size | ||
>> - REQUIRED Arg-5: Number of background promoters | ||
>> - REQUIRED Arg-6: Promotion batch size | ||
>> - REQUIRED Arg-7: Output path | ||
>> - OUTPUT txt and json saved in same path | ||
|
||
> ### aggregateAndFilterTestResults.py | ||
> | ||
>> Gather all output JSON using the file name filter | ||
>> Run with **sudo** | ||
>> - REQUIRED Arg-1: Output json directory path | ||
>> - REQUIRED Arg-2: Filter filenames using this string. Pass null str to gather all files. | ||
>> - OUTPUT Saved in a csv on the output JSON directory path | ||
|
||
> ### parseTestResultIntoCsv.py | ||
> | ||
>> Parse TXT output and save in JSON format | ||
>> - REQUIRED Arg-1: output txt file name | ||
>> - REQUIRED Arg-2: Tag a string for the text | ||
>> - OUTPUT Save CSV to the same path | ||
|
||
> ### sample.sh | ||
> | ||
>> This shows how to create a test sequence, then parses results and aggregates it. | ||
>> Run with **sudo** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
echo "OPTIONAL Arg-1: DSA device id. Default: 0" | ||
echo "OPTIONAL Arg-2: Enable/Disable DSA device. Default: yes" | ||
echo "OPTIONAL Arg-3: SHARED WQ id. Default: 1" | ||
echo "OPTIONAL Arg-4: ENGINE count. Default: 4" | ||
|
||
if [ "$#" -ge 5 ]; then | ||
echo "ERROR: Incorrect argument count. Expected arg count <= 4" | ||
exit 1 | ||
fi | ||
|
||
DEVID=${1:-0} | ||
ENABLE=${2:-yes} | ||
SWQID=${3:-1} | ||
NENGS=${4:-4} | ||
|
||
DEV=dsa${DEVID} | ||
SWQ=${DEV}/wq${DEVID}.${SWQID} | ||
|
||
echo "=> ${SWQ}:" | ||
accel-config disable-wq ${SWQ} | ||
|
||
echo "=> ${DEV}:" | ||
accel-config disable-device ${DEV} | ||
|
||
if [ "${ENABLE}" != "yes" ]; then | ||
echo "Exit after disabling ${DEV}." | ||
exit 1 | ||
fi | ||
|
||
for ((i=0; i < ${NENGS}; i++)) | ||
do | ||
echo "=> ${DEV}/engine${DEVID}.${i}" | ||
echo "configured" | ||
accel-config config-engine ${DEV}/engine${DEVID}.${i} --group-id=0 | ||
done | ||
|
||
accel-config config-wq ${SWQ} --group-id=0 | ||
accel-config config-wq ${SWQ} --priority=1 | ||
accel-config config-wq ${SWQ} --wq-size=128 | ||
accel-config config-wq ${SWQ} --max-batch-size=1024 | ||
accel-config config-wq ${SWQ} --max-transfer-size=2147483648 | ||
accel-config config-wq ${SWQ} --block-on-fault=0 | ||
accel-config config-wq ${SWQ} --type=user | ||
accel-config config-wq ${SWQ} --name="dsa-test" | ||
accel-config config-wq ${SWQ} --mode=shared | ||
accel-config config-wq ${SWQ} --threshold=127 | ||
accel-config config-wq ${SWQ} --driver-name="user" | ||
|
||
echo "=> ${DEV}:" | ||
accel-config enable-device ${DEV} | ||
|
||
echo "=> ${SWQ}:" | ||
accel-config enable-wq ${SWQ} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/python3 | ||
|
||
import sys | ||
import json | ||
import re | ||
import os | ||
import pandas as pd | ||
import csv | ||
|
||
|
||
def listJson(path, filterStr): | ||
jsonFiles = [jsonFile for jsonFile in os.listdir(path) if jsonFile.endswith('.json') and filterStr in jsonFile] | ||
return [path + f for f in jsonFiles] | ||
|
||
|
||
def getMetrics(files, cbCols, sysCols): | ||
values = {} | ||
for entry in files: | ||
with open(entry, 'r') as jsonFile : | ||
data = json.load(jsonFile) | ||
key = os.path.basename(entry).rsplit(".", 1)[0] | ||
values[key] = {} | ||
for col in cbCols: | ||
values[key][col] = data['cachebench_metrics'][col] | ||
for col in sysCols: | ||
values[key][col] = data['system_metrics'][col] | ||
return values | ||
|
||
|
||
def main(): | ||
args = sys.argv[1:] | ||
if len(args) < 1 or len(args) > 2: | ||
print("Invalid Args. Required : path, filter-string") | ||
exit() | ||
|
||
path = args[0] | ||
filterStr = args[1] if len(args) == 2 else '' | ||
files = listJson(path, filterStr) | ||
|
||
cbCols = [ | ||
'cache_allocate_api_latency_p90_in_ns', | ||
'cache_allocate_api_latency_p99_in_ns', | ||
'cache_find_api_latency_p90_in_ns', | ||
'cache_find_api_latency_p99_in_ns', | ||
'cache_background_eviction_latency_p90_in_ns', | ||
'cache_background_eviction_latency_p99_in_ns', | ||
'cache_evict_dml_large_item_wait_latency_p90_in_ns', | ||
'cache_evict_dml_large_item_wait_latency_p99_in_ns', | ||
'cache_evict_dml_small_item_wait_latency_p90_in_ns', | ||
'cache_evict_dml_small_item_wait_latency_p99_in_ns', | ||
'cache_background_promotion_latency_p90_in_ns', | ||
'cache_background_promotion_latency_p99_in_ns', | ||
'cache_promote_dml_large_item_wait_latency_p90_in_ns', | ||
'cache_promote_dml_large_item_wait_latency_p99_in_ns', | ||
'cache_promote_dml_small_item_wait_latency_p90_in_ns', | ||
'cache_promote_dml_small_item_wait_latency_p99_in_ns' | ||
] | ||
|
||
sysCols = [ | ||
'dsa0/event=0x1,event_category=0x0/', | ||
'dsa0/event=0x10,event_category=0x1/', | ||
'dsa0/event=0x2,event_category=0x3/', | ||
'time_elapsed_in_secs', | ||
'user_time_seconds', | ||
'percent_of_cpu_this_job_got' | ||
] | ||
metrics = getMetrics(files, cbCols, sysCols) | ||
|
||
''' Save metrics to csv ''' | ||
fields = ['test'] + cbCols + sysCols | ||
csvFile = os.path.join(path , 'metrics.' + filterStr + '.csv') | ||
with open(csvFile, 'w') as f: | ||
w = csv.DictWriter(f, fields) | ||
w.writeheader() | ||
for key, val in sorted(metrics.items()): | ||
row = {'test': key} | ||
row.update(val) | ||
w.writerow(row) | ||
print("Filter: {0} ; Results gathered in {1}".format(filterStr, csvFile)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"cache_config": { | ||
"cacheSizeMB": 32768, | ||
"dsaEnabled": "true", | ||
"minBatchSizeForDsaUsage": 10, | ||
"largeItemMinSize": 4096, | ||
"largeItemBatchEvictDsaUsageFraction": 0.75, | ||
"smallItemBatchEvictDsaUsageFraction": 0.7, | ||
"htBucketPower": 27, | ||
"htBucketLock": 27, | ||
"evictorThreads": 20, | ||
"maxEvictionBatch": 200, | ||
"backgroundEvictorIntervalMilSec": 1, | ||
"memoryTiers": [ | ||
{ | ||
"ratio": 1, | ||
"memBindNodes": 0 | ||
}, | ||
{ | ||
"ratio": 1, | ||
"memBindNodes": 1 | ||
} | ||
], | ||
"poolRebalanceIntervalSec": 0, | ||
"moveOnSlabRelease": false | ||
}, | ||
"test_config": { | ||
"addChainedRatio": 0.0, | ||
"delRatio": 0.0, | ||
"enableLookaside": true, | ||
"getRatio": 0.9911552928593673, | ||
"keySizeRange": [ | ||
1, | ||
8, | ||
64 | ||
], | ||
"keySizeRangeProbability": [ | ||
0.3, | ||
0.7 | ||
], | ||
"loneGetRatio": 0.008844707140632665, | ||
"numKeys": 8935378, | ||
"numOps": 5000000, | ||
"opRatePerSec": 1000000, | ||
"numThreads": 24, | ||
"popDistFile": "pop.json", | ||
"setRatio": 0.0, | ||
"valSizeDistFile": "sizes.json" | ||
} | ||
} |
Oops, something went wrong.