golang.org/x/build@v0.0.0-20240506185731-218518f32b70/perf/README.md (about)

     1  # Performance analysis system
     2  
     3  This package contains the https://perf.golang.org/ benchmark result analysis
     4  system. It serves as a front-end to the benchmark result storage system at
     5  https://perfdata.golang.org/.
     6  
     7  The storage system is designed to have a standardized REST API at
     8  https://perfdata.golang.org/, and we encourage additional analysis tools to be
     9  written against the API. An example client can be found in the
    10  [perfdata](https://pkg.go.dev/golang.org/x/build/perfdata) package.
    11  
    12  ## Local
    13  
    14  Both storage and analysis can be run locally; the following commands will run
    15  the complete stack on your machine with an in-memory datastore.
    16  
    17  To run the storage system:
    18  
    19      $ go install golang.org/x/build/perfdata/localperfdata@latest
    20      $ localperfdata -addr=:8081 -view_url_base=http://localhost:8080/search?q=upload: &
    21  
    22  To run the analysis frontend:
    23  
    24      $ make docker-prod
    25      $ docker run --rm --net=host gcr.io/symbolic-datum-552/perf:latest -listen-http=:8080 -perfdata=http://localhost:8081
    26  
    27  Browse to https://localhost:8080 (note that the instance uses a self-signed
    28  certificate).
    29  
    30  To run the analysis frontend connected to a local InfluxDB instance, first
    31  follow [the instructions to set one up](../influx/README.md).
    32  Then, run the above command but with the `-influx-host` and `-influx-token`
    33  flags set to their appropriate values (as specified by the InfluxDB setup
    34  instructions).
    35  
    36  Send an HTTP request to https://localhost:8080/cron/sync-influx to sync the
    37  local instances together.
    38  
    39  ## Google Cloud
    40  
    41  One-time setup:
    42  
    43  1. IAM setup, based on
    44     https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity#authenticating_to:
    45  
    46    a. Create GCP service account:
    47  
    48      $ gcloud iam service-accounts create perf-prod \
    49          --description="Runs golang.org/x/build/perf"
    50  
    51    c. Allow Kubernetes service account (created by deployment-prod.yaml) to
    52       impersonate the GCP service account:
    53  
    54      $ gcloud iam service-accounts add-iam-policy-binding \
    55          perf-prod@<PROJECT>.iam.gserviceaccount.com \
    56          --role roles/iam.workloadIdentityUser \
    57          --member "serviceAccount:<PROJECT>.svc.id.goog[prod/perf-prod]"
    58  
    59  ## Deployment
    60  
    61  See the documentation on [deployment](../doc/deployment.md).