[demos] Update iperf3/sysbench for benchmarks
This commit is contained in:
		
							parent
							
								
									423814f2cd
								
							
						
					
					
						commit
						2041c7531c
					
				
							
								
								
									
										47
									
								
								demos/benchmarks/iperf3/iperf3.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										47
									
								
								demos/benchmarks/iperf3/iperf3.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,47 @@ | |||||||
|  | #! /bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | CUR_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||||||
|  | TEST_TIME=${1:-60} | ||||||
|  | BUF_LEN=${2:-128K} | ||||||
|  | STREMS=${3:-8} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | function iperf3_prepare() | ||||||
|  | { | ||||||
|  |     ./build.sh | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function iperf3_run() | ||||||
|  | { | ||||||
|  |     echo "" | ||||||
|  |     echo "*** Doing iperf3 with ${STREMS} client streams in parallel ***" | ||||||
|  |     echo "*** with read/write buffer length ${BUF_LEN} for ${TEST_TIME} seconds. ***" | ||||||
|  | 
 | ||||||
|  |     pushd occlum_server | ||||||
|  |     occlum run /bin/iperf3 -s -p 6777 -1 1>/dev/null & | ||||||
|  |     popd | ||||||
|  | 
 | ||||||
|  |     sleep 3 | ||||||
|  | 
 | ||||||
|  |     pushd occlum_client | ||||||
|  |     occlum run /bin/iperf3 -c 127.0.0.1 -p 6777 -f Mbits \ | ||||||
|  |         -P ${STREMS} -t ${TEST_TIME} -l ${BUF_LEN} | tee output.txt | ||||||
|  |     popd | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function iperf3_result() | ||||||
|  | { | ||||||
|  |     output="occlum_client/output.txt" | ||||||
|  |     SENDER_RES=$(grep "SUM" ${output} | grep "sender" | awk '{print $6}') | ||||||
|  |     RECV_RES=$(grep "SUM" ${output} | grep "receiver" | awk '{print $6}') | ||||||
|  | 
 | ||||||
|  |     jq --argjson sender $SENDER_RES --argjson recv $RECV_RES \ | ||||||
|  |         '(.[] | select(.extra == "sender") | .value) |= $sender | | ||||||
|  |         (.[] | select(.extra == "receiver") | .value) |= $recv'  \ | ||||||
|  |         result_template.json  > result.json | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | iperf3_prepare | ||||||
|  | iperf3_run | ||||||
|  | iperf3_result | ||||||
							
								
								
									
										14
									
								
								demos/benchmarks/iperf3/result_template.json
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										14
									
								
								demos/benchmarks/iperf3/result_template.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | [ | ||||||
|  |     { | ||||||
|  |         "name": "Sender Average Rate", | ||||||
|  |         "unit": "Mbits/sec", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "sender" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "Receiver Average Rate", | ||||||
|  |         "unit": "Mbits/sec", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "receiver" | ||||||
|  |     } | ||||||
|  | ] | ||||||
							
								
								
									
										26
									
								
								demos/benchmarks/sysbench/result_template.json
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										26
									
								
								demos/benchmarks/sysbench/result_template.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | |||||||
|  | [ | ||||||
|  |     { | ||||||
|  |         "name": "Threads Minimum latency", | ||||||
|  |         "unit": "ms", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "min" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "Threads Average Latency", | ||||||
|  |         "unit": "ms", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "avg" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "Threads Maximum Latency", | ||||||
|  |         "unit": "ms", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "max" | ||||||
|  |     }, | ||||||
|  |     { | ||||||
|  |         "name": "Thread 95th Percentile Latency", | ||||||
|  |         "unit": "ms", | ||||||
|  |         "value": 0, | ||||||
|  |         "extra": "per95" | ||||||
|  |     } | ||||||
|  | ] | ||||||
							
								
								
									
										44
									
								
								demos/benchmarks/sysbench/sysbench.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										44
									
								
								demos/benchmarks/sysbench/sysbench.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,44 @@ | |||||||
|  | #! /bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | CUR_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||||||
|  | TEST_TIME=${1:-60} | ||||||
|  | TEST_THREADS=${2:-200} | ||||||
|  | 
 | ||||||
|  | function sysbench_prepare() | ||||||
|  | { | ||||||
|  |     ./dl_and_build.sh | ||||||
|  |     ./prepare_sysbench.sh | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function sysbench_run() | ||||||
|  | { | ||||||
|  |     echo "" | ||||||
|  |     echo "*** Doing sysbench with ${TEST_THREADS} threads for ${TEST_TIME} seconds ***" | ||||||
|  | 
 | ||||||
|  |     pushd occlum_instance | ||||||
|  |     occlum run /bin/sysbench threads \ | ||||||
|  |         --threads=${TEST_THREADS} --thread-yields=100 \ | ||||||
|  |         --thread-locks=4 --time=${TEST_TIME} run | tee output.txt | ||||||
|  |     popd | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function sysbench_result() | ||||||
|  | { | ||||||
|  |     output="occlum_instance/output.txt" | ||||||
|  |     MIN=$(grep "min:" ${output} | awk '{print $NF}') | ||||||
|  |     AVG=$(grep "avg:" ${output} | awk '{print $NF}') | ||||||
|  |     MAX=$(grep "max:" ${output} | awk '{print $NF}') | ||||||
|  |     PER95=$(grep "95th" ${output} | awk '{print $NF}') | ||||||
|  | 
 | ||||||
|  |     jq --argjson min $MIN --argjson avg $AVG --argjson max $MAX --argjson per95 $PER95 \ | ||||||
|  |         '(.[] | select(.extra == "min") | .value) |= $min | | ||||||
|  |         (.[] | select(.extra == "avg") | .value) |= $avg | | ||||||
|  |         (.[] | select(.extra == "max") | .value) |= $max | | ||||||
|  |         (.[] | select(.extra == "per95") | .value) |= $per95'  \ | ||||||
|  |         result_template.json  > result.json | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | sysbench_prepare | ||||||
|  | sysbench_run | ||||||
|  | sysbench_result | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user