From ec00e5a3f0ab0e59bbdb6915ffb53a9dca5f168e Mon Sep 17 00:00:00 2001 From: Stephen Nancekivell Date: Tue, 3 May 2022 02:06:11 +1000 Subject: [PATCH] feat(bigtable): loadtest support app profile (#5882) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, I found using an app profile greatly improved my 99th performance. So it would be nice to support it profiles in `loadtest`. Can be used like this. ``` ./loadtest -project $PROJECT -instance $INSTANCE 2022/04/11 17:06:02 -creds flag unset, will use gcloud credential 2022/04/11 17:06:03 Dialing connections... 2022/04/11 17:06:03 Setting up scratch table... 2022/04/11 17:06:47 Starting load test... (run for 5s) 2022/04/11 17:06:58 Reads (2036 ok / 2036 tries): min: 3.55575ms median: 5.755416ms max: 7.140176875s 95th percentile: 1.187244416s 99th percentile: 6.039376264s 2022/04/11 17:06:58 Writes (2060 ok / 2060 tries): min: 3.952833ms median: 6.225167ms max: 7.369702958s 95th percentile: 1.47177056s 99th percentile: 5.784249186s ➜ bigtable git:(main) ✗ ./loadtest -project $PROJECT -instance $INSTANCE -app_profile syd 2022/04/11 17:07:05 -creds flag unset, will use gcloud credential 2022/04/11 17:07:06 Dialing connections... 2022/04/11 17:07:06 Setting up scratch table... 2022/04/11 17:08:36 Starting load test... (run for 5s) 2022/04/11 17:08:41 Reads (18951 ok / 18951 tries): min: 3.921583ms median: 10.810541ms max: 315.866792ms 95th percentile: 22.642271ms 99th percentile: 40.233812ms 2022/04/11 17:08:41 Writes (18686 ok / 18686 tries): min: 4.494417ms median: 11.303666ms max: 328.434125ms 95th percentile: 22.95579ms 99th percentile: 41.21401ms ``` --- bigtable/cmd/loadtest/loadtest.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bigtable/cmd/loadtest/loadtest.go b/bigtable/cmd/loadtest/loadtest.go index d04513439836..60346531d38d 100644 --- a/bigtable/cmd/loadtest/loadtest.go +++ b/bigtable/cmd/loadtest/loadtest.go @@ -45,8 +45,9 @@ var ( scratchTable = flag.String("scratch_table", "loadtest-scratch", "name of table to use; should not already exist") csvOutput = flag.String("csv_output", "", "output path for statistics in .csv format. If this file already exists it will be overwritten.") - poolSize = flag.Int("pool_size", 1, "size of the gRPC connection pool to use for the data client") - reqCount = flag.Int("req_count", 100, "number of concurrent requests") + poolSize = flag.Int("pool_size", 1, "size of the gRPC connection pool to use for the data client") + reqCount = flag.Int("req_count", 100, "number of concurrent requests") + appProfile = flag.String("app_profile", "", "The application profile to use.") config *cbt.Config client *bigtable.Client @@ -94,7 +95,13 @@ func main() { } log.Printf("Dialing connections...") - client, err = bigtable.NewClient(context.Background(), config.Project, config.Instance, options...) + client, err = bigtable.NewClientWithConfig( + context.Background(), + config.Project, + config.Instance, + bigtable.ClientConfig{AppProfile: *appProfile}, + options..., + ) if err != nil { log.Fatalf("Making bigtable.Client: %v", err) }