Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AWS region. #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <other options>
s3-benchmark -u https://s3-eu-central-1.amazonaws.com -r eu-central-1 <other options>
```

* 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).

16 changes: 10 additions & 6 deletions s3-benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)
}
Expand Down Expand Up @@ -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(&region, "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")
Expand All @@ -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)
Expand Down