sh Phoronix测试套件,Google PerfKit
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Phoronix测试套件,Google PerfKit相关的知识,希望对你有一定的参考价值。
## Perf
Cool intro in this link [https://jvns.ca/perf-zine.pdf](https://jvns.ca/perf-zine.pdf)
# DigitalOcean
# Install
cd /tmp && wget -qO - https://github.com/digitalocean/doctl/releases/download/v1.6.0/doctl-1.6.0-linux-amd64.tar.gz | tar -xzvf -
sudo mv /tmp/doctl /usr/local/bin/
# Login
export DO_TOKEN=''
echo "$DO_TOKEN" | doctl auth init -v
# Test
doctl compute region list
doctl compute size list
# AWS
# Install
pip install awscli
# Login
export AWS_ACCESS_KEY_ID=''
export AWS_SECRET_ACCESS_KEY=''
export AWS_DEFAULT_REGION='eu-central-1'
# Test
aws ec2 describe-instances
aws ec2 describe-regions
# GCloud
# Install
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
rm -rf ~/google-cloud-sdk ~/.config/gcloud
curl https://sdk.cloud.google.com | bash
# Login
## gcloud config configurations create perfkit
## gcloud config configurations activate perfkit
# export CLOUDSDK_ACTIVE_CONFIG_NAME='default'
export CLOUDSDK_CORE_PROJECT='perfkit-176107'
# mkdir -p ~/.config/gcloud/configurations
# cat <<_EOF_ > $CLOUDSDK_ACTIVE_CONFIG_NAME
# [core]
# account = opekanec@gmail.com
# project = perfkit-176107
# _EOF_
~/google-cloud-sdk/bin/gcloud auth activate-service-account --key-file <PATH TO JSON SERVICE ACC>
# Test
~/google-cloud-sdk/bin/gcloud compute zones list
~/google-cloud-sdk/bin/gcloud compute machine-types list
# Azure
# INSTALL
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
# curl -L https://aka.ms/InstallAzureCli | bash
pip install azure-cli
# Configure
az login
# Automatic configuration
az ad sp create-for-rbac --name SP_NAME --create-cert
az login --service-principal -u d7d167ca-ad2a-4b31-ab64-7d5b714b7d8d --tenant TENANT_ID --password PATH_TO_CERT.pem
# Test
az account list-locations
# Run tests
# AZURE
pkb --cloud=Azure --zones=northeurope --machine_type=Standard_A1 --benchmarks=cluster_boot,fio,iperf,mongodb_ycsb,unixbench,wrk
#!/bin/bash
# BASE: https://openbenchmarking.org/suite/pts/cpu
# * testy: pts/graphics-magick, pts/john-the-ripper, pts/compress-pbzip2, pts/compress-7zip,
# pts/encode-mp3, pts/encode-flac, pts/x264, pts/ffmpeg, pts/openssl, pts/gcrypt,
# pts/himeno, pts/pgbench, pts/apache, pts/c-ray, pts/povray, pts/smallpt, pts/tachyon,
# pts/crafty, pts/tscp, pts/mafft, pts/npb, pts/stream
# * Pridat pts/build-apache, pts/minion, pts/blake2, pts/build-linux-kernel, pts/nginx, pts/pybench
# pts/cachebench, pts/ffmpeg, pts/fftw, pts/hpcc, pts/java-scimark2, pts/primesieve, pts/redis
# Pre-install for Fedora24
sudo dnf install -y php-cli php-xml
cd /opt
mkdir phoronix && cd phoronix
wget https://github.com/phoronix-test-suite/phoronix-test-suite/archive/v7.0.1.tar.gz
tar -xzvf v7.0.1.tar.gz
cd phoronix-test-suite-7.0.1
# Removes need to accept license agreements every time
./phoronix-test-suite enterprise-setup
./phoronix-test-suite install pts/apache
./phoronix-test-suite batch-setup
./phoronix-test-suite batch-run pts/apache
# Config files are stored in $HOME/.phoronix-test-suite/
$HOME/.phoronix-test-suite/user-config.xml
# Apache AB test
# https://httpd.apache.org/docs/2.4/programs/ab.html
cd ~/.phoronix-test-suite/installed-tests/pts/apache-1.6.1
./httpd_/bin/ab -n 10000 -c 100 https://localhost/index.html
<?xml version="1.0"?>
<!--Phoronix Test Suite v7.0.1-->
<?xml-stylesheet type="text/xsl" href="xsl/pts-user-config-viewer.xsl"?>
<PhoronixTestSuite>
<Options>
<OpenBenchmarking>
<AnonymousUsageReporting>FALSE</AnonymousUsageReporting>
<IndexCacheTTL>3</IndexCacheTTL>
<AlwaysUploadSystemLogs>FALSE</AlwaysUploadSystemLogs>
</OpenBenchmarking>
<General>
<DefaultBrowser></DefaultBrowser>
<UsePhodeviCache>TRUE</UsePhodeviCache>
<DefaultDisplayMode>DEFAULT</DefaultDisplayMode>
<PhoromaticServers></PhoromaticServers>
<FullOutput>FALSE</FullOutput>
</General>
<Modules>
<LoadModules>toggle_screensaver, update_checker, graphics_event_checker</LoadModules>
</Modules>
<Installation>
<RemoveDownloadFiles>FALSE</RemoveDownloadFiles>
<SearchMediaForCache>TRUE</SearchMediaForCache>
<SymLinkFilesFromCache>FALSE</SymLinkFilesFromCache>
<PromptForDownloadMirror>FALSE</PromptForDownloadMirror>
<EnvironmentDirectory>~/.phoronix-test-suite/installed-tests/</EnvironmentDirectory>
<CacheDirectory>~/.phoronix-test-suite/download-cache/</CacheDirectory>
</Installation>
<Testing>
<SaveSystemLogs>TRUE</SaveSystemLogs>
<SaveInstallationLogs>FALSE</SaveInstallationLogs>
<SaveTestLogs>FALSE</SaveTestLogs>
<RemoveTestInstallOnCompletion></RemoveTestInstallOnCompletion>
<ResultsDirectory>~/.phoronix-test-suite/test-results/</ResultsDirectory>
<AlwaysUploadResultsToOpenBenchmarking>FALSE</AlwaysUploadResultsToOpenBenchmarking>
<AutoSortRunQueue>TRUE</AutoSortRunQueue>
</Testing>
<TestResultValidation>
<DynamicRunCount>TRUE</DynamicRunCount>
<LimitDynamicToTestLength>20</LimitDynamicToTestLength>
<StandardDeviationThreshold>3.50</StandardDeviationThreshold>
<ExportResultsTo></ExportResultsTo>
<MinimalTestTime>3</MinimalTestTime>
</TestResultValidation>
<BatchMode>
<SaveResults>TRUE</SaveResults>
<OpenBrowser>FALSE</OpenBrowser>
<UploadResults>FALSE</UploadResults>
<PromptForTestIdentifier>FALSE</PromptForTestIdentifier>
<PromptForTestDescription>FALSE</PromptForTestDescription>
<PromptSaveName>FALSE</PromptSaveName>
<RunAllTestCombinations>TRUE</RunAllTestCombinations>
<Configured>TRUE</Configured>
</BatchMode>
<Networking>
<NoInternetCommunication>FALSE</NoInternetCommunication>
<NoNetworkCommunication>FALSE</NoNetworkCommunication>
<Timeout>20</Timeout>
<ProxyAddress></ProxyAddress>
<ProxyPort></ProxyPort>
<ProxyUser></ProxyUser>
<ProxyPassword></ProxyPassword>
</Networking>
<Server>
<RemoteAccessPort>RANDOM</RemoteAccessPort>
<Password></Password>
<WebSocketPort>RANDOM</WebSocketPort>
<AdvertiseServiceZeroConf>TRUE</AdvertiseServiceZeroConf>
<PhoromaticStorage>~/.phoronix-test-suite/phoromatic/</PhoromaticStorage>
</Server>
</Options>
</PhoronixTestSuite>
#!/bin/bash
cd /opt && sudo wget -qO - https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/archive/v1.11.0.tar.gz | \
sudo tar -xzvf -
#cd /opt && sudo mkdir PerfKitBenchmarker; \
# sudo wget -qO - https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/archive/v1.11.0.tar.gz | \
# sudo tar -xzvf - -C /opt/PerfKitBenchmarker/
cd /opt/PerfKitBenchmarker-1.11.0 && sudo pip install -r requirements.txt
# Install elasticsearch package for pushing data to ES
sudo pip install elasticsearch
ES_URI=''
# Install providers
sudo pip install -r perfkitbenchmarker/providers/aws/requirements.txt
# Configure AWS
mkdir $HOME/.aws
KEY=''
SECRET_KEY=''
cat <<_EOF_ > $HOME/.aws/config
[default]
region = eu-central-1
_EOF_
cat <<_EOF_ > $HOME/.aws/credentials
[default]
aws_access_key_id = $KEY
aws_secret_access_key = $SECRET_KEY
_EOF_
chmod 600 $HOME/.aws/config
chmod 600 $HOME/.aws/credentials
# Checks AWS Regions and availability zones
# Resource: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
aws ec2 describe-regions
aws ec2 describe-availability-zones --region eu-central-1
###
# TESTS
# * create virtual machines
# * do one test
# * remove virtual machines and cleanup stuff
# * repeat on next tests
###
# PING
# Creates 2 instances and pings from one to second and otherwise
# commands used:
# ping -c 1 <IP OF SECOND MACHINE>
# ping -c 100 <IP OF SECOND MACHINE>
./pkb.py --cloud=AWS \
--zones=eu-central-1 \
--benchmarks=ping \
--machine_type=t2.micro \
--es_uri=$ES_URI \
--es_index=perfkit \
--es_type=result
curl -XGET 'https://$ES_URI:443/perfkit/result/_search?q=test:ping' | python -m json.tool
# Iperf
# Creates 2 instances, runs iperfs server on one and test internet network speed
# then test internal network speed and do the same but from second machine.
# commands used:
# S1: iperf --server --port 20000 &> /dev/null& echo $!
# S2: iperf --client 10.0.0.248 --port 20000 --format m --time 60 -P 1
# S2: iperf --client 35.158.89.91 --port 20000 --format m --time 60 -P 1
./pkb.py --cloud=AWS \
--zones=eu-central-1 \
--benchmarks=iperf \
--machine_type=t2.micro \
--es_uri=$ES_URI \
--es_index=perfkit \
--es_type=result
# Sysbench OLTP
./pkb.py --cloud=AWS \
--zones=eu-central-1 \
--benchmarks=sysbench_oltp \
--machine_type=t2.micro \
--es_uri=$ES_URI \
--es_index=perfkit \
--es_type=result
# Tomcat
# doesnt work with AMI image
/opt/PerfKitBenchmarker-1.11.0/pkb.py --cloud=AWS --zones=eu-central-1 --benchmarks=tomcat --machine_type=m3.medium
# ...
/opt/PerfKitBenchmarker-1.11.0/pkb.py --cloud=AWS --zones=eu-central-1 --benchmarks=cluster_boot --machine_type=m3.medium
/opt/PerfKitBenchmarker-1.11.0/pkb.py --cloud=AWS \
--zones=eu-central-1 \
--benchmarks=cluster_boot \
--config_override=cluster_boot.vm_groups.default.vm_count=10 \
--machine_type=m3.medium
# Install doctl
# https://github.com/digitalocean/doctl
cd /tmp && wget -qO - https://github.com/digitalocean/doctl/releases/download/v1.6.0/doctl-1.6.0-linux-amd64.tar.gz | tar -xzvf -
sudo mv /tmp/doctl /usr/local/bin/
# Install elasticsearch package for pushing data to ES
sudo pip install elasticsearch
ES_URI=''
# Setup credentials and access to DO
# doctl auth init -t <TOKEN>
# Needs interaction
# Update access token and compute.ssh.ssh-key-path in doctl/config.yaml
mkdir -p ~/.config/doctl
cp digital-ocean-config.txt ~/.config/doctl/config.yaml
chmod 600 ~/.config/doctl/config.yaml
# Machine types:
# 512mb, 1gb, 2gb, 4gb, 8gb, 16gb
# Zones:
# nyc1, nyc2, nyc3, sfo1, sfo2, fra1, lon1, ams2, ams3
./pkb.py --cloud=DigitalOcean \
--zones=fra1 \
--benchmarks=ping \
--machine_type=1gb \
--es_uri=$ES_URI \
--es_index=perfkit \
--es_type=result
以上是关于sh Phoronix测试套件,Google PerfKit的主要内容,如果未能解决你的问题,请参考以下文章
Google 测试 - 使用“SetUpTestSuite”似乎不起作用
PBTK:一款针对Protobuf App的逆向工程与模糊测试套件
Android安装Google play(安装Google chrome)
google-toolbox-for-mac iphone 单元测试:1073 中止陷阱 mkdir "$CFFIXED_USER_HOME" 命令 /bin/sh 失败,退出代码