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

feat: support variable object name for the workload #23

Merged
merged 1 commit into from
Nov 2, 2024
Merged
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
10 changes: 6 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ var (
ProjectName = flag.String("project", "gcs-fuse-test", "GCP project name.")

clientProtocol = flag.String("client-protocol", "http", "Network protocol.")
objectNamePrefix = "princer_100M_files/file_"
objectNameSuffix = ""

// Object name = objectNamePrefix + {thread_id} + objectNameSuffix
objectNamePrefix = flag.String("obj-prefix", "princer_100M_files/file_", "Object prefix")
objectNameSuffix = flag.String("obj-suffix", "", "Object suffix")

tracerName = "princer-storage-benchmark"
enableTracing = flag.Bool("enable-tracing", false, "Enable tracing with Cloud Trace export")
Expand Down Expand Up @@ -138,7 +140,7 @@ func CreateGrpcClient(ctx context.Context) (client *storage.Client, err error) {
// ReadObject creates reader object corresponding to workerID with the help of bucketHandle.
func ReadObject(ctx context.Context, workerID int, bucketHandle *storage.BucketHandle) (err error) {

objectName := objectNamePrefix + strconv.Itoa(workerID) + objectNameSuffix
objectName := *objectNamePrefix + strconv.Itoa(workerID) + *objectNameSuffix

for i := 0; i < *numOfReadCallPerWorker; i++ {
var span trace.Span
Expand Down Expand Up @@ -250,7 +252,7 @@ func main() {
eG.Go(func() error {
err = ReadObject(ctx, idx, bucketHandle)
if err != nil {
err = fmt.Errorf("while reading object %v: %w", objectNamePrefix+strconv.Itoa(idx), err)
err = fmt.Errorf("while reading object %v: %w", *objectNamePrefix+strconv.Itoa(idx)+*objectNameSuffix, err)
return err
}
return err
Expand Down
Loading