From 8f020bc520b581f26a0a824318b74e85a5b59aff Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 1 Feb 2018 15:57:12 -0500 Subject: [PATCH 1/3] Fix location of bytefmt. --- s3-benchmark.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s3-benchmark.go b/s3-benchmark.go index 126b921..d5cfe13 100644 --- a/s3-benchmark.go +++ b/s3-benchmark.go @@ -16,7 +16,7 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" - "github.com/pivotal-golang/bytefmt" + "code.cloudfoundry.org/bytefmt" "io" "io/ioutil" "log" From 75eb9a801e0603f8afe91839feef8bff49c1dc08 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 1 Feb 2018 15:57:48 -0500 Subject: [PATCH 2/3] Add support for AWS region. --- s3-benchmark.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/s3-benchmark.go b/s3-benchmark.go index d5cfe13..52a6c58 100644 --- a/s3-benchmark.go +++ b/s3-benchmark.go @@ -33,7 +33,7 @@ import ( ) // Global variables -var access_key, secret_key, url_host, bucket string +var access_key, secret_key, url_host, bucket, region string var duration_secs, threads, loops int var object_size uint64 var object_data []byte @@ -76,7 +76,7 @@ func getS3Client() *s3.S3 { loglevel := aws.LogOff // Build the rest of the configuration awsConfig := &aws.Config{ - Region: aws.String("us-east-1"), + Region: aws.String(region), Endpoint: aws.String(url_host), Credentials: creds, LogLevel: &loglevel, @@ -98,7 +98,10 @@ func createBucket() { // Get a client client := getS3Client() // Create our bucket (may already exist without error) - in := &s3.CreateBucketInput{Bucket: aws.String(bucket)} + in := &s3.CreateBucketInput{ + Bucket: aws.String(bucket), + CreateBucketConfiguration: &s3.CreateBucketConfiguration{LocationConstraint: aws.String(region),}, + } if _, err := client.CreateBucket(in); err != nil { log.Fatalf("FATAL: Unable to create bucket %s (is your access and secret correct?): %v", bucket, err) } @@ -274,6 +277,7 @@ func main() { myflag.StringVar(&secret_key, "s", "", "Secret key") myflag.StringVar(&url_host, "u", "http://s3.wasabisys.com", "URL for host with method prefix") myflag.StringVar(&bucket, "b", "wasabi-benchmark-bucket", "Bucket for testing") + myflag.StringVar(®ion, "r", "us-east-1", "AWS region") myflag.IntVar(&duration_secs, "d", 60, "Duration of each test in seconds") myflag.IntVar(&threads, "t", 1, "Number of threads to run") myflag.IntVar(&loops, "l", 1, "Number of times to repeat test") @@ -296,8 +300,8 @@ func main() { } // Echo the parameters - logit(fmt.Sprintf("Parameters: url=%s, bucket=%s, duration=%d, threads=%d, loops=%d, size=%s", - url_host, bucket, duration_secs, threads, loops, sizeArg)) + logit(fmt.Sprintf("Parameters: url=%s, bucket=%s, region=%s, duration=%d, threads=%d, loops=%d, size=%s", + url_host, bucket, region, duration_secs, threads, loops, sizeArg)) // Initialize data for the bucket object_data = make([]byte, object_size) From 8aceb04ec049d1069641a70b2b7952b148623c1d Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 1 Feb 2018 17:50:02 -0500 Subject: [PATCH 3/3] Update README.md with support for AWS region. --- README.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2c6a433..5d6641d 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ Below are the command line arguments to the program (which can be displayed usin Duration of each test in seconds (default 60) -l int Number of times to repeat test (default 1) + -r string + AWS region (default "us-east-1") -s string Secret key -t int @@ -57,13 +59,19 @@ writes all results to the log file benchmark.log. ``` ubuntu:~/s3-benchmark$ ./s3-benchmark.ubuntu -a MY-ACCESS-KEY -b jeff-s3-benchmark -s MY-SECRET-KEY -t 10 Wasabi benchmark program v2.0 -Parameters: url=http://s3.wasabisys.com, bucket=jeff-s3-benchmark, duration=60, threads=10, loops=1, size=1M +Parameters: url=http://s3.wasabisys.com, bucket=jeff-s3-benchmark, region=us-east-1, duration=60, threads=10, loops=1, size=1M Loop 1: PUT time 60.1 secs, objects = 5484, speed = 91.3MB/sec, 91.3 operations/sec. Loop 1: GET time 60.1 secs, objects = 5483, speed = 91.3MB/sec, 91.3 operations/sec. Loop 1: DELETE time 1.9 secs, 2923.4 deletes/sec. Benchmark completed. ``` -# Note -Your performance testing benchmark results may vary most often because of limitations of your network connection to the cloud storage provider. Wasabi performance claims are tested under conditions that remove any latency (which can be shown using the ping command) and bandwidth bottlenecks that restrict how fast data can be moved. For more information, -contact Wasabi technical support (support@wasabi.com). +# Notes +* If specifying the region ("-r") with AWS, the URL ("-s") should be specified as such: +``` +s3-benchmark -u https://s3-us-west-2.amazonaws.com -r us-west-2 +s3-benchmark -u https://s3-eu-central-1.amazonaws.com -r eu-central-1 +``` + +* Your performance testing benchmark results may vary most often because of limitations of your network connection to the cloud storage provider. Wasabi performance claims are tested under conditions that remove any latency (which can be shown using the ping command) and bandwidth bottlenecks that restrict how fast data can be moved. For more information, contact Wasabi technical support (support@wasabi.com). +