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(storage/append): Support appends in w1r3. #11483

Merged
merged 2 commits into from
Jan 23, 2025
Merged
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
9 changes: 9 additions & 0 deletions storage/internal/benchmarks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type benchmarkOptions struct {
minChunkSize int64
maxChunkSize int64

appendWrites bool

forceGC bool
connPoolSize int

Expand Down Expand Up @@ -142,6 +144,7 @@ func (b *benchmarkOptions) String() string {
fmt.Sprintf("chunk size:\t\t%d - %d kib (library buffer for uploads)", b.minChunkSize/kib, b.maxChunkSize/kib),
fmt.Sprintf("range offset:\t\t%d - %d bytes ", b.minReadOffset, b.maxReadOffset),
fmt.Sprintf("range size:\t\t%d bytes (0 -> full object)", b.rangeSize),
fmt.Sprintf("append writes:\t\t%t", b.appendWrites),
fmt.Sprintf("connection pool size:\t%d (GRPC)", b.connPoolSize),
fmt.Sprintf("num workers:\t\t%d (max number of concurrent benchmark runs at a time)", b.numWorkers),
fmt.Sprintf("force garbage collection:%t", b.forceGC),
Expand Down Expand Up @@ -185,6 +188,8 @@ func parseFlags() {
flag.Int64Var(&opts.minChunkSize, "min_chunksize", useDefault, "min chunksize in bytes")
flag.Int64Var(&opts.maxChunkSize, "max_chunksize", useDefault, "max chunksize in bytes")

flag.BoolVar(&opts.appendWrites, "append_writes", false, "use the append writer")

flag.IntVar(&opts.connPoolSize, "connection_pool_size", 4, "GRPC connection pool size")

flag.BoolVar(&opts.forceGC, "force_garbage_collection", false, "force garbage collection at the beginning of each upload")
Expand Down Expand Up @@ -227,6 +232,10 @@ func parseFlags() {
log.Fatalln("Could not parse object size")
}
}

if opts.appendWrites && (opts.api != grpcAPI && opts.api != directPath) {
log.Fatalf("--append_writes requires GRPC or DirectPath; got %v", opts.api)
}
}

func main() {
Expand Down
5 changes: 5 additions & 0 deletions storage/internal/benchmarks/upload_benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ type uploadOpts struct {
useDefaultChunkSize bool
objectPath string
timeout time.Duration

appendWrites bool
}

func uploadBenchmark(ctx context.Context, uopts uploadOpts) (elapsedTime time.Duration, rerr error) {
Expand Down Expand Up @@ -78,6 +80,9 @@ func uploadBenchmark(ctx context.Context, uopts uploadOpts) (elapsedTime time.Du
if !uopts.useDefaultChunkSize {
objectWriter.ChunkSize = int(uopts.params.chunkSize)
}
if uopts.appendWrites {
objectWriter.Append = true
}

mw, md5Hash, crc32cHash := generateUploadWriter(objectWriter, uopts.params.md5Enabled, uopts.params.crc32cEnabled)

Expand Down
1 change: 1 addition & 0 deletions storage/internal/benchmarks/w1r3.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ func (r *w1r3) run(ctx context.Context) error {
useDefaultChunkSize: opts.minChunkSize == useDefault || opts.maxChunkSize == useDefault,
objectPath: r.objectPath,
timeout: r.opts.timeoutPerOp,
appendWrites: r.opts.appendWrites,
})
}, r.isWarmup)

Expand Down
Loading