Link Search Menu Expand Document

Python

PerfKitBenchmarker requires Python and is tested on Python 3.7. We recommend using a virtual environment to manage different Python versions and their required pip dependencies.

Create a virtual environment, this will set python3 as the default version.

python3 -m venv pkb-virtualenv

Activate this virtual environment. When you’re finished you can simply type deactivate.

source pkb-virtualenv/bin/activate

PerfKitBenchmarker

Environment

PerfkitBenchmarker is hosted here.

  1. Clone PKB to your local machine:

    cd $HOME && git clone https://github.com/GoogleCloudPlatform/PerfKitBenchmarker.git
    
  2. Activate the virtualenv that you installed earlier.

    source $HOME/pkb-virtualenv/bin/activate
    
  3. Install dependencies.

    cd $HOME/PerfKitBenchmarker && pip install -r requirements.txt
    
  4. Install the cloud provider’s command line interface, for example gcloud from https://developers.google.com/cloud/sdk/.

Running

This procedure demonstrates how to run only selective stages of a benchmark. This technique can be useful for examining a machine after it has been prepared, but before the benchmark runs.

This example shows how to provision and prepare the cluster_boot benchmark without actually running the benchmark.

  1. Change to your local version of PKB: cd $HOME/PerfKitBenchmarker

  2. Run provision, prepare, and run stages of cluster_boot.

    ./pkb.py --benchmarks=cluster_boot --machine_type=n1-standard-2 --zones=us-central1-f --run_stage=provision,prepare,run
    
  3. The output from the console will tell you the run URI for your benchmark. Try to ssh into the VM. The machine “Default-0” came from the VM group which is specified in the benchmark_config for cluster_boot.

    ssh -F /tmp/perfkitbenchmarker/runs/<run_uri>/ssh_config default-0
    
  4. Now that you have examined the machines, teardown the instances that were made and cleanup.

    ./pkb.py --benchmarks=cluster_boot --run_stage=teardown -run_uri=<run_uri>