KEMBAR78
chore(benchmarking): Putting temp files in try with resource for cleanup by sydney-munro · Pull Request #2208 · googleapis/java-storage · GitHub
Skip to content

Conversation

@sydney-munro
Copy link
Contributor

No description provided.

@sydney-munro sydney-munro requested a review from a team as a code owner September 14, 2023 20:50
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: storage Issues related to the googleapis/java-storage API. labels Sep 14, 2023
// Create the file to be uploaded and fill it with data
TmpFile file = DataGenerator.base64Characters().tempFile(tempDirectory, objectSize);
BlobInfo blob = BlobInfo.newBuilder(bucketName, file.toString()).build();
try(TmpFile file = DataGenerator.base64Characters().tempFile(tempDirectory, objectSize)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only actual changes here are the additions of the try here

created)
.formatAsCustomMetric());
for (int i = 0; i <= StorageSharedBenchmarkingUtils.DEFAULT_NUMBER_OF_READS; i++) {
try (TmpFile dest = TmpFile.of(tempDirectory, "prefix", "bin")) {
Copy link
Contributor Author

@sydney-munro sydney-munro Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here, the rest is formatting.

@gcf-owl-bot gcf-owl-bot bot requested a review from a team as a code owner September 14, 2023 20:52
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Sep 14, 2023
Copy link
Collaborator

@BenWhitehead BenWhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Primary change looks okay, but there is a follow up for the data generation that will need to be addressed.

// Create the file to be uploaded and fill it with data
TmpFile file = DataGenerator.base64Characters().tempFile(tempDirectory, objectSize);
BlobInfo blob = BlobInfo.newBuilder(bucketName, file.toString()).build();
try (TmpFile file = DataGenerator.base64Characters().tempFile(tempDirectory, objectSize)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't want to use the base64 character set here for generate. It creates highly compressible and dedupeable data which Gcs sometimes will optimize for leading to skewed data.

You can either use the existing rand or port the devUrandom implementation from the existing benchmarks into this repos version.

it's fine to do this in a follow up pr.

@sydney-munro sydney-munro merged commit a6d8100 into main Sep 15, 2023
@sydney-munro sydney-munro deleted the cleanup-tmp branch September 15, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants