Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Latest commit

 

History

History

benchmark

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Introduction

This directory contains benchmark code used to measure overhead of generated client libraries.

This directory is experimental. It might be changed or removed in the future.

TLS Certificate

Our benchmarks use TLS connections. If the benchmark and the mock server is run on the same machine, you can create your own TLS certificate by following directions here and configure Common Name to localhost.

Mock Server

The server directory contains a mock server that benchmarks can call RPCs against. To run the server:

  • Install Go
  • Install dependencies
    • go get -u google.golang.org/genproto/googleapis/pubsub/v1 google.golang.org/grpc
  • go run server.go -key <keyfile> -cert <certfile>
    • where keyfile and certfile are TLS key and certificate files, respectively
    • by default, server will start on localhost:8080
    • for more configuration, run go run server.go -help

Common Options

Benchmarks of most languages accept some of the same options.

  • cert_file
    • This is the TLS certificate file that the benchmark will use to established secured connection with the server.
  • client
    • This option should either be "grpc" or "gapic", depending on which client you wish to benchmark.
  • num_workers
    • This option controls how many concurrent RPCs may be made to the server.
    • Set to 1, the benchmark will measure RPC latency.
    • Set to a large number (say 20) the benchmark will fully load a CPU and measure CPU cost.

By default, benchmarks will make RPCs against the server at localhost:8080.

Java

Benchmark for Java is located in the clients/java/pubsub directory.

To run the benchmark, you need to install Maven.

To run: mvn exec:java -Dexec.mainClass="com.google.cloud.bench.Pubsub" -Dexec.args="-cert <cert_file> -c <client> -n <num_workers>"

For more configuration, run the command with -Dexec.args="-help" to bring up the help menu.

Go

Benchmark for Go is located at clients/go/local.go. To run: go run clients/go/local.go -cert <cert_file> -client <client> -num_workers <num_workers>

For the help menu, run go run clients/go/local.go -help.

PHP

Benchmark for PHP is located at clients/php/local.php. To install dependencies: composer install To run: php local.php -cert <cert_file> -client <client>

PHP does not support async calls.