Skip to content

Commit

Permalink
PR comments REV2
Browse files Browse the repository at this point in the history
  • Loading branch information
sydney-munro committed Aug 17, 2023
1 parent 0627c2d commit 5231f36
Showing 6 changed files with 53 additions and 76 deletions.
6 changes: 6 additions & 0 deletions google-cloud-storage/pom.xml
Original file line number Diff line number Diff line change
@@ -251,6 +251,12 @@
<version>1.7.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.0</version>
<scope>test</scope>
</dependency>

</dependencies>

Original file line number Diff line number Diff line change
@@ -5,17 +5,16 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud;
package com.google.cloud.storage.benchmarking;

import com.google.common.base.MoreObjects;
import java.util.Objects;
Original file line number Diff line number Diff line change
@@ -5,17 +5,16 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud;
package com.google.cloud.storage.benchmarking;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
@@ -66,7 +65,8 @@ public final class StorageSharedBenchmarkingCli implements Runnable {
@Option(
names = "-object_size",
defaultValue = "1048576..1048576",
description = "any positive integer, or an inclusive range such as min..max where min and max are positive integers")
description =
"any positive integer, or an inclusive range such as min..max where min and max are positive integers")
String objectSize;

@Option(
@@ -88,8 +88,13 @@ public static void main(String[] args) {

@Override
public void run() {
// TODO: Make this a switch once we add more workloads
runWorkload1();
switch (testType) {
case "w1r3":
runWorkload1();
break;
default:
throw new IllegalStateException("Specify a workload to run");
}
}

private void runWorkload1() {
Original file line number Diff line number Diff line change
@@ -5,17 +5,15 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud;
package com.google.cloud.storage.benchmarking;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
@@ -26,7 +24,8 @@ class StorageSharedBenchmarkingUtils {
public static int DEFAULT_NUMBER_OF_READS = 3;

public static void cleanupObject(Storage storage, Blob created) {
storage.delete(created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
storage.delete(
created.getBlobId(), Storage.BlobSourceOption.generationMatch(created.getGeneration()));
}

public static double calculateThroughput(long size, Duration elapsedTime) {
Original file line number Diff line number Diff line change
@@ -5,17 +5,16 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.cloud;
package com.google.cloud.storage.benchmarking;

import com.google.cloud.storage.Blob;
import com.google.cloud.storage.BlobInfo;
@@ -55,7 +54,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"WRITE",
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeUpload),
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().longValue(), elapsedTimeUpload),
created)
.toString());
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
@@ -68,7 +68,8 @@ public String call() throws Exception {
System.out.println(
generateCloudMonitoringResult(
"READ[" + i + "]",
StorageSharedBenchmarkingUtils.calculateThroughput(created.getSize().longValue(), elapsedTimeDownload),
StorageSharedBenchmarkingUtils.calculateThroughput(
created.getSize().longValue(), elapsedTimeDownload),
created)
.toString());
}
41 changes: 4 additions & 37 deletions ssb/pom.xml
Original file line number Diff line number Diff line change
@@ -3,15 +3,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>storage-shared-benchmarking</artifactId>
<version>0.0.1-SNAPSHOT</version><!-- This artifact should not be released -->

<parent>
<groupId>com.google.cloud.samples</groupId>
<artifactId>shared-configuration</artifactId>
<version>1.2.0</version>
<relativePath/>
</parent>

<artifactId>ssb</artifactId>

<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
@@ -29,40 +30,6 @@
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>2.26.2-SNAPSHOT</version><!-- {x-version-update:google-cloud-storage:current} -->
<classifier>tests</classifier>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>gax</artifactId>
</dependency>
<dependency>
<groupId>com.google.api</groupId>
<artifactId>api-common</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-core</artifactId>
</dependency>
</dependencies>

<build>
<!-- This plugin enables building the application to a JAR *not* using Native Image -->
@@ -76,7 +43,7 @@
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>dependency-jars/</classpathPrefix>
<mainClass>com.google.cloud.StorageSharedBenchmarkingCli</mainClass>
<mainClass>com.google.cloud.storage.benchmarking.StorageSharedBenchmarkingCli</mainClass>
</manifest>
</archive>
</configuration>

0 comments on commit 5231f36

Please sign in to comment.